[MPlayer-dev-eng] [PATCH] Disable additional optimization if compiler doesn't support __attribute__((used))
Uoti Urpala
uoti.urpala at pp1.inet.fi
Mon Jun 11 00:57:48 CEST 2007
On Sun, 2007-06-10 at 15:58 -0600, Loren Merritt wrote:
> 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.
There's no such ABI for static variables. Especially if no pointer to
them is passed out of the file the compiler can do whatever it wants
with them, including changing their type, removing them completely (like
the problem here) or naming them whatever in the asm file.
> I wouldn't call it a hack.
I think it is a hack especially for static variables. When referring to
globals that are defined according to the platform ABI it might be less
hacky.
> 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.
There's no way to access a C compiler's static variables from a pure asm
file. You could define your own in the asm but that's a different case.
More information about the MPlayer-dev-eng
mailing list