Revert "bintools-wrapper: skip dynamic linker for static binaries"
This reverts commit ccfd26ef14.
These toolchain changes are too problematic, so reverting for now; see
https://github.com/NixOS/nixpkgs/pull/107086#issuecomment-749196366
This commit is contained in:
@@ -3,7 +3,6 @@ var_templates_list=(
|
||||
NIX_IGNORE_LD_THROUGH_GCC
|
||||
NIX_LDFLAGS
|
||||
NIX_LDFLAGS_BEFORE
|
||||
NIX_DYNAMIC_LINKER
|
||||
NIX_LDFLAGS_AFTER
|
||||
NIX_LDFLAGS_HARDEN
|
||||
NIX_HARDENING_ENABLE
|
||||
@@ -26,10 +25,6 @@ if [ -e @out@/nix-support/libc-ldflags ]; then
|
||||
NIX_LDFLAGS_@suffixSalt@+=" $(< @out@/nix-support/libc-ldflags)"
|
||||
fi
|
||||
|
||||
if [ -z "$NIX_DYNAMIC_LINKER_@suffixSalt@" ] && [ -e @out@/nix-support/dynamic-linker ]; then
|
||||
NIX_DYNAMIC_LINKER_@suffixSalt@="$(< @out@/nix-support/dynamic-linker)"
|
||||
fi
|
||||
|
||||
if [ -e @out@/nix-support/libc-ldflags-before ]; then
|
||||
NIX_LDFLAGS_BEFORE_@suffixSalt@="$(< @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE_@suffixSalt@"
|
||||
fi
|
||||
|
||||
@@ -243,7 +243,13 @@ stdenv.mkDerivation {
|
||||
if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then
|
||||
echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32
|
||||
fi
|
||||
'') + ''
|
||||
''
|
||||
# The dynamic linker is passed in `ldflagsBefore' to allow
|
||||
# explicit overrides of the dynamic linker by callers to ld
|
||||
# (the *last* value counts, so ours should come first).
|
||||
+ ''
|
||||
echo -dynamic-linker "$dynamicLinker" >> $out/nix-support/libc-ldflags-before
|
||||
'') + ''
|
||||
fi
|
||||
'')
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ if [ -z "${NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
|
||||
source @out@/nix-support/add-flags.sh
|
||||
fi
|
||||
|
||||
setDynamicLinker=1
|
||||
|
||||
# Optionally filter out paths not refering to the store.
|
||||
expandResponseParams "$@"
|
||||
@@ -48,11 +47,6 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}"
|
||||
# Our ld is not built with sysroot support (Can we fix that?)
|
||||
:
|
||||
else
|
||||
if [[ "$p" = -static || "$p" = -static-pie ]]; then
|
||||
# Using a dynamic linker for static binaries can lead to crashes.
|
||||
# This was observed for rust binaries.
|
||||
setDynamicLinker=0
|
||||
fi
|
||||
rest+=("$p")
|
||||
fi
|
||||
n+=1
|
||||
@@ -69,11 +63,6 @@ extraBefore=(${hardeningLDFlags[@]+"${hardeningLDFlags[@]}"})
|
||||
if [ -z "${NIX_LDFLAGS_SET_@suffixSalt@:-}" ]; then
|
||||
extraAfter+=($NIX_LDFLAGS_@suffixSalt@)
|
||||
extraBefore+=($NIX_LDFLAGS_BEFORE_@suffixSalt@)
|
||||
# By adding dynamic linker to extraBefore we allow the users set their
|
||||
# own dynamic linker as NIX_LD_FLAGS will override earlier set flags
|
||||
if [ "$setDynamicLinker" = 1 ]; then
|
||||
extraBefore+=("-dynamic-linker" "$NIX_DYNAMIC_LINKER_@suffixSalt@")
|
||||
fi
|
||||
fi
|
||||
|
||||
extraAfter+=($NIX_LDFLAGS_AFTER_@suffixSalt@)
|
||||
@@ -145,7 +134,7 @@ then
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ "$link32" = "0" && "$setDynamicLinker" = 1 && -e "@out@/nix-support/dynamic-linker-m32" ]]; then
|
||||
if [ -e "@out@/nix-support/dynamic-linker-m32" ] && (( "$link32" )); then
|
||||
# We have an alternate 32-bit linker and we're producing a 32-bit ELF, let's
|
||||
# use it.
|
||||
extraAfter+=(
|
||||
|
||||
Reference in New Issue
Block a user