diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2020-12-14 07:59:40 +0100 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2020-12-14 15:42:54 +0000 |
commit | ccfd26ef14ea213320f0b49db3fb347785b38f06 (patch) | |
tree | 94e91db070206c2efa5867f02b3a5f66ee6564ed /pkgs/build-support/bintools-wrapper/add-flags.sh | |
parent | c2842e5ad427876e2f023ef41ea3500dce630e04 (diff) |
bintools-wrapper: skip dynamic linker for static binaries
Currently we set dynamic-linker unconditionally. This breaks however some static binaries i.e. rust binaries linked against musl. There is no reason we should set an elf interpreter for static binaries hence this is skipped if `-static` or `-static-pie` is either passed to our cc or ld wrapper.
Diffstat (limited to 'pkgs/build-support/bintools-wrapper/add-flags.sh')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/add-flags.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/build-support/bintools-wrapper/add-flags.sh b/pkgs/build-support/bintools-wrapper/add-flags.sh index e99beb381586e..83d47027104c2 100644 --- a/pkgs/build-support/bintools-wrapper/add-flags.sh +++ b/pkgs/build-support/bintools-wrapper/add-flags.sh @@ -3,6 +3,7 @@ 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 @@ -25,6 +26,10 @@ 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 |