1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00

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 { stdenvUnsupport = additionalUnsupported: stdenv.override {
cc = stdenv.cc.override { cc = stdenv.cc.override {
cc = (lib.extendDerivation true { cc = (lib.extendDerivation true rec {
hardeningUnsupportedFlags = (stdenv.cc.cc.hardeningUnsupportedFlags or []) ++ additionalUnsupported; # 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); } stdenv.cc.cc);
}; };
allowedRequisites = null; allowedRequisites = null;
@ -258,7 +269,7 @@ in nameDrvAfterAttrName ({
# mechanism, so can only test a couple of flags through altered # mechanism, so can only test a couple of flags through altered
# stdenv trickery # stdenv trickery
fortifyStdenvUnsupp = checkTestBin (f2exampleWithStdEnv (stdenvUnsupport ["fortify"]) { fortifyStdenvUnsupp = checkTestBin (f2exampleWithStdEnv (stdenvUnsupport ["fortify" "fortify3"]) {
hardeningEnable = [ "fortify" ]; hardeningEnable = [ "fortify" ];
}) { }) {
ignoreFortify = false; ignoreFortify = false;