bin/101590: -O2 optimizing out abi-tag note from executables

Bruce Evans bde at zeta.org.au
Mon Aug 7 21:38:08 UTC 2006


On Mon, 7 Aug 2006, Dan Nelson wrote:

>> Fix:
>
> Mark abitag as __used instead of __unused, which will force gcc to
> leave the symbol in the resulting object file even though it's static
> and has no references.

"__used" is misspelled "__unused" in several other places.  "__used" is new
so it is rarely used.  "__unused" had to be used bogusly to prevent warnings
about things that are used but which the compiler couldn't see are used,
but now the correct spelling can be used.

"__used" is now defined in <sys/cdefs.h>, but <sys/cdefs.h> doesn't
actually use it.  E.g., <sys/cdefs.h still uses "__unused" for __IDSTRING(),
but only in the non-__GNUC__ case which is broken anyway due to related
bugs (some header files use __aligned(), but __aligned is intentionally
left undefined to properly break the non-__GNUC__ case).  The usual case
of __IDSTRING() (and thus __FBSDID()) apparently works because the usedness
is hidden in an asm statement.

crtbrand.c hard-codes the gccism __attribute((...__[un]used)) instead
of using the macro __[un]used defined in <sys/cdefs.h>.  This is almost
correct, since crtbrand.c needs to use more attributes than <sys/cdefs.h>
can reasonably define.

Bruce


More information about the freebsd-bugs mailing list