cc-wrapper hardeningFlags tests: fix stdenvUnsupport-based tests

these were not updated to understand
hardeningUnsupportedFlagsByTargetPlatform when it was added
causing more tests to fail for clang than otherwise would
This commit is contained in:
Robert Scott 2024-07-13 23:47:23 +01:00
parent 38b580b21a
commit 2e0d7e230a

View File

@ -44,8 +44,19 @@ let
stdenvUnsupport = additionalUnsupported: stdenv.override {
cc = stdenv.cc.override {
cc = (lib.extendDerivation true {
hardeningUnsupportedFlags = (stdenv.cc.cc.hardeningUnsupportedFlags or []) ++ additionalUnsupported;
cc = (lib.extendDerivation true rec {
# this is ugly - have to cross-reference from
# hardeningUnsupportedFlagsByTargetPlatform to hardeningUnsupportedFlags
# because the finalAttrs mechanism that hardeningUnsupportedFlagsByTargetPlatform
# implementations use to do this won't work with lib.extendDerivation.
# but it's simplified by the fact that targetPlatform is already fixed
# at this point.
hardeningUnsupportedFlagsByTargetPlatform = _: hardeningUnsupportedFlags;
hardeningUnsupportedFlags = (
if stdenv.cc.cc ? hardeningUnsupportedFlagsByTargetPlatform
then stdenv.cc.cc.hardeningUnsupportedFlagsByTargetPlatform stdenv.targetPlatform
else (stdenv.cc.cc.hardeningUnsupportedFlags or [])
) ++ additionalUnsupported;
} stdenv.cc.cc);
};
allowedRequisites = null;
@ -258,7 +269,7 @@ in nameDrvAfterAttrName ({
# mechanism, so can only test a couple of flags through altered
# stdenv trickery
fortifyStdenvUnsupp = checkTestBin (f2exampleWithStdEnv (stdenvUnsupport ["fortify"]) {
fortifyStdenvUnsupp = checkTestBin (f2exampleWithStdEnv (stdenvUnsupport ["fortify" "fortify3"]) {
hardeningEnable = [ "fortify" ];
}) {
ignoreFortify = false;