diff mbox

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

Message ID 201508241555.t7OFt1VI015330@ignucius.se.axis.com
State New
Headers show

Commit Message

Hans-Peter Nilsson Aug. 24, 2015, 3:55 p.m. UTC
(Goofed on the CC line, sorry for the dup.)

There exists targets that support fortran but error on -fPIC,
for example cris-elf, which broke with the libbacktrace thingy.
(Emitting an error for -fPIC is a conscious choice; a
compilation error is better than e.g. to silently ignoring it.)
This fix causes build to pass the point of error for cris-elf.
Borderline obvious, but...

Ok to regtest passes on a native x86_64-linux?

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


brgds, H-P

Comments

FX Coudert Aug. 24, 2015, 4:07 p.m. UTC | #1
> 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?

FX
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 17:31:18.000000000 +0200
@@ -163,10 +163,11 @@  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 a function with that option.
 PIC_FLAG=
 if test -n "${with_target_subdir}"; then
-  PIC_FLAG=-fPIC
+  AC_TRY_COMPILE([void foo(void){}], [PIC_FLAG=-fPIC])
 fi
 # Similarly, use -fPIC with --enable-host-shared:
 AC_ARG_ENABLE(host-shared,