diff mbox

Fix libbacktrace -fPIC breakage from "Use libbacktrace in libgfortran"

Message ID 201508241640.t7OGercr016460@ignucius.se.axis.com
State New
Headers show

Commit Message

Hans-Peter Nilsson Aug. 24, 2015, 4:40 p.m. UTC
> From: FX <fxcoudert@gmail.com>
> Date: Mon, 24 Aug 2015 18:07:52 +0200

> > PIC_FLAG= 
> > if test -n "${with_target_subdir}"; then
> > -  PIC_FLAG=-fPIC
> > +  AC_TRY_COMPILE([void foo(void){}], [PIC_FLAG=-fPIC])
> > fi
> 
> There's something I don't understand about this
> test. Shouldn't AC_TRY_COMPILE take a first (empty) argument,
> "includes"? And shouldn't you first set the -fPIC flag before
> try to compile with that?

You're absolutely right on both accounts.  Also, the function
body is supposed to be a function body (...) or else we get a
nested function (i.e. foo inside main).  Might as well provide
both empty.  Also fixing the ChangeLog entry.  Sorry for
goofing.  (At least I had a look at config.log this time...)

	* configure.ac: Only compile with -fPIC if the target
	supports it.
	* configure: Regenerate.



brgds, H-P

Comments

FX Coudert Aug. 24, 2015, 6:05 p.m. UTC | #1
> You're absolutely right on both accounts.  Also, the function
> body is supposed to be a function body (...) or else we get a
> nested function (i.e. foo inside main).  Might as well provide
> both empty.  Also fixing the ChangeLog entry.  Sorry for
> goofing.  (At least I had a look at config.log this time…)

That looks better :)
But I can’t approve the patch.

FX
Ian Lance Taylor Aug. 25, 2015, 1:49 a.m. UTC | #2
Hans-Peter Nilsson <hans-peter.nilsson@axis.com> writes:

> 	* configure.ac: Only compile with -fPIC if the target
> 	supports it.
> 	* configure: Regenerate.

This is OK.

Thanks.

Ian
diff mbox

Patch

diff -upr /expvol/pp_slask/hp/checkout/gcchead/gcc/libbacktrace/configure.ac libbacktrace/configure.ac
--- /expvol/pp_slask/hp/checkout/gcchead/gcc/libbacktrace/configure.ac	2015-05-29 17:23:20.000000000 +0200
+++ libbacktrace/configure.ac	2015-08-24 18:31:01.000000000 +0200
@@ -163,10 +163,14 @@  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.
+# 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
-  PIC_FLAG=-fPIC
+  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:
 AC_ARG_ENABLE(host-shared,