From 7b4f7dacbdc9d064ad0e0744109ac6e2bb087862 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Mon, 21 Dec 2020 21:28:05 +0100 Subject: [PATCH] fixup! cc-wrapper: disable dynamic linker for darwin --- pkgs/build-support/cc-wrapper/cc-wrapper.sh | 10 ++++++---- pkgs/stdenv/darwin/default.nix | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 2ff8bb9d2f0e3..42472f16f1291 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -30,10 +30,6 @@ cppInclude=1 cInclude=1 setDynamicLinker=1 -if [[ "@isdarwin@" = "1" ]]; then - setDynamicLinker=0 -fi - expandResponseParams "$@" declare -i n=0 nParams=${#params[@]} @@ -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@) diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix index f07b1ee73b87a..dd551fd3d4850 100644 --- a/pkgs/stdenv/darwin/default.nix +++ b/pkgs/stdenv/darwin/default.nix @@ -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}