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.
This commit is contained in:
Randy Eckenrode 2023-11-06 16:53:25 -05:00 committed by Adam Joseph
parent bec14225ab
commit 299c06a0f5

View File

@ -33,6 +33,7 @@
, nukeReferences , nukeReferences
, callPackage , callPackage
, majorMinorVersion , majorMinorVersion
, darwin
# only for gcc<=6.x # only for gcc<=6.x
, langJava ? false , langJava ? false
@ -412,6 +413,11 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
}; };
} // optionalAttrs is7 { } // optionalAttrs is7 {
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument"; 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) { } // optionalAttrs (!atLeast7) {
env.langJava = langJava; env.langJava = langJava;
} // optionalAttrs atLeast6 { } // optionalAttrs atLeast6 {