|
|
|
@ -20,6 +20,7 @@ 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 "$@" |
|
|
|
@ -47,6 +48,11 @@ 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 |
|
|
|
@ -63,6 +69,11 @@ 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 && -n "$NIX_DYNAMIC_LINKER_@suffixSalt@" ]]; then |
|
|
|
|
extraBefore+=("-dynamic-linker" "$NIX_DYNAMIC_LINKER_@suffixSalt@") |
|
|
|
|
fi |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
extraAfter+=($NIX_LDFLAGS_AFTER_@suffixSalt@) |
|
|
|
@ -134,7 +145,7 @@ then |
|
|
|
|
done |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
if [ -e "@out@/nix-support/dynamic-linker-m32" ] && (( "$link32" )); then |
|
|
|
|
if [[ "$link32" = "1" && "$setDynamicLinker" = 1 && -e "@out@/nix-support/dynamic-linker-m32" ]]; then |
|
|
|
|
# We have an alternate 32-bit linker and we're producing a 32-bit ELF, let's |
|
|
|
|
# use it. |
|
|
|
|
extraAfter+=( |
|
|
|
|