gcc: build with --enable-default-pie configure option (#439314)

This commit is contained in:
Emily
2025-09-13 18:21:26 +01:00
committed by GitHub
5 changed files with 16 additions and 3 deletions
@@ -20,6 +20,7 @@
enablePlugin,
disableGdbPlugin ? !enablePlugin,
enableShared,
enableDefaultPie,
targetPrefix,
langC,
@@ -279,6 +280,9 @@ let
"libat_cv_have_ifunc=no"
"--disable-gnu-indirect-function"
]
++ lib.optionals enableDefaultPie [
"--enable-default-pie"
]
++ lib.optionals langJit [
"--enable-host-shared"
]
@@ -19,6 +19,7 @@
cargo,
staticCompiler ? false,
enableShared ? stdenv.targetPlatform.hasSharedLibraries,
enableDefaultPie ? true,
enableLTO ? stdenv.hostPlatform.hasSharedLibraries,
texinfo ? null,
perl ? null, # optional, for texi2pod (then pod2man)
@@ -137,6 +138,7 @@ let
darwin
disableBootstrap
disableGdbPlugin
enableDefaultPie
enableLTO
enableMultilib
enablePlugin
@@ -193,6 +193,7 @@ stdenv.mkDerivation (finalAttrs: {
"--disable-multilib"
"--disable-nls"
"--disable-shared"
"--enable-default-pie"
"--enable-languages=${
lib.concatStrings (
lib.intersperse "," (
@@ -54,9 +54,10 @@ stdenv.mkDerivation (finalAttrs: {
# Drop in libiberty, as external builds are not expected
cd "$buildRoot"
(
mkdir -p build-${stdenv.buildPlatform.config}/libiberty/
cd build-${stdenv.buildPlatform.config}/libiberty/
ln -s ${buildPackages.libiberty}/lib/libiberty.a ./
mkdir -p "build-${stdenv.buildPlatform.config}/libiberty/pic"
cd "build-${stdenv.buildPlatform.config}/libiberty/"
ln -s "${buildPackages.libiberty}/lib/libiberty.a" ./
ln -s "${buildPackages.libiberty}/lib/libiberty_pic.a" pic/libiberty.a
)
mkdir -p "$buildRoot/gcc"
cd "$buildRoot/gcc"
+5
View File
@@ -430,6 +430,11 @@ assert bootstrapTools.passthru.isFromBootstrapFiles or false; # sanity check
# ...-binutils-patchelfed-ld-2.40/bin/ld: ...-xgcc-13.0.0/libexec/gcc/x86_64-unknown-linux-gnu/13.0.1/liblto_plugin.so:
# error loading plugin: ...-bootstrap-tools/lib/libpthread.so.0: undefined symbol: __libc_vfork, version GLIBC_PRIVATE
enableLTO = false;
# relocatable libs may not be available in the bootstrap
# which will cause compilation to fail with
# configure: error: C compiler cannot create executables
enableDefaultPie = false;
}
)).overrideAttrs
(a: {