Merge pull request #309788 from trofi/gcc-14-init

gcc14, gfortran14, gnat14, gccgo14: init at 14.1.0
This commit is contained in:
Weijia Wang
2024-05-22 00:34:06 +02:00
committed by GitHub
8 changed files with 140 additions and 2 deletions
@@ -15,6 +15,7 @@
, libucontext ? null
, libxcrypt ? null
, cloog ? null
, darwin ? null
, isl ? null
, zlib ? null
, gnat-bootstrap ? null
@@ -85,6 +86,7 @@ in
++ optionals langJava [ boehmgc zip unzip ]
++ optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)
++ optionals (langGo && stdenv.hostPlatform.isMusl) [ libucontext ]
++ optionals (lib.versionAtLeast version "14" && stdenv.hostPlatform.isDarwin) [ darwin.apple_sdk.frameworks.CoreServices ]
;
# threadsCross.package after gcc6 so i assume its okay for 4.8 and 4.9 too
@@ -70,6 +70,7 @@ let
version = gccVersions.fromMajorMinor majorMinorVersion;
majorVersion = versions.major version;
atLeast14 = versionAtLeast version "14";
atLeast13 = versionAtLeast version "13";
atLeast12 = versionAtLeast version "12";
atLeast11 = versionAtLeast version "11";
@@ -79,6 +80,7 @@ let
atLeast7 = versionAtLeast version "7";
atLeast6 = versionAtLeast version "6";
atLeast49 = versionAtLeast version "4.9";
is14 = majorVersion == "14";
is13 = majorVersion == "13";
is12 = majorVersion == "12";
is11 = majorVersion == "11";
@@ -127,6 +129,7 @@ let
buildPackages
cloog
withoutTargetLibc
darwin
disableBootstrap
disableGdbPlugin
enableLTO
@@ -0,0 +1,39 @@
diff --git a/config/intlmacosx.m4 b/config/intlmacosx.m4
index 3141bf8c5..7a31862b9 100644
--- a/config/intlmacosx.m4
+++ b/config/intlmacosx.m4
@@ -63,7 +63,7 @@ AC_DEFUN([gt_INTL_MACOSX],
dnl and we have to link it in explicitly, otherwise an exception
dnl NSInvalidArgumentException "unrecognized selector sent to instance"
dnl occurs.
- INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices"
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
fi
AC_SUBST([INTL_MACOSX_LIBS])
])
diff --git a/gcc/configure b/gcc/configure
index 23da7d55d..8bd09364d 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -13932,7 +13932,7 @@ $as_echo "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h
INTL_MACOSX_LIBS=
if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
|| test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
- INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices"
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
fi
diff --git a/libcpp/configure b/libcpp/configure
index 32d6aaa30..592c33881 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -7570,7 +7570,7 @@ $as_echo "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h
INTL_MACOSX_LIBS=
if test $gt_cv_func_CFPreferencesCopyAppValue = yes \
|| test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then
- INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices"
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation"
fi
@@ -0,0 +1,21 @@
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 0666fc00b..0e2d53eb8 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -793,14 +793,14 @@ gnatlib-shared-darwin:
-o libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_NONTASKING_OBJS) $(LIBGNAT_OBJS) \
$(SO_OPTS) \
- -Wl,-install_name,@rpath/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -Wl,-install_name,$(ADA_RTL_DSO_DIR)/libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \
-nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
-Wl,-rpath,@loader_path/../../../../ $(MISCLIB)
cd $(RTSDIR); $(GCC_FOR_ADA_RTS) -dynamiclib $(PICFLAG_FOR_TARGET) \
-o libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
$(GNATRTL_TASKING_OBJS) \
$(SO_OPTS) \
- -Wl,-install_name,@rpath/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
+ -Wl,-install_name,$(ADA_RTL_DSO_DIR)/libgnarl$(hyphen)$(LIBRARY_VERSION)$(soext) \
-nodefaultrpaths -Wl,-rpath,@loader_path/,-rpath,@loader_path/.. \
-Wl,-rpath,@loader_path/../../../../ \
$(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext)
@@ -0,0 +1,12 @@
diff -u a/libgcc/config.host b/libgcc/config.host
--- a/libgcc/config.host 2023-11-05 11:01:55.778638446 -0500
+++ b/libgcc/config.host 2023-11-05 11:07:29.405103979 -0500
@@ -227,7 +227,7 @@
tmake_file="$tmake_file t-slibgcc-darwin"
# newer toolsets produce warnings when building for unsupported versions.
case ${host} in
- *-*-darwin1[89]* | *-*-darwin2* )
+ *-*-darwin1[89]* | *-*-darwin2* | *-*-darwin)
tmake_file="t-darwin-min-8 $tmake_file"
;;
*-*-darwin9* | *-*-darwin1[0-7]*)
@@ -25,6 +25,7 @@
}:
let
atLeast14 = lib.versionAtLeast version "14";
atLeast13 = lib.versionAtLeast version "13";
atLeast12 = lib.versionAtLeast version "12";
atLeast11 = lib.versionAtLeast version "11";
@@ -34,6 +35,7 @@ let
atLeast7 = lib.versionAtLeast version "7";
atLeast6 = lib.versionAtLeast version "6";
atLeast49 = lib.versionAtLeast version "4.9";
is14 = majorVersion == "14";
is13 = majorVersion == "13";
is12 = majorVersion == "12";
is11 = majorVersion == "11";
@@ -63,6 +65,7 @@ in
++ optionals (noSysDirs) (
[(if atLeast12 then ./gcc-12-no-sys-dirs.patch else ./no-sys-dirs.patch)] ++
({
"14" = [ ./13/no-sys-dirs-riscv.patch ./13/mangle-NIX_STORE-in-__FILE__.patch ];
"13" = [ ./13/no-sys-dirs-riscv.patch ./13/mangle-NIX_STORE-in-__FILE__.patch ];
"12" = [ ./no-sys-dirs-riscv.patch ./12/mangle-NIX_STORE-in-__FILE__.patch ];
"11" = [ ./no-sys-dirs-riscv.patch ];
@@ -124,11 +127,18 @@ in
## Darwin
# Fixes detection of Darwin on x86_64-darwin. Otherwise, GCC uses a deployment target of 10.5, which crashes ld64.
++ optional (atLeast14 && stdenv.isDarwin && stdenv.isx86_64) ../patches/14/libgcc-darwin-detection.patch
# Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin
++ optional (atLeast12 && stdenv.isDarwin && langAda) ./ada-cctools-as-detection-configure.patch
# Remove CoreServices on Darwin, as it is only needed for macOS SDK 14+
++ optional (atLeast14 && stdenv.isDarwin && langAda) ../patches/14/gcc-darwin-remove-coreservices.patch
# Use absolute path in GNAT dylib install names on Darwin
++ optionals (stdenv.isDarwin && langAda) ({
"14" = [ ../patches/14/gnat-darwin-dylib-install-name-14.patch ];
"13" = [ ./gnat-darwin-dylib-install-name-13.patch ];
"12" = [ ./gnat-darwin-dylib-install-name.patch ];
}.${majorVersion} or [])
@@ -136,6 +146,11 @@ in
# We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building
# a foreign one: https://github.com/iains/gcc-12-branch/issues/18
++ optionals (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) ({
"14" = [ (fetchpatch {
name = "gcc-14-darwin-aarch64-support.patch";
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/82b5c1cd38826ab67ac7fc498a8fe74376a40f4a/gcc/gcc-14.1.0.diff";
sha256 = "sha256-jCY65l1DGdESNyzEmD8FFC/xMmqeqBIQF+BhT4uTBBU=";
}) ];
"13" = [ (fetchpatch {
name = "gcc-13-darwin-aarch64-support.patch";
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff";
@@ -1,5 +1,6 @@
let
majorMinorToVersionMap = {
"14" = "14.1.0";
"13" = "13.2.0";
"12" = "12.3.0";
"11" = "11.4.0";
@@ -19,6 +20,7 @@ let
srcHashForVersion = version: {
# NOTE: there is no need to remove hashes of obsolete minor
# versions when adding a new minor version.
"14.1.0" = "sha256-4oPGVJh6/j3p2AgLwL15U0tcoNaBpzoR/ytdN2dCaEA=";
"13.2.0" = "sha256-4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
"12.3.0" = "sha256-lJpdT5nnhkIak7Uysi/6tVeN5zITaZdbka7Jet/ajDs=";
"11.4.0" = "sha256-Py2yIrAH6KSiPNW6VnJu8I6LHx6yBV7nLBQCzqc6jdk=";
+46 -2
View File
@@ -15487,6 +15487,7 @@ with pkgs;
gcc11Stdenv = overrideCC gccStdenv buildPackages.gcc11;
gcc12Stdenv = overrideCC gccStdenv buildPackages.gcc12;
gcc13Stdenv = overrideCC gccStdenv buildPackages.gcc13;
gcc14Stdenv = overrideCC gccStdenv buildPackages.gcc14;
# This is not intended for use in nixpkgs but for providing a faster-running
# compiler to nixpkgs users by building gcc with reproducibility-breaking
@@ -15577,9 +15578,9 @@ with pkgs;
};
inherit (callPackage ../development/compilers/gcc/all.nix { inherit noSysDirs; })
gcc48 gcc49 gcc6 gcc7 gcc8 gcc9 gcc10 gcc11 gcc12 gcc13;
gcc48 gcc49 gcc6 gcc7 gcc8 gcc9 gcc10 gcc11 gcc12 gcc13 gcc14;
gcc_latest = gcc13;
gcc_latest = gcc14;
# Use the same GCC version as the one from stdenv by default
gfortran = wrapCC (gcc.cc.override {
@@ -15670,6 +15671,14 @@ with pkgs;
profiledCompiler = false;
});
gfortran14 = wrapCC (gcc14.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
});
libgccjit = gcc.cc.override {
name = "libgccjit";
langFortran = false;
@@ -15763,6 +15772,29 @@ with pkgs;
else stdenv;
});
gnat14 = wrapCC (gcc14.cc.override {
name = "gnat";
langC = true;
langCC = false;
langAda = true;
profiledCompiler = false;
# As per upstream instructions building a cross compiler
# should be done with a (native) compiler of the same version.
# If we are cross-compiling GNAT, we may as well do the same.
gnat-bootstrap =
if stdenv.hostPlatform == stdenv.targetPlatform
&& stdenv.buildPlatform == stdenv.hostPlatform
then buildPackages.gnat-bootstrap12
else buildPackages.gnat13;
stdenv =
if stdenv.hostPlatform == stdenv.targetPlatform
&& stdenv.buildPlatform == stdenv.hostPlatform
&& stdenv.buildPlatform.isDarwin
&& stdenv.buildPlatform.isx86_64
then overrideCC stdenv gnat-bootstrap12
else stdenv;
});
gnat-bootstrap = gnat-bootstrap12;
gnat-bootstrap11 = wrapCC (callPackage ../development/compilers/gnat-bootstrap { majorVersion = "11"; });
gnat-bootstrap12 = wrapCCWith ({
@@ -15817,6 +15849,18 @@ with pkgs;
meta.broken = stdenv.hostPlatform.isDarwin;
});
gccgo14 = wrapCC (gcc14.cc.override {
name = "gccgo";
langCC = true; #required for go.
langC = true;
langGo = true;
langJit = true;
profiledCompiler = false;
} // {
# not supported on darwin: https://github.com/golang/go/issues/463
meta.broken = stdenv.hostPlatform.isDarwin;
});
ghdl = ghdl-mcode;
ghdl-mcode = callPackage ../development/compilers/ghdl {