diff --git a/nixos/doc/manual/release-notes/rl-2505.section.md b/nixos/doc/manual/release-notes/rl-2505.section.md index 23e252470e44d..ec003bf52c736 100644 --- a/nixos/doc/manual/release-notes/rl-2505.section.md +++ b/nixos/doc/manual/release-notes/rl-2505.section.md @@ -10,6 +10,9 @@ Users on old macOS versions should consider upgrading to a supported version (potentially using [OpenCore Legacy Patcher](https://dortania.github.io/OpenCore-Legacy-Patcher/) for old hardware) or installing NixOS. If neither of those options are viable and you require new versions of software, [MacPorts](https://www.macports.org/) supports versions back to Mac OS X Snow Leopard 10.6. +- GCC has been updated from GCC 13 to GCC 14. + This introduces some backwards‐incompatible changes; see the [upstream porting guide](https://gcc.gnu.org/gcc-14/porting_to.html) for details. + ## New Modules {#sec-release-25.05-new-modules} diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 40a0484d5c500..58538e85dc3fd 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -184,7 +184,13 @@ pipe ((callFile ./common/builder.nix {}) ({ inherit version; src = fetchurl { - url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz"; + url = "mirror://gcc/${ + # TODO: Remove this before 25.05. + if version == "14-20241116" then + "snapshots/" + else + "releases/gcc-" + }${version}/gcc-${version}.tar.xz"; ${if is10 || is11 || is13 then "hash" else "sha256"} = gccVersions.srcHashForVersion version; }; @@ -206,6 +212,29 @@ pipe ((callFile ./common/builder.nix {}) ({ patchShebangs $configureScript done '' + # Copy the precompiled `gcc/gengtype-lex.cc` from the 14.2.0 tarball. + # Since the `gcc/gengtype-lex.l` file didn’t change between 14.2.0 + # and 14-2024116, this is safe. If it changes and we update the + # snapshot, we might need to vendor the compiled output in Nixpkgs. + # + # TODO: Remove this before 25.05. + + optionalString (version == "14-20241116") '' + cksum -c < +* + +and then taking the diff between the result and the upstream GCC +commit, and excerpting only the files that have conflicts when +naively applying the branch’s diff to the snapshot. (This is +more files than the two that actually needed manual merge work – +`gcc/config/aarch64/aarch64-tune.md` and `libgcc/config.host` – +because `patch(1)` can’t do a three‐way merge using ancestor +information.) + +diff --git a/gcc/config/aarch64/aarch64-tune.md b/gcc/config/aarch64/aarch64-tune.md +index 35b27ddb88..8ce2a93168 100644 +--- a/gcc/config/aarch64/aarch64-tune.md ++++ b/gcc/config/aarch64/aarch64-tune.md +@@ -1,5 +1,5 @@ + ;; -*- buffer-read-only: t -*- + ;; Generated automatically by gentune.sh from aarch64-cores.def + (define_attr "tune" +- "cortexa34,cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,octeontx,octeontxt81,octeontxt83,thunderxt81,thunderxt83,ampere1,ampere1a,ampere1b,emag,xgene1,falkor,qdf24xx,exynosm1,phecda,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,cortexa76ae,cortexa77,cortexa78,cortexa78ae,cortexa78c,cortexa65,cortexa65ae,cortexx1,cortexx1c,neoversen1,ares,neoversee1,octeontx2,octeontx2t98,octeontx2t96,octeontx2t93,octeontx2f95,octeontx2f95n,octeontx2f95mm,a64fx,fujitsu_monaka,tsv110,thunderx3t110,neoversev1,zeus,neoverse512tvb,saphira,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55,cortexa76cortexa55,cortexr82,cortexa510,cortexa520,cortexa710,cortexa715,cortexa720,cortexa725,cortexx2,cortexx3,cortexx4,cortexx925,neoversen2,cobalt100,neoversen3,neoversev2,grace,neoversev3,neoversev3ae,demeter,generic,generic_armv8_a,generic_armv9_a" ++ "cortexa34,cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,octeontx,octeontxt81,octeontxt83,thunderxt81,thunderxt83,ampere1,ampere1a,ampere1b,emag,xgene1,falkor,qdf24xx,exynosm1,phecda,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,cortexa76ae,cortexa77,cortexa78,cortexa78ae,cortexa78c,cortexa65,cortexa65ae,cortexx1,cortexx1c,neoversen1,ares,neoversee1,octeontx2,octeontx2t98,octeontx2t96,octeontx2t93,octeontx2f95,octeontx2f95n,octeontx2f95mm,a64fx,fujitsu_monaka,tsv110,thunderx3t110,neoversev1,zeus,neoverse512tvb,saphira,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55,cortexa76cortexa55,cortexr82,applea12,applem1,applem2,applem3,cortexa510,cortexa520,cortexa710,cortexa715,cortexa720,cortexa725,cortexx2,cortexx3,cortexx4,cortexx925,neoversen2,cobalt100,neoversen3,neoversev2,grace,neoversev3,neoversev3ae,demeter,generic,generic_armv8_a,generic_armv9_a" + (const (symbol_ref "((enum attr_tune) aarch64_tune)"))) +diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h +index 0d8886c026..5370511bec 100644 +--- a/gcc/config/darwin.h ++++ b/gcc/config/darwin.h +@@ -42,6 +42,7 @@ + + #define DARWIN_X86 0 + #define DARWIN_PPC 0 ++#define DARWIN_ARM64 0 + + #define OBJECT_FORMAT_MACHO 1 + +@@ -373,7 +374,8 @@ + */ + + #define DARWIN_NOCOMPACT_UNWIND \ +-" %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind) " ++"%{!fuse-ld=lld: \ ++ %:version-compare(>= 10.6 mmacosx-version-min= -no_compact_unwind)}" + + /* In Darwin linker specs we can put -lcrt0.o and ld will search the library + path for crt0.o or -lcrtx.a and it will search for libcrtx.a. As for +@@ -397,7 +399,8 @@ + LINK_PLUGIN_SPEC \ + "%{flto*:%&2 + ;; + esac +@@ -277,7 +280,7 @@ + if test "x$enable_darwin_at_rpath" = "xyes"; then + tmake_file="$tmake_file t-darwin-rpath " + fi +- extra_parts="crt3.o libd10-uwfef.a crttms.o crttme.o libemutls_w.a" ++ extra_parts="crt3.o crttms.o crttme.o libemutls_w.a " + ;; + *-*-dragonfly*) + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" +@@ -421,6 +424,15 @@ + tmake_file="${tmake_file} t-dfprules" + md_unwind_header=aarch64/aarch64-unwind.h + ;; ++aarch64*-*-darwin*) ++ extra_parts="$extra_parts crtfastmath.o libheapt_w.a" ++ tmake_file="${tmake_file} ${cpu_type}/t-aarch64" ++ tmake_file="${tmake_file} ${cpu_type}/t-lse" ++ tmake_file="${tmake_file} t-crtfm t-dfprules" ++ tmake_file="${tmake_file} ${cpu_type}/t-softfp t-softfp" ++ tmake_file="${tmake_file} ${cpu_type}/t-heap-trampoline" ++ md_unwind_header=aarch64/aarch64-unwind.h ++ ;; + aarch64*-*-freebsd*) + extra_parts="$extra_parts crtfastmath.o" + tmake_file="${tmake_file} ${cpu_type}/t-aarch64" +@@ -728,14 +740,14 @@ + tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" + tm_file="$tm_file i386/darwin-lib.h" + extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o" +- extra_parts="$extra_parts crtfastmath.o libheapt_w.a" ++ extra_parts="$extra_parts crtfastmath.o libd10-uwfef.a libheapt_w.a" + tmake_file="${tmake_file} i386/t-heap-trampoline" + ;; + x86_64-*-darwin*) + tmake_file="$tmake_file i386/t-crtpc t-crtfm i386/t-msabi" + tm_file="$tm_file i386/darwin-lib.h" + extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o" +- extra_parts="$extra_parts crtfastmath.o libheapt_w.a" ++ extra_parts="$extra_parts crtfastmath.o libd10-uwfef.a libheapt_w.a" + tmake_file="${tmake_file} i386/t-heap-trampoline" + ;; + i[34567]86-*-elfiamcu) +@@ -1218,12 +1230,14 @@ + # We build the darwin10 EH shim for Rosetta (running on x86 machines). + tm_file="$tm_file i386/darwin-lib.h" + tmake_file="$tmake_file rs6000/t-ppc64-fp rs6000/t-ibm-ldouble" ++ extra_parts="$extra_parts libd10-uwfef.a " + extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" + ;; + powerpc64-*-darwin*) + # We build the darwin10 EH shim for Rosetta (running on x86 machines). + tm_file="$tm_file i386/darwin-lib.h" + tmake_file="$tmake_file rs6000/t-darwin64 rs6000/t-ibm-ldouble" ++ extra_parts="$extra_parts libd10-uwfef.a " + extra_parts="$extra_parts crt2.o crt3_2.o libef_ppc.a dw_ppc.o" + ;; + powerpc*-*-freebsd*) diff --git a/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch b/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch index 27d455aa58b67..c08706e8097f6 100644 --- a/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch +++ b/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch @@ -1,12 +1,13 @@ -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 @@ +diff --git a/libgcc/config.host b/libgcc/config.host +index 7332903704..27a8b5bedb 100644 +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -236,7 +236,7 @@ + esac 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" +- *-*-darwin2*) ++ *-*-darwin2* | *-*-darwin) + tmake_file="t-darwin-min-11 $tmake_file" ;; - *-*-darwin9* | *-*-darwin1[0-7]*) + *-*-darwin1[89]*) diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index c25771a93723e..4e2518baff9e4 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -138,13 +138,23 @@ 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.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) ({ - "14" = [ (fetchpatch { - # There are no upstream release tags in https://github.com/iains/gcc-14-branch. - # 04696df09633baf97cdbbdd6e9929b9d472161d3 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-14.2.0 - name = "gcc-14-darwin-aarch64-support.patch"; - url = "https://github.com/iains/gcc-14-branch/compare/04696df09633baf97cdbbdd6e9929b9d472161d3..gcc-14.2-darwin-r0.diff"; - hash = "sha256-GEUz7KdGzd2WJ0gjX3Uddq2y9bWKdZpT3E9uZ09qLs4="; - }) ]; + "14" = [ + (fetchpatch { + name = "gcc-14-darwin-aarch64-support.patch"; + url = "https://raw.githubusercontent.com/Homebrew/formula-patches/41fdb9d5ec21fc8165cd4bee89bd23d0c90572ee/gcc/gcc-14.2.0-r2.diff"; + # The patch is based on 14.2.0, but we use a GCC snapshot. We + # exclude the files with conflicts and apply our own merged patch + # to avoid vendoring the entire huge patch in‐tree. + excludes = [ + "gcc/config/aarch64/aarch64-tune.md" + "gcc/config/darwin.h" + "libgcc/config.host" + "libgcc/config/t-darwin-min-11" + ]; + hash = "sha256-E4zEKm4tMhovOJKc1/FXZCLQvA+Jt5SC0O2C6SEvZjI="; + }) + ./14/fixup-gcc-14-darwin-aarch64-support.patch + ]; "13" = [ (fetchpatch { name = "gcc-13-darwin-aarch64-support.patch"; url = "https://raw.githubusercontent.com/Homebrew/formula-patches/bda0faddfbfb392e7b9c9101056b2c5ab2500508/gcc/gcc-13.3.0.diff"; diff --git a/pkgs/development/compilers/gcc/versions.nix b/pkgs/development/compilers/gcc/versions.nix index 7aa8b558f358e..a75f2e2a3d4bc 100644 --- a/pkgs/development/compilers/gcc/versions.nix +++ b/pkgs/development/compilers/gcc/versions.nix @@ -1,6 +1,6 @@ let majorMinorToVersionMap = { - "14" = "14.2.0"; + "14" = "14-20241116"; "13" = "13.3.0"; "12" = "12.4.0"; "11" = "11.5.0"; @@ -16,7 +16,7 @@ let # TODO(amjoseph): convert older hashes to SRI form srcHashForVersion = version: { - "14.2.0" = "sha256-p7Obxpy/niWCbFpgqyZHcAH3wI2FzsBLwOKcq+1vPMk="; + "14-20241116" = "sha256-aXSkle8Mzj/Q15cHOu0D9Os2PWQwMIboUZULhnsRSUo="; "13.3.0" = "sha256-CEXpYhyVQ6E/SE6UWEpJ/8ASmXDpkUYkI1/B0GGgwIM="; "12.4.0" = "sha256-cE9lJgTMvMsUvavzR4yVEciXiLEss7v/3tNzQZFqkXU="; "11.5.0" = "sha256-puIYaOrVRc+H8MAfhCduS1KB1nIJhZHByJYkHwk2NHg="; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 42c47600e2f2c..7003d9ed02f25 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6155,7 +6155,7 @@ with pkgs; gerbilPackages-unstable = pkgs.gerbil-support.gerbilPackages-unstable; # NB: don't recurseIntoAttrs for (unstable!) libraries glow-lang = pkgs.gerbilPackages-unstable.glow-lang; - default-gcc-version = 13; + default-gcc-version = 14; gcc = pkgs.${"gcc${toString default-gcc-version}"}; gccFun = callPackage ../development/compilers/gcc; gcc-unwrapped = gcc.cc;