3
0
Fork 0
forked from mirrors/nixpkgs

Merge #115235: gcc: native aarch64-darwin support

This commit is contained in:
Vladimír Čunát 2021-05-11 12:12:04 +02:00
commit 8eabe2ecc5
No known key found for this signature in database
GPG key ID: E747DF1F9575A3AA
4 changed files with 18 additions and 6 deletions

View file

@ -432,14 +432,16 @@ stdenv.mkDerivation {
# Always add -march based on cpu in triple. Sometimes there is a
# discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in
# that case.
+ optionalString ((targetPlatform ? gcc.arch) &&
# TODO: aarch64-darwin has mcpu incompatible with gcc
+ optionalString ((targetPlatform ? gcc.arch) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64)) &&
isGccArchSupported targetPlatform.gcc.arch) ''
echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before
''
# -mcpu is not very useful. You should use mtune and march
# instead. Its provided here for backwards compatibility.
+ optionalString (targetPlatform ? gcc.cpu) ''
# TODO: aarch64-darwin has mcpu incompatible with gcc
+ optionalString ((targetPlatform ? gcc.cpu) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64))) ''
echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before
''

View file

@ -72,6 +72,11 @@ let majorVersion = "11";
++ optional langFortran ../gfortran-driving.patch
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
++ optional (stdenv.isDarwin && stdenv.isAarch64) (fetchpatch {
url = "https://github.com/fxcoudert/gcc/compare/releases/gcc-11.1.0...gcc-11.1.0-arm-20210504.diff";
sha256 = "sha256-JqCGJAfbOxSmkNyq49aFHteK/RFsCSLQrL9mzUCnaD0=";
})
# Obtain latest patch with ../update-mcfgthread-patches.sh
++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch;

View file

@ -185,7 +185,8 @@ let
++ lib.optional javaAwtGtk "--enable-java-awt=gtk"
++ lib.optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}"
++ (import ../common/platform-flags.nix { inherit (stdenv) targetPlatform; inherit lib; })
# TODO: aarch64-darwin has clang stdenv and its arch and cpu flag values are incompatible with gcc
++ lib.optional (!(stdenv.isDarwin && stdenv.isAarch64)) (import ../common/platform-flags.nix { inherit (stdenv) targetPlatform; inherit lib; })
++ lib.optionals (targetPlatform != hostPlatform) crossConfigureFlags
++ lib.optional (targetPlatform != hostPlatform) "--disable-bootstrap"

View file

@ -10344,7 +10344,9 @@ in
else ../development/compilers/gcc/10);
gcc = if (with stdenv.targetPlatform; isVc4 || libc == "relibc")
then gcc6 else
if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10;
# aarch64-darwin doesn't support earlier gcc
if (stdenv.targetPlatform.isAarch64 && stdenv.isDarwin) then gcc11
else if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10;
gcc-unwrapped = gcc.cc;
wrapNonDeterministicGcc = stdenv: ccWrapper:
@ -10572,7 +10574,8 @@ in
gcc_latest = gcc11;
gfortran = gfortran9;
# aarch64-darwin doesn't support earlier gcc
gfortran = if (stdenv.isDarwin && stdenv.isAarch64) then gfortran11 else gfortran9;
gfortran48 = wrapCC (gcc48.cc.override {
name = "gfortran";
@ -10660,7 +10663,8 @@ in
inherit (gnome2) libart_lgpl;
});
gnat = gnat9;
# aarch64-darwin doesn't support earlier gcc
gnat = if (stdenv.isDarwin && stdenv.isAarch64) then gnat11 else gnat9;
gnat6 = wrapCC (gcc6.cc.override {
name = "gnat";