Merge branch 'hardened-stdenv' into staging

Closes #12895

Amazing work by @globin & @fpletz getting hardened compiler flags by
enabled default on the whole package set
This commit is contained in:
obadz
2016-08-22 01:19:35 +01:00
468 changed files with 1777 additions and 1453 deletions
+3 -8
View File
@@ -49,14 +49,9 @@ stdenv.mkDerivation {
NIX_CFLAGS_COMPILE = [ "-I${libxml2.dev}/include/libxml2" ] ++ optional stdenv.isDarwin "-Wno-error=deprecated-declarations";
preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules)
+ optionalString (hardening && (stdenv.cc.cc.isGNU or false)) ''
configureFlagsArray=(
--with-cc-opt="-fPIE -fstack-protector-all --param ssp-buffer-size=4 -O2 -D_FORTIFY_SOURCE=2"
--with-ld-opt="-pie -Wl,-z,relro,-z,now"
)
''
;
preConfigure = (concatMapStringsSep "\n" (mod: mod.preConfigure or "") modules);
hardeningEnable = [ "pie" ];
postInstall = ''
mv $out/sbin $out/bin