about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2021-05-02 14:07:00 -0400
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2021-05-02 14:07:00 -0400
commit11b744b59c09192c87b0c3f21b32036d7cf0bbf2 (patch)
treea4a7a05c18720c968869e1ac40d843c1d966c26c /pkgs/build-support
parentd9bad0eae60c9226e4b405943cd67ec72d44b4d1 (diff)
cc-wrapper.sh: make -nostdlib disable the standard C++ library, but not its includes
Should be the correct fix for #111970
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/cc-wrapper/cc-wrapper.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
index 5729fdc75e016..2e62aef46048a 100644
--- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh
+++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
@@ -27,6 +27,7 @@ cc1=0
 # shellcheck disable=SC2193
 [[ "@prog@" = *++ ]] && isCxx=1 || isCxx=0
 cxxInclude=1
+cxxLibrary=1
 cInclude=1
 setDynamicLinker=1
 
@@ -53,7 +54,7 @@ while (( "$n" < "$nParams" )); do
     elif [[ "$p" = -x && "$p2" = c++* && "$isCxx" = 0 ]]; then
         isCxx=1
     elif [ "$p" = -nostdlib ]; then
-        isCxx=-1
+        cxxLibrary=0
     elif [ "$p" = -nostdinc ]; then
         cInclude=0
         cxxInclude=0
@@ -135,7 +136,9 @@ if [[ "$isCxx" = 1 ]]; then
     if [[ "$cxxInclude" = 1 ]]; then
         NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
     fi
-    NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
+    if [[ "$cxxLibrary" = 1 ]]; then
+        NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
+    fi
 fi
 
 source @out@/nix-support/add-hardening.sh