Merge pull request #29483 from veprbl/hardening_unsupported_flags

cc-wrapper: allow compilers to specify unsupported hardening modes
This commit is contained in:
John Ericson 2017-12-30 23:25:43 -05:00 committed by GitHub
commit 64965e8224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 12 deletions

View file

@ -292,7 +292,7 @@ stdenv.mkDerivation {
## Hardening support
##
export hardening_unsupported_flags=""
export hardening_unsupported_flags="${builtins.concatStringsSep " " (cc.hardeningUnsupportedFlags or [])}"
''
+ optionalString hostPlatform.isCygwin ''

View file

@ -422,8 +422,11 @@ stdenv.mkDerivation ({
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
]);
passthru = { inherit langC langCC langAda langFortran langVhdl
enableMultilib version; isGNU = true; };
passthru = {
inherit langC langCC langAda langFortran langVhdl enableMultilib version;
isGNU = true;
hardeningUnsupportedFlags = [ "stackprotector" ];
};
enableParallelBuilding = !langAda;

View file

@ -507,8 +507,11 @@ stdenv.mkDerivation ({
"-Wl,${libpthreadCross.TARGET_LDFLAGS}"
]);
passthru =
{ inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version; isGNU = true; };
passthru = {
inherit langC langCC langObjC langObjCpp langAda langFortran langVhdl langGo version;
isGNU = true;
hardeningUnsupportedFlags = [ "stackprotector" ];
};
inherit enableParallelBuilding enableMultilib;

View file

@ -39,6 +39,7 @@ stdenv.mkDerivation {
# GCC_INSTALL_PREFIX points here, so just use it even though it may not
# actually be a gcc
gcc = stdenv.cc.cc;
hardeningUnsupportedFlags = [ "stackprotector" ];
};
enableParallelBuilding = true;

View file

@ -5543,13 +5543,7 @@ with pkgs;
clang_38 = llvmPackages_38.clang;
clang_37 = llvmPackages_37.clang;
clang_35 = wrapCC llvmPackages_35.clang;
clang_34 = (wrapCC llvmPackages_34.clang).override {
# Default cc-wrapper's hardening flags don't work with clang-3.4,
# so just remove it entirely for this wrapper.
extraBuildCommands = ''
:> $out/nix-support/add-hardening.sh
'';
};
clang_34 = wrapCC llvmPackages_34.clang;
clang-tools = callPackage ../development/tools/clang-tools { };