Merge #115235: gcc: native aarch64-darwin support

+18 -6
+4 -2
pkgs/build-support/cc-wrapper/default.nix
··· 432 # Always add -march based on cpu in triple. Sometimes there is a 433 # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in 434 # that case. 435 - + optionalString ((targetPlatform ? gcc.arch) && 436 isGccArchSupported targetPlatform.gcc.arch) '' 437 echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before 438 '' 439 440 # -mcpu is not very useful. You should use mtune and march 441 # instead. It’s provided here for backwards compatibility. 442 - + optionalString (targetPlatform ? gcc.cpu) '' 443 echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before 444 '' 445
··· 432 # Always add -march based on cpu in triple. Sometimes there is a 433 # discrepency (x86_64 vs. x86-64), so we provide an "arch" arg in 434 # that case. 435 + # TODO: aarch64-darwin has mcpu incompatible with gcc 436 + + optionalString ((targetPlatform ? gcc.arch) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64)) && 437 isGccArchSupported targetPlatform.gcc.arch) '' 438 echo "-march=${targetPlatform.gcc.arch}" >> $out/nix-support/cc-cflags-before 439 '' 440 441 # -mcpu is not very useful. You should use mtune and march 442 # instead. It’s provided here for backwards compatibility. 443 + # TODO: aarch64-darwin has mcpu incompatible with gcc 444 + + optionalString ((targetPlatform ? gcc.cpu) && (isClang || !(stdenv.isDarwin && stdenv.isAarch64))) '' 445 echo "-mcpu=${targetPlatform.gcc.cpu}" >> $out/nix-support/cc-cflags-before 446 '' 447
+5
pkgs/development/compilers/gcc/11/default.nix
··· 72 ++ optional langFortran ../gfortran-driving.patch 73 ++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch 74 75 # Obtain latest patch with ../update-mcfgthread-patches.sh 76 ++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch; 77
··· 72 ++ optional langFortran ../gfortran-driving.patch 73 ++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch 74 75 + ++ optional (stdenv.isDarwin && stdenv.isAarch64) (fetchpatch { 76 + url = "https://github.com/fxcoudert/gcc/compare/releases/gcc-11.1.0...gcc-11.1.0-arm-20210504.diff"; 77 + sha256 = "sha256-JqCGJAfbOxSmkNyq49aFHteK/RFsCSLQrL9mzUCnaD0="; 78 + }) 79 + 80 # Obtain latest patch with ../update-mcfgthread-patches.sh 81 ++ optional (!crossStageStatic && targetPlatform.isMinGW) ./Added-mcf-thread-model-support-from-mcfgthread.patch; 82
+2 -1
pkgs/development/compilers/gcc/common/configure-flags.nix
··· 185 ++ lib.optional javaAwtGtk "--enable-java-awt=gtk" 186 ++ lib.optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" 187 188 - ++ (import ../common/platform-flags.nix { inherit (stdenv) targetPlatform; inherit lib; }) 189 ++ lib.optionals (targetPlatform != hostPlatform) crossConfigureFlags 190 ++ lib.optional (targetPlatform != hostPlatform) "--disable-bootstrap" 191
··· 185 ++ lib.optional javaAwtGtk "--enable-java-awt=gtk" 186 ++ lib.optional (langJava && javaAntlr != null) "--with-antlr-jar=${javaAntlr}" 187 188 + # TODO: aarch64-darwin has clang stdenv and its arch and cpu flag values are incompatible with gcc 189 + ++ lib.optional (!(stdenv.isDarwin && stdenv.isAarch64)) (import ../common/platform-flags.nix { inherit (stdenv) targetPlatform; inherit lib; }) 190 ++ lib.optionals (targetPlatform != hostPlatform) crossConfigureFlags 191 ++ lib.optional (targetPlatform != hostPlatform) "--disable-bootstrap" 192
+7 -3
pkgs/top-level/all-packages.nix
··· 10344 else ../development/compilers/gcc/10); 10345 gcc = if (with stdenv.targetPlatform; isVc4 || libc == "relibc") 10346 then gcc6 else 10347 - if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10; 10348 gcc-unwrapped = gcc.cc; 10349 10350 wrapNonDeterministicGcc = stdenv: ccWrapper: ··· 10572 10573 gcc_latest = gcc11; 10574 10575 - gfortran = gfortran9; 10576 10577 gfortran48 = wrapCC (gcc48.cc.override { 10578 name = "gfortran"; ··· 10660 inherit (gnome2) libart_lgpl; 10661 }); 10662 10663 - gnat = gnat9; 10664 10665 gnat6 = wrapCC (gcc6.cc.override { 10666 name = "gnat";
··· 10344 else ../development/compilers/gcc/10); 10345 gcc = if (with stdenv.targetPlatform; isVc4 || libc == "relibc") 10346 then gcc6 else 10347 + # aarch64-darwin doesn't support earlier gcc 10348 + if (stdenv.targetPlatform.isAarch64 && stdenv.isDarwin) then gcc11 10349 + else if stdenv.targetPlatform.isAarch64 then gcc9 else gcc10; 10350 gcc-unwrapped = gcc.cc; 10351 10352 wrapNonDeterministicGcc = stdenv: ccWrapper: ··· 10574 10575 gcc_latest = gcc11; 10576 10577 + # aarch64-darwin doesn't support earlier gcc 10578 + gfortran = if (stdenv.isDarwin && stdenv.isAarch64) then gfortran11 else gfortran9; 10579 10580 gfortran48 = wrapCC (gcc48.cc.override { 10581 name = "gfortran"; ··· 10663 inherit (gnome2) libart_lgpl; 10664 }); 10665 10666 + # aarch64-darwin doesn't support earlier gcc 10667 + gnat = if (stdenv.isDarwin && stdenv.isAarch64) then gnat11 else gnat9; 10668 10669 gnat6 = wrapCC (gcc6.cc.override { 10670 name = "gnat";