Comments

While developing the patch to use dl_iterate_phdr in the libgcc unwinder
on Solaris 11
Use dl_iterate_phdr in Solaris 11+ unwinder
http://gcc.gnu.org/ml/gcc-patches/2010-11/msg02770.html
http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00978.html
http://gcc.gnu.org/ml/gcc-patches/2010-12/msg01690.html
I noticed that a couple of objc.dg tests were failing when using GNU ld:
+FAIL: objc.dg/lto/trivial-1 objc_lto_trivial-1_0.o-objc_lto_trivial-1_0.o link, -O0 -fwhopr -fgnu-runtime
+UNRESOLVED: objc.dg/lto/trivial-1 objc_lto_trivial-1_0.o-objc_lto_trivial-1_0.o execute -O0 -fwhopr -fgnu-runtime
/vol/gcc/bin/gld-2.20.51: objc-dg-lto-trivial-1-01: hidden symbol `__gcc_personality_v0' in /vol/gcc/obj/gcc-4.6.0-20101029/11-gcc-gas-gld-cvs/gcc/libgcc_eh.a(unwind-c.o) is referenced by DSO
/vol/gcc/bin/gld-2.20.51: final link failed: Nonrepresentable section on output
While the problem is gone when using --as-needed (via USE_LD_AS_NEEDED),
I cannot do this since it causes any trivial problem to be linked with
libgcc_s.so.1, which isn't right. As mentioned in the final link above,
I've filed a binutils PR for that, but haven't yet received any
response.
I've I check the resulting libobjc.so.2 with ldd -d, I find
$ ldd -d libobjc.so.2
libc.so.1 => /lib/libc.so.1
symbol not found: __gcc_personality_v0 (../../../i386-pc-solari
s2.11/libobjc/.libs/libobjc.so.2)
libm.so.2 => /lib/libm.so.2
that it has an undefined reference to __gcc_personality_v0, i.e. should
be linked with the shared libgcc_s.so.1. Given that libobjc.so does
exception handling, the description of -shared-libgcc suggests that
using that option is the right thing to do. The following patch does
exactly that.
The issue does not occur with Sun ld, since -shared results in always
linking with -lgcc_s:
%{shared:-lgcc_s}}}
while with gld, the libgcc spec looks like this:
%{shared:%{shared-libgcc:-lgcc_s}%{!shared-libgcc:-lgcc}}}}
As described in the third link, 6 bootstraps (i386 and sparc, sun ld
with as, gas, gld with gas) are currently running. Ok for mainline if
they all pass?
Thanks.
Rainer
2010-12-22 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* Makefile.in (libobjc$(libsuffix).la): Link with -shared-libgcc.
(libobjc_gc$(libsuffix).la): Likewise.