bin/101590: -O2 optimizing out abi-tag note from executables
Bruce Evans
bde at zeta.org.au
Mon Aug 7 21:40:29 UTC 2006
The following reply was made to PR bin/101590; it has been noted by GNATS.
From: Bruce Evans <bde at zeta.org.au>
To: Dan Nelson <dnelson at allantgroup.com>
Cc: FreeBSD-gnats-submit at FreeBSD.org, freebsd-bugs at FreeBSD.org
Subject: Re: bin/101590: -O2 optimizing out abi-tag note from executables
Date: Tue, 8 Aug 2006 07:38:03 +1000 (EST)
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