summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@mailbox.org>2021-02-04 16:48:08 -0600
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2021-03-20 09:26:04 +0100
commit54c7a0f42287f63c2db8086a8ad46ac981364378 (patch)
treeb14d5af1aa0d9778fb5b76218f520156cb8907b3 /pkgs/build-support/cc-wrapper
parentad6e13fcfb4db7da4999d951109a8baef4ccb62e (diff)
downloadnixpkgs-54c7a0f42287f63c2db8086a8ad46ac981364378.tar
nixpkgs-54c7a0f42287f63c2db8086a8ad46ac981364378.tar.gz
nixpkgs-54c7a0f42287f63c2db8086a8ad46ac981364378.tar.bz2
nixpkgs-54c7a0f42287f63c2db8086a8ad46ac981364378.tar.lz
nixpkgs-54c7a0f42287f63c2db8086a8ad46ac981364378.tar.xz
nixpkgs-54c7a0f42287f63c2db8086a8ad46ac981364378.tar.zst
nixpkgs-54c7a0f42287f63c2db8086a8ad46ac981364378.zip
cc-wrapper: -nostdlib does not imply -nostdinc++
The check for including the C++ standard library headers was nested inside the
check for linking with the C++ standard library. As a result, the `-nostdlib`
flag incorrectly implied `-nostdinc++`, which made it virtually impossible to
partially link C++ objects.
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r--pkgs/build-support/cc-wrapper/cc-wrapper.sh7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
index d08fd24cd2d..b402893100b 100644
--- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh
+++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
@@ -132,12 +132,13 @@ if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then
 fi
 
 if [[ "$isCpp" = 1 ]]; then
-    if [[ "$cppInclude" = 1 ]]; then
-        NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
-    fi
     NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
 fi
 
+if [[ "$cppInclude" = 1 ]]; then
+    NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
+fi
+
 source @out@/nix-support/add-hardening.sh
 
 # Add the flags for the C compiler proper.