From patchwork Wed Dec 22 15:15:52 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 76420 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 588B0B6EED for ; Thu, 23 Dec 2010 02:16:06 +1100 (EST) Received: (qmail 17098 invoked by alias); 22 Dec 2010 15:16:04 -0000 Received: (qmail 17089 invoked by uid 22791); 22 Dec 2010 15:16:03 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, TW_BJ, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Dec 2010 15:15:58 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 2C543A1F; Wed, 22 Dec 2010 16:15:56 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id jO-q0c-AMiKg; Wed, 22 Dec 2010 16:15:53 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 6B610A1E; Wed, 22 Dec 2010 16:15:53 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id oBMFFq95014296; Wed, 22 Dec 2010 16:15:52 +0100 (MET) From: Rainer Orth To: gcc-patches@gcc.gnu.org Cc: Paolo Bonzini , Nicola Pero Subject: [build, objc] Link libobjc*.la with -shared-libgcc Date: Wed, 22 Dec 2010 16:15:52 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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)