Skip to content

Commit

Permalink
fixup! cc-wrapper: disable dynamic linker for darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
Emantor committed Dec 21, 2020
1 parent 708cb80 commit 7b4f7da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkgs/build-support/cc-wrapper/cc-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ cppInclude=1
cInclude=1
setDynamicLinker=1

if [[ "@isdarwin@" = "1" ]]; then
setDynamicLinker=0
fi

expandResponseParams "$@"
declare -i n=0
nParams=${#params[@]}
Expand Down Expand Up @@ -150,6 +146,12 @@ extraBefore=(${hardeningCFlags[@]+"${hardeningCFlags[@]}"} $NIX_CFLAGS_COMPILE_B

if [ "$dontLink" != 1 ]; then

# Disable the -dynamic-linker flag if NIX_DYNAMIC_LINKER is the special darwin
# value. -dynamic-linker is not supported on darwin systems.
if [[ "$NIX_DYNAMIC_LINKER_@suffixSalt@" = "darwin" ]]; then
setDynamicLinker=0
fi

# Add the flags that should only be passed to the compiler when
# linking.
extraAfter+=($NIX_CFLAGS_LINK_@suffixSalt@)
Expand Down
1 change: 1 addition & 0 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ in rec {
export NIX_ENFORCE_NO_NATIVE=''${NIX_ENFORCE_NO_NATIVE-1}
export NIX_ENFORCE_PURITY=''${NIX_ENFORCE_PURITY-1}
export NIX_IGNORE_LD_THROUGH_GCC=1
export NIX_DYNAMIC_LINKER="darwin"
unset SDKROOT
export MACOSX_DEPLOYMENT_TARGET=${macosVersionMin}
Expand Down

0 comments on commit 7b4f7da

Please sign in to comment.