Fix libbacktrace -fPIC breakage from "Use libbacktrace in libgfortran"
Ulrich Weigand
uweigand@de.ibm.com
Tue Aug 25 17:45:00 GMT 2015
Hans-Peter Nilsson wrote:
> > From: Ulrich Weigand <uweigand@de.ibm.com>
> > Date: Tue, 25 Aug 2015 14:59:05 +0200
>
> > The other GCC run-time libraries rely on libtool to figure out
> > that even though -fPIC works, dynamic libraries are still not
> > supported on the platform, and thus compile everything for
> > static linking (i.e. without -fPIC).
>
> That's not what I see, at least not the "figuring out" part.
> (They mostly use libtool as-is; some test tuples, but some test
> version-script support and add it then.)
Well, the "figuring out" is implicit; because libtool knows the
platform does not support dynamic linking, it defaults to
--disable-shared, which means only static libraries are being
built; and the default compile option when building static
libraries does not use -fPIC.
> I'll leave that to you to sort out, but if you chose to use
> $can_build_shared, consider also setting PIC_FLAG to $pic_flag
> (instead of plain -fPIC). In the meantime I'll commit my patch
> as it solves *some* of the breakage; for targets erroring on -fPIC.
>
> ...but reading the libtool documention I think I found a much
> better solution: Let's just add -prefer-pic when compiling
> libbacktrace. It leaves everything to libtool. Can you please
> test this?
Hmm, reading the documentation an even simpler version that has
equivalent effect to yours should be just adding the pic-only
option when calling LT_INIT.
However, neither works for the SPU, because in both cases libtool
will only do the test whether the target supports the -fPIC option.
It will not test whether the target supports dynamic libraries.
[ It will do that test; and default to --disable-shared on SPU.
That is a no-op for libbacktrace however, since it calls LT_INIT
with the disable-shared option anyway. When adding back the -fPIC
flag due to either the pic-only LT_INIT option or the -prefer-pic
libtool command line option, it does not check for that again. ]
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU/Linux compilers and toolchain
Ulrich.Weigand@de.ibm.com
More information about the Fortran
mailing list