From 2e2afa1943a69cef6abb96a8552ddafd06f9bbd4 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Thu, 8 Nov 2018 15:34:40 -0600 Subject: [PATCH] gcc/binutils: disable pie hardening MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These don’t like having -fPIE set for them. We should disable hardening all the time, but in the interest of not changing hashes, this only disables it for Musl (where it is now the default). (cherry picked from commit a3a6884649354a660326acd68c1bd08ffd2dcfa2) --- pkgs/development/compilers/gcc/4.8/default.nix | 2 +- pkgs/development/compilers/gcc/4.9/default.nix | 2 +- pkgs/development/compilers/gcc/5/default.nix | 2 +- pkgs/development/compilers/gcc/6/default.nix | 2 +- pkgs/development/compilers/gcc/7/default.nix | 2 +- pkgs/development/compilers/gcc/8/default.nix | 2 +- pkgs/development/tools/misc/binutils/default.nix | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix index e585f296e87..e40994a078e 100644 --- a/pkgs/development/compilers/gcc/4.8/default.nix +++ b/pkgs/development/compilers/gcc/4.8/default.nix @@ -180,7 +180,7 @@ stdenv.mkDerivation ({ inherit patches; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; outputs = [ "out" "lib" "man" "info" ]; setOutputFlags = false; diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix index 9dae061ecbb..bd5257b94a0 100644 --- a/pkgs/development/compilers/gcc/4.9/default.nix +++ b/pkgs/development/compilers/gcc/4.9/default.nix @@ -188,7 +188,7 @@ stdenv.mkDerivation ({ inherit patches; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; outputs = if langJava || langGo then ["out" "man" "info"] else [ "out" "lib" "man" "info" ]; diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix index fbc192752c7..85b3d96e136 100644 --- a/pkgs/development/compilers/gcc/5/default.nix +++ b/pkgs/development/compilers/gcc/5/default.nix @@ -181,7 +181,7 @@ stdenv.mkDerivation ({ libc_dev = stdenv.cc.libc_dev; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; # This should kill all the stdinc frameworks that gcc and friends like to # insert into default search paths. diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 793752dee19..98e24900b01 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -182,7 +182,7 @@ stdenv.mkDerivation ({ libc_dev = stdenv.cc.libc_dev; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; # This should kill all the stdinc frameworks that gcc and friends like to # insert into default search paths. diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index c75a6c6e68f..064d9eb6bc7 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -151,7 +151,7 @@ stdenv.mkDerivation ({ libc_dev = stdenv.cc.libc_dev; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; # This should kill all the stdinc frameworks that gcc and friends like to # insert into default search paths. diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index bcac577712a..c6fea70cfbb 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -145,7 +145,7 @@ stdenv.mkDerivation ({ libc_dev = stdenv.cc.libc_dev; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; # This should kill all the stdinc frameworks that gcc and friends like to # insert into default search paths. diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix index 3205366f80e..54f9b5e4031 100644 --- a/pkgs/development/tools/misc/binutils/default.nix +++ b/pkgs/development/tools/misc/binutils/default.nix @@ -97,7 +97,7 @@ stdenv.mkDerivation rec { then "-Wno-string-plus-int -Wno-deprecated-declarations" else "-static-libgcc"; - hardeningDisable = [ "format" ]; + hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; # TODO(@Ericson2314): Always pass "--target" and always targetPrefix. configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target";