summary refs log tree commit diff
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2023-11-06 16:53:25 -0500
committerAdam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com>2023-11-08 10:50:07 +0000
commit299c06a0f55e02d41d26035fb0d649ae972bdc37 (patch)
tree5aaba5d1b5accaeb453ab60c5f5dac72dd53a204
parentbec14225ab79b37be29ff15cf33e135158873f0a (diff)
downloadnixpkgs-299c06a0f55e02d41d26035fb0d649ae972bdc37.tar
nixpkgs-299c06a0f55e02d41d26035fb0d649ae972bdc37.tar.gz
nixpkgs-299c06a0f55e02d41d26035fb0d649ae972bdc37.tar.bz2
nixpkgs-299c06a0f55e02d41d26035fb0d649ae972bdc37.tar.lz
nixpkgs-299c06a0f55e02d41d26035fb0d649ae972bdc37.tar.xz
nixpkgs-299c06a0f55e02d41d26035fb0d649ae972bdc37.tar.zst
nixpkgs-299c06a0f55e02d41d26035fb0d649ae972bdc37.zip
gcc{48,49,6,7,8,9,10}: improve cctools-llvm compatibility
darwin.cctools defaults to `llvm-strip` when the version of LLVM in the
stdenv is 12 or newer. This strip implementation does not support the
`-c` flag required by older versions of GCC. Use the cctools-port
version for compatibility when building older versions of GCC.
-rw-r--r--pkgs/development/compilers/gcc/default.nix6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix
index 895aed5461c..0fe23000cc9 100644
--- a/pkgs/development/compilers/gcc/default.nix
+++ b/pkgs/development/compilers/gcc/default.nix
@@ -33,6 +33,7 @@
 , nukeReferences
 , callPackage
 , majorMinorVersion
+, darwin
 
 # only for gcc<=6.x
 , langJava ? false
@@ -412,6 +413,11 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
   };
 } // optionalAttrs is7 {
   env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
+} // lib.optionalAttrs (!atLeast10 && stdenv.hostPlatform.isDarwin) {
+  # GCC <10 requires default cctools `strip` instead of `llvm-strip` used by Darwin bintools.
+  preBuild = ''
+    makeFlagsArray+=('STRIP=${lib.getBin darwin.cctools-port}/bin/${stdenv.cc.targetPrefix}strip')
+  '';
 } // optionalAttrs (!atLeast7) {
   env.langJava = langJava;
 } // optionalAttrs atLeast6 {