stdenv: fix evaluation if !stdenv.cc.hasCC

stdenv.cc may throw, e.g. in the case of pkgsCross.ghcjs where we must
not force it for the purpose of attribute accessing (`or` doesn't
implicitly tryEval…).

Regression introduced in 1a5bd697ad.
This commit is contained in:
sternenseemann 2024-01-12 17:46:19 +01:00
parent 3d673c9b54
commit f734056102

View File

@ -250,9 +250,10 @@ let
"stackprotector"
"strictoverflow"
];
defaultHardeningFlags = stdenv.cc.defaultHardeningFlags or
# fallback safe-ish set of flags
(remove "pie" knownHardeningFlags);
defaultHardeningFlags =
(if stdenv.hasCC then stdenv.cc else {}).defaultHardeningFlags or
# fallback safe-ish set of flags
(remove "pie" knownHardeningFlags);
enabledHardeningOptions =
if builtins.elem "all" hardeningDisable'
then []