public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [build, objc] Link libobjc*.la with -shared-libgcc
@ 2010-12-22 15:39 Rainer Orth
  2010-12-22 22:46 ` Andrew Pinski
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2010-12-22 15:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: Paolo Bonzini, Nicola Pero

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.

diff -r d0a13ed0b7c5 libobjc/Makefile.in
--- a/libobjc/Makefile.in	Wed Dec 22 11:58:53 2010 +0100
+++ b/libobjc/Makefile.in	Wed Dec 22 12:02:21 2010 +0100
@@ -1,6 +1,6 @@
 # Makefile for GNU Objective C runtime library.
 # Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 #This file is part of GCC.
 
@@ -325,13 +325,13 @@
 
 libobjc$(libsuffix).la: $(OBJS)
 	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
-		-rpath $(toolexeclibdir) \
+		-shared-libgcc -rpath $(toolexeclibdir) \
 		-version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \
 		$(LTLDFLAGS)
 
 libobjc_gc$(libsuffix).la: $(OBJS_GC)
 	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
-		-rpath $(toolexeclibdir) \
+		-shared-libgcc -rpath $(toolexeclibdir) \
 		-version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
 		$(LTLDFLAGS)
 
-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [build, objc] Link libobjc*.la with -shared-libgcc
  2010-12-22 15:39 [build, objc] Link libobjc*.la with -shared-libgcc Rainer Orth
@ 2010-12-22 22:46 ` Andrew Pinski
  2010-12-23 13:29   ` Rainer Orth
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Pinski @ 2010-12-22 22:46 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, Paolo Bonzini, Nicola Pero

On Wed, Dec 22, 2010 at 7:15 AM, Rainer Orth
<ro@cebitec.uni-bielefeld.de> wrote:
>
> 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.

Yes this is ok.

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [build, objc] Link libobjc*.la with -shared-libgcc
  2010-12-22 22:46 ` Andrew Pinski
@ 2010-12-23 13:29   ` Rainer Orth
  0 siblings, 0 replies; 3+ messages in thread
From: Rainer Orth @ 2010-12-23 13:29 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches, Paolo Bonzini, Nicola Pero

Andrew Pinski <pinskia@gmail.com> writes:

> On Wed, Dec 22, 2010 at 7:15 AM, Rainer Orth
> <ro@cebitec.uni-bielefeld.de> wrote:
>>
>> 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.
>
> Yes this is ok.

Thanks.  Actual testing revealed that a plain -shared-libgcc is
swallowed by libtool, but using -Wc,-shared-libgcc works as expected.
So here's the actual patch I've checked in.  Libtool continues to remain
a mystery to me ;-)

	Rainer


2010-12-22  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* Makefile.in (libobjc$(libsuffix).la): Link with -Wc,-shared-libgcc.
	(libobjc_gc$(libsuffix).la): Likewise.

diff -r ba5f37177ba3 libobjc/Makefile.in
--- a/libobjc/Makefile.in	Wed Dec 22 12:22:52 2010 +0100
+++ b/libobjc/Makefile.in	Wed Dec 22 17:08:02 2010 +0100
@@ -1,6 +1,6 @@
 # Makefile for GNU Objective C runtime library.
 # Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 #This file is part of GCC.
 
@@ -325,13 +325,13 @@
 
 libobjc$(libsuffix).la: $(OBJS)
 	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS) \
-		-rpath $(toolexeclibdir) \
+		-Wc,-shared-libgcc -rpath $(toolexeclibdir) \
 		-version-info $(LIBOBJC_VERSION) $(extra_ldflags_libobjc) \
 		$(LTLDFLAGS)
 
 libobjc_gc$(libsuffix).la: $(OBJS_GC)
 	$(LIBTOOL_LINK) $(CC) -o $@ $(OBJS_GC) $(OBJC_BOEHM_GC_LIBS) \
-		-rpath $(toolexeclibdir) \
+		-Wc,-shared-libgcc -rpath $(toolexeclibdir) \
 		-version-info $(LIBOBJC_GC_VERSION) $(extra_ldflags_libobjc) \
 		$(LTLDFLAGS)
 

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-23 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-22 15:39 [build, objc] Link libobjc*.la with -shared-libgcc Rainer Orth
2010-12-22 22:46 ` Andrew Pinski
2010-12-23 13:29   ` Rainer Orth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).