about summary refs log tree commit diff
path: root/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
diff options
context:
space:
mode:
authorRouven Czerwinski <rouven@czerwinskis.de>2020-12-20 12:55:44 +0100
committerRouven Czerwinski <rouven@czerwinskis.de>2020-12-20 17:27:16 +0100
commiteee562ffb5a570ab7eea88f4620d442e248c96be (patch)
tree301ae24a946e0dd97cae32d4db56bca18815ca44 /pkgs/build-support/bintools-wrapper/ld-wrapper.sh
parentbb9b5c5b753e187177e687baded6a6a87a21fb1d (diff)
bintools-wrapper: fix inverted link32 check
The new skip for the dynamic linker introduced in
ccfd26ef14ea ("bintools-wrapper: skip dynamic linker for static
binaries") includes a change in behaviour, previously the $link32
variable was checked using an arithmetic expression via (( )). This
returns zero if the output of the arithmetic expression is nonzero, i.e.
link32=1 would return zero and the if condition would be executed.
The code refactored this to use "$link32" = "0" which is incorrect in
this case, since we want this if conditional to run if $link32 is 1.

Small shell excerpt for clarity:

$ export link32=1
$ export cookie=1
$ if [[ "$cookie" = "1" ]] && (( "$link32" )); then echo "do some stuff"; fi;
do some stuff
$ if [[ "$cookie" = "1" && "$link32" = "0" ]]; then echo "do some stuff"; fi;
$

Change it to check for $link32 = "1", as the previous code did.
Diffstat (limited to 'pkgs/build-support/bintools-wrapper/ld-wrapper.sh')
-rw-r--r--pkgs/build-support/bintools-wrapper/ld-wrapper.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
index abecf6a8e5d1e..bdffdc3b7855c 100644
--- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
+++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
@@ -145,7 +145,7 @@ then
     done
 fi
 
-if [[ "$link32" = "0" && "$setDynamicLinker" = 1 && -e "@out@/nix-support/dynamic-linker-m32" ]]; 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+=(