diff options
author | Ryan Lahfa <masterancpp@gmail.com> | 2023-05-01 16:28:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 16:28:49 +0200 |
commit | 00997c5dd67e0edc3723e1bc8850cb0364b5de70 (patch) | |
tree | af5553ddaf433df473c801fc96b064a68c7e05e4 /pkgs/build-support | |
parent | f17401b13f4877dd80b2807e0755ebf0526aee3a (diff) | |
parent | 194ddeefd5339f2a570a878e4f2b15f9585da06f (diff) |
Merge pull request #228820 from alyssais/link.exe-purity
wrapBintoolsWith: support LINK.EXE-style args in purity checks
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/bintools-wrapper/ld-wrapper.sh | 10 | ||||
-rw-r--r-- | pkgs/build-support/wrapper-common/utils.bash | 7 |
2 files changed, 12 insertions, 5 deletions
diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh index 0d832bc4a67a0..dcbe8a4c24948 100644 --- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh +++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh @@ -55,10 +55,12 @@ if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}" # produces '-syslibroot //' linker flag. It's a no-op, # which does not introduce impurities. n+=1; skip "$p2" - elif [ "${p:0:1}" = / ] && badPath "$p"; then - # We cannot skip this; barf. - echo "impure path \`$p' used in link" >&2 - exit 1 + elif [ "${p:0:10}" = /LIBPATH:/ ] && badPath "${p:9}"; then + reject "${p:9}" + # We need to not match LINK.EXE-style flags like + # /NOLOGO or /LIBPATH:/nix/store/foo + elif [[ $p =~ ^/[^:]*/ ]] && badPath "$p"; then + reject "$p" elif [ "${p:0:9}" = --sysroot ]; then # Our ld is not built with sysroot support (Can we fix that?) : diff --git a/pkgs/build-support/wrapper-common/utils.bash b/pkgs/build-support/wrapper-common/utils.bash index 44b44818c8ed9..2faf96df15b40 100644 --- a/pkgs/build-support/wrapper-common/utils.bash +++ b/pkgs/build-support/wrapper-common/utils.bash @@ -84,12 +84,17 @@ mangleVarSingle() { done } -skip () { +skip() { if (( "${NIX_DEBUG:-0}" >= 1 )); then echo "skipping impure path $1" >&2 fi } +reject() { + echo "impure path \`$1' used in link" >&2 + exit 1 +} + # Checks whether a path is impure. E.g., `/lib/foo.so' is impure, but # `/nix/store/.../lib/foo.so' isn't. |