[MPlayer-dev-eng] [PATCH] Disable additional optimization if compiler doesn't support __attribute__((used))

Trent Piepho xyzzy at speakeasy.org
Mon Jun 11 02:55:11 CEST 2007


On Sun, 10 Jun 2007, Loren Merritt wrote:
> 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

If you want to produce pic code (and not use text relocations), then this
won't work.  With asm constraints it's possible to do both, have a constant
address for non-pic code, an address in a register for pic on ia32, and a
rip-relative constant address for pic on x86-64.  And you don't have to
worry about name mangling or variables disappearing.

> 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.

If you want to access a C global from an asm file, shouldn't the global not
be static?



More information about the MPlayer-dev-eng mailing list