stdenv.mkDerivation: only create enabledHardeningOptions variable if necessary
This commit is contained in:
@@ -413,20 +413,6 @@ let
|
||||
actualValue;
|
||||
outputs' = if separateDebugInfo' then outputs ++ [ "debug" ] else outputs;
|
||||
|
||||
enabledHardeningOptions =
|
||||
if elem "all" hardeningDisable then
|
||||
[ ]
|
||||
else
|
||||
subtractLists (unique (
|
||||
pipe hardeningDisable [
|
||||
# disabling fortify implies fortify3 should also be disabled
|
||||
(concretizeFlagImplications "fortify" [ "fortify3" ])
|
||||
# disabling strictflexarrays1 implies strictflexarrays3 should also be disabled
|
||||
(concretizeFlagImplications "strictflexarrays1" [ "strictflexarrays3" ])
|
||||
# disabling libcxxhardeningfast implies libcxxhardeningextensive should also be disabled
|
||||
(concretizeFlagImplications "libcxxhardeningfast" [ "libcxxhardeningextensive" ])
|
||||
]
|
||||
)) (defaultHardeningFlags ++ hardeningEnable);
|
||||
# hardeningDisable additionally supports "all".
|
||||
erroneousHardeningFlags = subtractLists knownHardeningFlags (
|
||||
hardeningEnable ++ remove "all" hardeningDisable
|
||||
@@ -694,6 +680,22 @@ let
|
||||
else
|
||||
null
|
||||
} =
|
||||
let
|
||||
enabledHardeningOptions =
|
||||
if elem "all" hardeningDisable then
|
||||
[ ]
|
||||
else
|
||||
subtractLists (unique (
|
||||
pipe hardeningDisable [
|
||||
# disabling fortify implies fortify3 should also be disabled
|
||||
(concretizeFlagImplications "fortify" [ "fortify3" ])
|
||||
# disabling strictflexarrays1 implies strictflexarrays3 should also be disabled
|
||||
(concretizeFlagImplications "strictflexarrays1" [ "strictflexarrays3" ])
|
||||
# disabling libcxxhardeningfast implies libcxxhardeningextensive should also be disabled
|
||||
(concretizeFlagImplications "libcxxhardeningfast" [ "libcxxhardeningextensive" ])
|
||||
]
|
||||
)) (defaultHardeningFlags ++ hardeningEnable);
|
||||
in
|
||||
concatStringsSep " " enabledHardeningOptions;
|
||||
|
||||
# TODO: remove platform condition
|
||||
|
||||
Reference in New Issue
Block a user