cc-wrapper.sh: make -nostdlib disable the standard C++ library, but not its includes
Should be the correct fix for #111970
This commit is contained in:
parent
d9bad0eae6
commit
11b744b59c
@ -27,6 +27,7 @@ cc1=0
|
|||||||
# shellcheck disable=SC2193
|
# shellcheck disable=SC2193
|
||||||
[[ "@prog@" = *++ ]] && isCxx=1 || isCxx=0
|
[[ "@prog@" = *++ ]] && isCxx=1 || isCxx=0
|
||||||
cxxInclude=1
|
cxxInclude=1
|
||||||
|
cxxLibrary=1
|
||||||
cInclude=1
|
cInclude=1
|
||||||
setDynamicLinker=1
|
setDynamicLinker=1
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ while (( "$n" < "$nParams" )); do
|
|||||||
elif [[ "$p" = -x && "$p2" = c++* && "$isCxx" = 0 ]]; then
|
elif [[ "$p" = -x && "$p2" = c++* && "$isCxx" = 0 ]]; then
|
||||||
isCxx=1
|
isCxx=1
|
||||||
elif [ "$p" = -nostdlib ]; then
|
elif [ "$p" = -nostdlib ]; then
|
||||||
isCxx=-1
|
cxxLibrary=0
|
||||||
elif [ "$p" = -nostdinc ]; then
|
elif [ "$p" = -nostdinc ]; then
|
||||||
cInclude=0
|
cInclude=0
|
||||||
cxxInclude=0
|
cxxInclude=0
|
||||||
@ -135,8 +136,10 @@ if [[ "$isCxx" = 1 ]]; then
|
|||||||
if [[ "$cxxInclude" = 1 ]]; then
|
if [[ "$cxxInclude" = 1 ]]; then
|
||||||
NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
|
NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
|
||||||
fi
|
fi
|
||||||
|
if [[ "$cxxLibrary" = 1 ]]; then
|
||||||
NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
|
NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
source @out@/nix-support/add-hardening.sh
|
source @out@/nix-support/add-hardening.sh
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user