mkDerivation, cc-wrapper: Check hardening flag validity in Nix
This becomes necessary if more wrappers besides cc-wrapper start supporting hardening flags. Also good to make the warning into an error. Also ensure interface is being used right: Not as a string, not just in bash.
This commit is contained in:
committed by
Robin Gloster
parent
822a8d0148
commit
97a48835b7
@@ -41,7 +41,20 @@ rec {
|
||||
, __propagatedImpureHostDeps ? []
|
||||
, sandboxProfile ? ""
|
||||
, propagatedSandboxProfile ? ""
|
||||
|
||||
, hardeningEnable ? []
|
||||
, hardeningDisable ? []
|
||||
, ... } @ attrs:
|
||||
|
||||
# TODO(@Ericson2314): Make this more modular, and not O(n^2).
|
||||
let allHardeningFlags = [
|
||||
"fortify" "stackprotector" "pie" "pic" "strictoverflow" "format" "relro"
|
||||
"bindnow"
|
||||
];
|
||||
in assert lib.all
|
||||
(flag: lib.elem flag allHardeningFlags)
|
||||
(hardeningEnable ++ hardeningDisable);
|
||||
|
||||
let
|
||||
dependencies = map lib.chooseDevOutputs [
|
||||
(map (drv: drv.nativeDrv or drv) nativeBuildInputs
|
||||
|
||||
Reference in New Issue
Block a user