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.
This commit is contained in:
Thomas Tuegel 2021-02-04 16:48:08 -06:00 committed by Frederik Rietdijk
parent ad6e13fcfb
commit 54c7a0f422
1 changed files with 4 additions and 3 deletions

View File

@ -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.