From patchwork Wed Aug 26 14:19:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 510913 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C2A2B14018C for ; Thu, 27 Aug 2015 01:15:41 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=J/E53uLj; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:date:from:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=FIxl2 sFECElMqJ7Gs4V8NLshYfANzwWBqaOS5y6McRDMSoQXoSEGRtqryt6y6IKyE+veH 5Qrm9/UaF0L208dkZwfu6uwZZ/JgaZeyRxviAZiWKsyYd1BxQIzXYKuCY4GqhSBv 47mkJvUskuBdABDgoF1NfBHhbEX5wQYtxt4lws= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:date:from:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=hQ+/JZnCyOc Jq0mHa88Fo2ousJs=; b=J/E53uLjsfIHItGOl+1Cm/i+lDSvIA9QiHyEsc3VVeS JHjGrDWDK+SWjoz0+UVD8u29kP94Pdw1N6lhgRtWQSRmVJzCD7qjr10wx9IClJvi MaBSPC/JYTbiEpVtBkdJpjcL3Z8q1IpI2uSX6pRuqH/Z4IiRd4ztsLPPTpUHLG4E = Received: (qmail 45964 invoked by alias); 26 Aug 2015 15:15:34 -0000 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 Received: (qmail 45948 invoked by uid 89); 26 Aug 2015 15:15:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=unavailable version=3.3.2 X-HELO: e06smtp17.uk.ibm.com Received: from e06smtp17.uk.ibm.com (HELO e06smtp17.uk.ibm.com) (195.75.94.113) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Wed, 26 Aug 2015 15:15:31 +0000 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Aug 2015 16:15:05 +0100 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp17.uk.ibm.com (192.168.101.147) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Aug 2015 16:14:53 +0100 X-MailFrom: uweigand@de.ibm.com X-RcptTo: gcc-patches@gcc.gnu.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2CF8F17D9B8E; Wed, 26 Aug 2015 15:21:44 +0100 (BST) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7QEK2Hx26017952; Wed, 26 Aug 2015 14:20:05 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7QEJq1Z031432; Wed, 26 Aug 2015 08:19:52 -0600 Received: from oc7340732750.ibm.com (dyn-9-152-213-24.boeblingen.de.ibm.com [9.152.213.24]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t7QEJqFM031090; Wed, 26 Aug 2015 08:19:52 -0600 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 593D039FA; Wed, 26 Aug 2015 16:19:43 +0200 (CEST) Subject: [PATCH] Fix and simplify (Re: Fix libbacktrace -fPIC breakage from "Use libbacktrace in libgfortran") To: hans-peter.nilsson@axis.com (Hans-Peter Nilsson) Date: Wed, 26 Aug 2015 16:19:43 +0200 (CEST) From: "Ulrich Weigand" Cc: ian@airs.com, fxcoudert@gmail.com, gcc-patches@gcc.gnu.org, ubizjak@gmail.com, fortran@gcc.gnu.org In-Reply-To: <201508261233.t7QCXf4J020098@ignucius.se.axis.com> from "Hans-Peter Nilsson" at Aug 26, 2015 02:33:41 PM MIME-Version: 1.0 Message-Id: <20150826141943.593D039FA@oc7340732750.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15082615-0029-0000-0000-000006178AD2 Hans-Peter Nilsson wrote: > I don't feel very confused, but I understand you've investigated > things down to a point where we can conclude that libtool can't > do what SPU needs without also at least fiddling with > compilation options. Well, looks like I was confused after all. I missed one extra feature of libtool that does indeed just make everything work automatically: if a library is set up using the "noinst" flag, libtool considers it a "convenience library" and will never create a shared library in any case; but it will create two sets of object files, one suitable for linking into a static library and one suitable for linking into a shared library, and will automatically use the correct set when linking any other library against the "convenince library". This is exactly what we want to happen for libbacktrace. And in fact, it is *already* set up as convenience library: noinst_LTLIBRARIES = libbacktrace.la This means the only thing we need to do is simply remove all the special code: no more "disable-shared" and no more fiddling with -fPIC (except for the --enable-host-shared case, which remains special just like it does in all other libraries). I've verified that this works on x86_64: the resulting libgfortran.so uses the -fPIC version of the libbacktrace object, while libgfortran.a uses the non-PIC versions. On SPU, libtool will now automatically only generate the non-PIC versions since the target does not support shared library. So everything works as expected. OK for mainline? Bye, Ulrich Index: libbacktrace/configure.ac =================================================================== --- libbacktrace/configure.ac (revision 227217) +++ libbacktrace/configure.ac (working copy) @@ -79,7 +79,7 @@ case "$AWK" in "") AC_MSG_ERROR([can't build without awk]) ;; esac -LT_INIT([disable-shared]) +LT_INIT AM_PROG_LIBTOOL backtrace_supported=yes @@ -161,22 +161,11 @@ else fi fi -# When building as a target library, shared libraries may want to link -# this in. We don't want to provide another shared library to -# complicate dependencies. Instead, we just compile with -fPIC, if -# the target supports compiling with that option. -PIC_FLAG= -if test -n "${with_target_subdir}"; then - ac_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -fPIC" - AC_TRY_COMPILE([], [], [PIC_FLAG=-fPIC]) - CFLAGS="$ac_save_CFLAGS" -fi -# Similarly, use -fPIC with --enable-host-shared: +# Enable --enable-host-shared. AC_ARG_ENABLE(host-shared, [AS_HELP_STRING([--enable-host-shared], [build host code as shared libraries])], -[PIC_FLAG=-fPIC], []) +[PIC_FLAG=-fPIC], [PIC_FLAG=]) AC_SUBST(PIC_FLAG) # Test for __sync support.