From patchwork Wed Jul 13 18:05:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 104572 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 DA174B6F65 for ; Thu, 14 Jul 2011 04:05:47 +1000 (EST) Received: (qmail 19122 invoked by alias); 13 Jul 2011 18:05:45 -0000 Received: (qmail 19113 invoked by uid 22791); 13 Jul 2011 18:05:44 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, 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, 13 Jul 2011 18:05:30 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 5491FF0 for ; Wed, 13 Jul 2011 20:05:29 +0200 (CEST) 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 Otj63SP0TdFV for ; Wed, 13 Jul 2011 20:05:27 +0200 (CEST) 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 95FF1EF for ; Wed, 13 Jul 2011 20:05:27 +0200 (CEST) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.4+Sun/8.14.4/Submit) id p6DI5R14008419; Wed, 13 Jul 2011 20:05:27 +0200 (MEST) From: Rainer Orth To: gcc-patches@gcc.gnu.org Subject: Avoid overriding LIB_THREAD_LDFLAGS_SPEC on Solaris 8 (PR target/49541) Date: Wed, 13 Jul 2011 20:05:27 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (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 As reported in the PR, LIB_THREAD_LDFLAGS_SPEC (effectively -L/usr/lib/lwp(/64)? -R/usr/lib/lwp(/64)? to make use of the alternate thread library on Solaris 8, which also provides the only implementation of __tls_get_addr) could be overridden by the regular -L flags from the %D spec for 64-bit compilations to find /lib/sparcv9/libthread.so instead, which lacks that function, causing link failures. This patch fixes this by moving the -L/-R flags from LIB_SPEC to LINK_SPEC which is before %D. Bootstrapped without regressions on sparc-sun-solaris2.8 and i386-pc-solaris2.8 by myself (though in a branded zone which doesn't show the problem directly) and by Eric on bare-metal Solaris 8. Installed on mainline, will backport to the 4.6 branch after testing. Rainer 2011-07-08 Rainer Orth PR target/49541 * config/sol2.h (LIB_SPEC): Simplify. Move LIB_THREAD_LDFLAGS_SPEC ... (LINK_SPEC): ... here. diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -109,10 +109,8 @@ along with GCC; see the file COPYING3. #undef LIB_SPEC #define LIB_SPEC \ "%{!symbolic:\ - %{pthreads|pthread:" \ - LIB_THREAD_LDFLAGS_SPEC " -lpthread " LIB_TLS_SPEC "} \ - %{fprofile-generate*:" \ - LIB_THREAD_LDFLAGS_SPEC " " LIB_TLS_SPEC "} \ + %{pthreads|pthread:-lpthread} \ + %{pthreads|pthread|fprofile-generate*:" LIB_TLS_SPEC "} \ %{p|pg:-ldl} -lc}" #ifndef CROSS_DIRECTORY_STRUCTURE @@ -175,6 +173,7 @@ along with GCC; see the file COPYING3. %{static:-dn -Bstatic} \ %{shared:-G -dy %{!mimpure-text:-z text}} \ %{symbolic:-Bsymbolic -G -dy -z text} \ + %{pthreads|pthread|fprofile-generate*:" LIB_THREAD_LDFLAGS_SPEC "} \ %(link_arch) \ %{Qy:} %{!Qn:-Qy}"