From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: hans-peter.nilsson@axis.com (Hans-Peter Nilsson)
Cc: ian@airs.com, fxcoudert@gmail.com, gcc-patches@gcc.gnu.org,
ubizjak@gmail.com, fortran@gcc.gnu.org
Subject: [PATCH] Fix and simplify (Re: Fix libbacktrace -fPIC breakage from "Use libbacktrace in libgfortran")
Date: Wed, 26 Aug 2015 15:37:00 -0000 [thread overview]
Message-ID: <20150826141943.593D039FA@oc7340732750.ibm.com> (raw)
In-Reply-To: <201508261233.t7QCXf4J020098@ignucius.se.axis.com> from "Hans-Peter Nilsson" at Aug 26, 2015 02:33:41 PM
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.
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
next prev parent reply other threads:[~2015-08-26 15:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-14 13:19 [patch,libgfortran,toplevel] Use libbacktrace in libgfortran Uros Bizjak
2015-08-14 14:31 ` FX
2015-08-23 20:14 ` Janne Blomqvist
2015-08-23 20:59 ` FX
2015-08-23 21:27 ` Janne Blomqvist
2015-08-24 7:15 ` FX
2015-08-24 16:00 ` Fix libbacktrace -fPIC breakage from "Use libbacktrace in libgfortran" Hans-Peter Nilsson
2015-08-24 16:08 ` FX
2015-08-24 16:44 ` Hans-Peter Nilsson
2015-08-24 18:42 ` FX
2015-08-25 3:29 ` Ian Lance Taylor
2015-08-25 13:25 ` Ulrich Weigand
2015-08-25 17:09 ` Hans-Peter Nilsson
2015-08-25 17:57 ` Ulrich Weigand
2015-08-26 0:09 ` Hans-Peter Nilsson
2015-08-26 12:17 ` Ulrich Weigand
2015-08-26 12:34 ` Hans-Peter Nilsson
2015-08-26 15:37 ` Ulrich Weigand [this message]
2015-08-27 4:02 ` [PATCH] Fix and simplify (Re: Fix libbacktrace -fPIC breakage from "Use libbacktrace in libgfortran") Ian Lance Taylor
2015-08-27 13:38 ` Ulrich Weigand
2015-08-27 14:02 ` Ian Lance Taylor
2015-08-24 16:04 ` Fix libbacktrace -fPIC breakage from "Use libbacktrace in libgfortran" Hans-Peter Nilsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150826141943.593D039FA@oc7340732750.ibm.com \
--to=uweigand@de.ibm.com \
--cc=fortran@gcc.gnu.org \
--cc=fxcoudert@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=hans-peter.nilsson@axis.com \
--cc=ian@airs.com \
--cc=ubizjak@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).