Merge pull request #121527 from veprbl/pr/nocxx_for_c
cc-wrapper: fix regression for the C compiler wrapper
This commit is contained in:
commit
7b413bfff9
|
@ -25,8 +25,9 @@ dontLink=0
|
||||||
nonFlagArgs=0
|
nonFlagArgs=0
|
||||||
cc1=0
|
cc1=0
|
||||||
# shellcheck disable=SC2193
|
# shellcheck disable=SC2193
|
||||||
[[ "@prog@" = *++ ]] && isCpp=1 || isCpp=0
|
[[ "@prog@" = *++ ]] && isCxx=1 || isCxx=0
|
||||||
cppInclude=1
|
cxxInclude=1
|
||||||
|
cxxLibrary=1
|
||||||
cInclude=1
|
cInclude=1
|
||||||
setDynamicLinker=1
|
setDynamicLinker=1
|
||||||
|
|
||||||
|
@ -50,15 +51,15 @@ while (( "$n" < "$nParams" )); do
|
||||||
dontLink=1
|
dontLink=1
|
||||||
elif [[ "$p" = -x && "$p2" = *-header ]]; then
|
elif [[ "$p" = -x && "$p2" = *-header ]]; then
|
||||||
dontLink=1
|
dontLink=1
|
||||||
elif [[ "$p" = -x && "$p2" = c++* && "$isCpp" = 0 ]]; then
|
elif [[ "$p" = -x && "$p2" = c++* && "$isCxx" = 0 ]]; then
|
||||||
isCpp=1
|
isCxx=1
|
||||||
elif [ "$p" = -nostdlib ]; then
|
elif [ "$p" = -nostdlib ]; then
|
||||||
isCpp=-1
|
cxxLibrary=0
|
||||||
elif [ "$p" = -nostdinc ]; then
|
elif [ "$p" = -nostdinc ]; then
|
||||||
cInclude=0
|
cInclude=0
|
||||||
cppInclude=0
|
cxxInclude=0
|
||||||
elif [ "$p" = -nostdinc++ ]; then
|
elif [ "$p" = -nostdinc++ ]; then
|
||||||
cppInclude=0
|
cxxInclude=0
|
||||||
elif [[ "$p" = -static || "$p" = -static-pie ]]; then
|
elif [[ "$p" = -static || "$p" = -static-pie ]]; then
|
||||||
setDynamicLinker=0
|
setDynamicLinker=0
|
||||||
elif [[ "$p" != -?* ]]; then
|
elif [[ "$p" != -?* ]]; then
|
||||||
|
@ -131,12 +132,13 @@ if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then
|
||||||
params=(${rest+"${rest[@]}"})
|
params=(${rest+"${rest[@]}"})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$isCpp" = 1 ]]; then
|
if [[ "$isCxx" = 1 ]]; then
|
||||||
NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
|
if [[ "$cxxInclude" = 1 ]]; then
|
||||||
fi
|
NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@suffixSalt@"
|
||||||
|
fi
|
||||||
if [[ "$cppInclude" = 1 ]]; then
|
if [[ "$cxxLibrary" = 1 ]]; then
|
||||||
NIX_CFLAGS_COMPILE_@suffixSalt@+=" $NIX_CXXSTDLIB_COMPILE_@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…
Reference in New Issue