aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2025-04-08 14:57:05 +0200
committerRichard Biener <rguenth@gcc.gnu.org>2025-04-09 09:38:17 +0200
commitfaff25435b0d23b2ac4deef5a9434c8cd098c0d2 (patch)
tree5bbb7e6d42a4767814d8ba74e3fedb9f37b84497
parent2d7e1d6e40a13a5f160b584336795b80f193ec3b (diff)
downloadgcc-faff25435b0d23b2ac4deef5a9434c8cd098c0d2.zip
gcc-faff25435b0d23b2ac4deef5a9434c8cd098c0d2.tar.gz
gcc-faff25435b0d23b2ac4deef5a9434c8cd098c0d2.tar.bz2
bootstrap/119680 - fix cross-compiler build with --enable-host-shared
It seems that at least when cross-compiling at least collect2 pulls in objects from libbacktrace.a which is linked via LIBDEPS. But libbacktrace for the host is only built -fPIC with --enable-host-shared but not -fPIE with --enable-host-pie so this fails. The following teaches libbacktrace about --enable-host-pie and handles it similar to libcpp. PR bootstrap/119680 libbacktrace/ * configure.ac (--enable-host-pie): Handle by setting PIC_FLAG to -fPIE. * configure: Regenerate.
-rwxr-xr-xlibbacktrace/configure16
-rw-r--r--libbacktrace/configure.ac7
2 files changed, 18 insertions, 5 deletions
diff --git a/libbacktrace/configure b/libbacktrace/configure
index 0ecdd3e..85be043 100755
--- a/libbacktrace/configure
+++ b/libbacktrace/configure
@@ -814,6 +814,7 @@ enable_largefile
enable_cet
enable_werror
with_system_libunwind
+enable_host_pie
enable_host_shared
'
ac_precious_vars='build_alias
@@ -1464,6 +1465,7 @@ Optional Features:
--disable-largefile omit support for large files
--enable-cet enable Intel CET in target libraries [default=auto]
--disable-werror disable building with -Werror
+ --enable-host-pie build host code as PIE
--enable-host-shared build host code as shared libraries
--enable-cet enable Intel CET in host libraries [default=auto]
@@ -11634,7 +11636,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11637 "configure"
+#line 11639 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11740,7 +11742,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11743 "configure"
+#line 11745 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12518,12 +12520,18 @@ $as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h
fi
fi
+# Enable --enable-host-pie.
+# Check whether --enable-host-pie was given.
+if test "${enable_host_pie+set}" = set; then :
+ enableval=$enable_host_pie; PIC_FLAG=-fPIE
+else
+ PIC_FLAG=
+fi
+
# Enable --enable-host-shared.
# Check whether --enable-host-shared was given.
if test "${enable_host_shared+set}" = set; then :
enableval=$enable_host_shared; PIC_FLAG=-fPIC
-else
- PIC_FLAG=
fi
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 75b3a75..6549cde 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -175,11 +175,16 @@ else
fi
fi
+# Enable --enable-host-pie.
+AC_ARG_ENABLE(host-pie,
+[AS_HELP_STRING([--enable-host-pie],
+ [build host code as PIE])],
+[PIC_FLAG=-fPIE], [PIC_FLAG=])
# 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=])
+[PIC_FLAG=-fPIC])
AC_SUBST(PIC_FLAG)
# Enable Intel CET on Intel CET enabled host if jit is enabled.