[MPlayer-dev-eng] [PATCH] Disable additional optimization if compiler doesn't support __attribute__((used))
Loren Merritt
lorenm at u.washington.edu
Sun Jun 10 23:58:13 CEST 2007
On Sun, 10 Jun 2007, Guillaume POIRIER wrote:
>
> BTW, I always wondered what MANGLE was supposed to do. What you just
> wrote makes me think that MANGLE is a way to access, within an ASM
> block, variables that aren't in the IN/OUT/Clobber list of the ASM
> block.
> Considering that GCC 2.95 allows only a limited amount of IN/OUT, I
> can understand why such a "hack" (it's a hack, right?) has been used.
To access a static const variable in an asm block, you don't need any
asm constraints. Just write the variable name literally in the asm. But
this is where mangling comes in: The name that the compiler uses for a
variable or function is not necessarily identical to the name you wrote
in the sourcecode. Some C ABIs prepend a "_", and some don't (C++ gets
more complicated, but we don't care about that). So the name that you
write in the asm block has to match the name that the compiler generated
for the variable, and MANGLE performs that translation.
I wouldn't call it a hack. It is the only way to access static/global
variables if you're writing pure asm files, and it doesn't get any less
valid just because gcc inline asm provides another way.
--Loren Merritt
More information about the MPlayer-dev-eng
mailing list