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";