From 400c70ff320a7ab096db446b7b285bed10b1f6ab Mon Sep 17 00:00:00 2001 From: Emily Date: Sun, 24 May 2026 19:52:07 +0100 Subject: [PATCH 01/10] gcc: remove unused Darwin patch file Fixes: 02eb6d057194cd9670bfe669617161d9e7736f5a --- .../patches/cfi_startproc-reorder-label-2.diff | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 pkgs/development/compilers/gcc/patches/cfi_startproc-reorder-label-2.diff diff --git a/pkgs/development/compilers/gcc/patches/cfi_startproc-reorder-label-2.diff b/pkgs/development/compilers/gcc/patches/cfi_startproc-reorder-label-2.diff deleted file mode 100644 index 83aecff1a0df..000000000000 --- a/pkgs/development/compilers/gcc/patches/cfi_startproc-reorder-label-2.diff +++ /dev/null @@ -1,16 +0,0 @@ -this patch fixes build for clang-18+ - -diff --git a/libgcc/config/aarch64/lse.S b/libgcc/config/aarch64/lse.S -index d3235bc33..1a56eb61c 100644 ---- a/libgcc/config/aarch64/lse.S -+++ b/libgcc/config/aarch64/lse.S -@@ -197,8 +197,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see - .text - .balign 16 - .private_extern _\name -- .cfi_startproc - _\name: -+ .cfi_startproc - BTI_C - .endm - From 28aa84b9648a1c95e1ee9de77aa2afdd2b2c4406 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 9 Sep 2025 16:22:51 +0100 Subject: [PATCH 02/10] gcc: drop Darwin Ada patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I’m pretty sure these should no longer be required after the toolchain update and SDK rework. --- .../14/gcc-darwin-remove-coreservices.patch | 39 ------------------- .../ada-cctools-as-detection-configure.patch | 33 ---------------- .../compilers/gcc/patches/default.nix | 8 ---- 3 files changed, 80 deletions(-) delete mode 100644 pkgs/development/compilers/gcc/patches/14/gcc-darwin-remove-coreservices.patch delete mode 100644 pkgs/development/compilers/gcc/patches/ada-cctools-as-detection-configure.patch diff --git a/pkgs/development/compilers/gcc/patches/14/gcc-darwin-remove-coreservices.patch b/pkgs/development/compilers/gcc/patches/14/gcc-darwin-remove-coreservices.patch deleted file mode 100644 index 9d21a3c4c438..000000000000 --- a/pkgs/development/compilers/gcc/patches/14/gcc-darwin-remove-coreservices.patch +++ /dev/null @@ -1,39 +0,0 @@ -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 - - diff --git a/pkgs/development/compilers/gcc/patches/ada-cctools-as-detection-configure.patch b/pkgs/development/compilers/gcc/patches/ada-cctools-as-detection-configure.patch deleted file mode 100644 index e6b5b3653322..000000000000 --- a/pkgs/development/compilers/gcc/patches/ada-cctools-as-detection-configure.patch +++ /dev/null @@ -1,33 +0,0 @@ -As originally implemented, the error message check -described in the configure script -breaks detection of Ada compiler support on x86_64-darwin, -because the assembler in the version of cctools currently used -unconditionally emits a deprecation message to stdout, -with no way to disable it. - -Furthermore, GCC 3.4 was the minimum version needed to build GNAT -as far back as GCC 4.4 (see the GCC git repo, tags/releases/gcc-4.4.0, -gcc/doc/install.texi, lines 2052-2053 [1]); -GCC 3.4 is newer than any of the broken GCC versions -that the configure script works around -(see the part of the comment in the configure script -before the context in the patch below), -and GCC 4.4 is older than any GCC that Nix currently packages (GCC 4.8). - -We therefore choose to not check for error messages, -and just check for an error code. -There's no harm in still checking for an object file being created, though. - -[1]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/doc/install.texi;h=6bdfbece981f7fb6c26da672d45e5d3ba7879c69;hb=b7fc996728085c0591ea7c5d0e1c84a8f6a29bd8#l2052 ---- a/configure 2022-08-19 18:09:52.000000000 +1000 -+++ b/configure 2022-12-26 17:30:49.000000000 +1100 -@@ -5622,8 +5622,7 @@ - # Other compilers, like HP Tru64 UNIX cc, exit successfully when - # given a .adb file, but produce no object file. So we must check - # if an object file was really produced to guard against this. --errors=`(${CC} -c conftest.adb) 2>&1 || echo failure` --if test x"$errors" = x && test -f conftest.$ac_objext; then -+if ${CC} -c conftest.adb && test -f conftest.$ac_objext; then - acx_cv_cc_gcc_supports_ada=yes - fi - rm -f conftest.* diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index cc0b5b47e9b4..5594299e447c 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -132,14 +132,6 @@ optionals noSysDirs ( atLeast15 && stdenv.hostPlatform.isDarwin ) ../patches/15/libgcc-darwin-fix-reexport.patch -# Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin -++ optional (stdenv.hostPlatform.isDarwin && langAda) ./ada-cctools-as-detection-configure.patch - -# Remove CoreServices on Darwin, as it is only needed for macOS SDK 14+ -++ optional ( - atLeast14 && stdenv.hostPlatform.isDarwin && langAda -) ../patches/14/gcc-darwin-remove-coreservices.patch - # Here we apply patches by Iains (https://github.com/iains) # GitHub's "compare" API produces unstable diffs, so we resort to reusing # diffs from the Homebrew repo. From a6845cb0d606c5b70f7e19534bbfd4609639b563 Mon Sep 17 00:00:00 2001 From: Emily Date: Tue, 9 Sep 2025 16:22:51 +0100 Subject: [PATCH 03/10] gcc: always apply Darwin patches for Darwin targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The upstream issue was fixed, the branch has changes relevant to `x86_64-darwin` too, and you don’t really want to target Darwin without these patches. We reorder the deployment target patch after the patches, as they touch the same file, and apply it on AArch64 for all versions (but for Darwin targets rather than hosts, which should be the relevant case anyway). Co-Authored-By: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> --- .../patches/14/libgcc-darwin-detection.patch | 10 ++-- .../patches/15/libgcc-darwin-detection.patch | 12 ----- .../compilers/gcc/patches/default.nix | 46 ++++--------------- 3 files changed, 13 insertions(+), 55 deletions(-) delete mode 100644 pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch 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 c08706e8097f..810d8e6f69a1 100644 --- a/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch +++ b/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch @@ -1,11 +1,9 @@ -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" - case ${host} in +@@ -239,7 +239,7 @@ case ${host} in + x86_64-*-darwin2[0-2]*) + tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file" + ;; - *-*-darwin2*) + *-*-darwin2* | *-*-darwin) tmake_file="t-darwin-min-11 $tmake_file" diff --git a/pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch b/pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch deleted file mode 100644 index 41e1c4c89869..000000000000 --- a/pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/libgcc/config.host -+++ b/libgcc/config.host -@@ -239,8 +239,8 @@ case ${host} in - x86_64-*-darwin2[0-2]*) - tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file" - ;; -- *-*-darwin2*) -- tmake_file="t-darwin-min-11 $tmake_file" -+ *-*-darwin2* | *-*-darwin) -+ tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file" - ;; - *-*-darwin1[89]*) diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index 5594299e447c..2b79e84a545a 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -35,12 +35,6 @@ let is14 = majorVersion == "14"; is13 = majorVersion == "13"; - # We only apply these patches when building a native toolchain for - # aarch64-darwin, as it breaks building a foreign one: - # https://github.com/iains/gcc-12-branch/issues/18 - canApplyIainsDarwinPatches = - stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64 && buildIsHost && hostIsTarget; - inherit (lib) optionals optional; in @@ -108,7 +102,7 @@ optionals noSysDirs ( # Needed to build llvm-18 and later # See https://github.com/NixOS/nixpkgs/pull/354107/commits/2de1b4b14e17f42ba8b4bf43a29347c91511e008 ++ optional (!atLeast14) ./cfi_startproc-reorder-label-09-1.diff -++ optional (atLeast14 && !canApplyIainsDarwinPatches) ./cfi_startproc-reorder-label-14-1.diff +++ optional (atLeast14 && !targetPlatform.isDarwin) ./cfi_startproc-reorder-label-14-1.diff # c++tools: Don't check --enable-default-pie. # --enable-default-pie breaks bootstrap gcc otherwise, because libiberty.a is not found ++ optional (is14 || is15) ./c++tools-dont-check-enable-default-pie.patch @@ -120,30 +114,22 @@ optionals noSysDirs ( ## Darwin -# Fixes detection of Darwin on x86_64-darwin and aarch64-darwin. Otherwise, GCC uses a deployment target of 10.5, which crashes ld64. -++ optional ( - # this one would conflict with gcc-14-darwin-aarch64-support.patch - is14 && stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64 -) ../patches/14/libgcc-darwin-detection.patch -++ optional (atLeast15 && stdenv.hostPlatform.isDarwin) ../patches/15/libgcc-darwin-detection.patch - -# Fix libgcc_s.1.dylib build on Darwin 11+ by not reexporting unwind symbols that don't exist -++ optional ( - atLeast15 && stdenv.hostPlatform.isDarwin -) ../patches/15/libgcc-darwin-fix-reexport.patch - # Here we apply patches by Iains (https://github.com/iains) # GitHub's "compare" API produces unstable diffs, so we resort to reusing # diffs from the Homebrew repo. -++ optionals canApplyIainsDarwinPatches ( +++ optionals targetPlatform.isDarwin ( { "15" = [ + # Fix libgcc_s.1.dylib build on Darwin 11+ by not reexporting unwind symbols that don't exist + ./15/libgcc-darwin-fix-reexport.patch # Patches from https://github.com/iains/gcc-15-branch/compare/releases/gcc-15..gcc-15.1-darwin-rc1 (fetchpatch { name = "gcc-15-darwin-aarch64-support.patch"; url = "https://raw.githubusercontent.com/Homebrew/formula-patches/a25079204c1cb3d78ba9dd7dd22b8aecce7ce264/gcc/gcc-15.1.0.diff"; sha256 = "sha256-MJxSGv6LEP1sIM8cDqbmfUV7byV0bYgADeIBY/Teyu8="; }) + # Fixes detection of Darwin deployment target. + ./14/libgcc-darwin-detection.patch ]; "14" = [ # Patches from https://github.com/iains/gcc-14-branch/compare/04696df09633baf97cdbbdd6e9929b9d472161d3..gcc-14.2-darwin-r2 @@ -155,12 +141,13 @@ optionals noSysDirs ( url = "https://github.com/iains/gcc-14-branch/compare/aa4cd614456de65ee3417acb83c6cff0640144e9..3e1d48d240f4aa5223c701b5c231c66f66ab1126.diff"; hash = "sha256-BSTSYnkBJBEm++mGerVVyaCUC4dUyXq0N1tqbk25bO4="; }) + ./14/libgcc-darwin-detection.patch ]; - # Patches from https://github.com/iains/gcc-13-branch/compare/b71f1de6e9cf7181a288c0f39f9b1ef6580cf5c8..gcc-13-3-darwin "13" = [ + # Patches from https://github.com/iains/gcc-13-branch (fetchpatch { name = "gcc-13-darwin-aarch64-support.patch"; - url = "https://raw.githubusercontent.com/Homebrew/formula-patches/698885df7f624d0ce15bceb79a4d9760a473b502/gcc/gcc-13.4.0.diff"; + url = "https://raw.githubusercontent.com/Homebrew/homebrew-core/d23df58f83aeb2c3f43bdcc277a9fac0bbe3e896/Patches/gcc/gcc-13.4.0.diff"; hash = "sha256-xqkBDFYZ6fdowtqR3kV7bR8a4Cu11RDokSzGn1k3a1w="; }) ]; @@ -168,21 +155,6 @@ optionals noSysDirs ( .${majorVersion} or [ ] ) -# Use absolute path in GNAT dylib install names on Darwin -++ optionals (stdenv.hostPlatform.isDarwin && langAda) ( - { - "15" = [ ../patches/14/gnat-darwin-dylib-install-name-14.patch ]; - "14" = [ ../patches/14/gnat-darwin-dylib-install-name-14.patch ]; - # After the Iains patch, GCC 13 and 14 share the same patch. - "13" = [ ../patches/14/gnat-darwin-dylib-install-name-14.patch ]; - } - .${majorVersion} or [ ] -) - -++ optional ( - langAda && is13 && canApplyIainsDarwinPatches -) ./13/gnat13-aarch64-darwin-trampoline.patch - ++ optional (targetPlatform.isWindows || targetPlatform.isCygwin) (fetchpatch { name = "libstdc-fix-compilation-in-freestanding-win32.patch"; url = "https://inbox.sourceware.org/gcc-patches/20250922182808.2599390-2-corngood@gmail.com/raw"; From 225552310a2af3996578486c7032c706960decb3 Mon Sep 17 00:00:00 2001 From: Emily Date: Fri, 26 Jun 2026 08:38:08 +0100 Subject: [PATCH 04/10] gcc16: add Darwin patches --- pkgs/development/compilers/gcc/patches/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index 2b79e84a545a..cd96831499ff 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -119,6 +119,18 @@ optionals noSysDirs ( # diffs from the Homebrew repo. ++ optionals targetPlatform.isDarwin ( { + "16" = [ + # Fix libgcc_s.1.dylib build on Darwin 11+ by not reexporting unwind symbols that don't exist + ./15/libgcc-darwin-fix-reexport.patch + # Patches from https://github.com/iains/gcc-16-branch + (fetchpatch { + name = "gcc-16-darwin-aarch64-support.patch"; + url = "https://raw.githubusercontent.com/Homebrew/homebrew-core/70e2a9e1d072fa3bc34cf41d97f4b65bede2b01e/Patches/gcc/gcc-16.1.0.diff"; + hash = "sha256-dXfozKH//TRjAph7hUok7850hOdujTTi/iFM2HFA8fw="; + }) + # Fixes detection of Darwin deployment target. + ./14/libgcc-darwin-detection.patch + ]; "15" = [ # Fix libgcc_s.1.dylib build on Darwin 11+ by not reexporting unwind symbols that don't exist ./15/libgcc-darwin-fix-reexport.patch From 14560033938a74c9d37e6c506036784db8153bc8 Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Tue, 7 Jul 2026 22:51:33 +1000 Subject: [PATCH 05/10] gcc14: 14.3.0 -> 14.4.0 https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&resolution=FIXED&target_milestone=14.4 --- .../gcc/patches/14/libgcc-darwin-detection.patch | 3 ++- pkgs/development/compilers/gcc/patches/default.nix | 10 +++------- pkgs/development/compilers/gcc/versions.nix | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) 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 810d8e6f69a1..772654cfd971 100644 --- a/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch +++ b/pkgs/development/compilers/gcc/patches/14/libgcc-darwin-detection.patch @@ -5,7 +5,8 @@ tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file" ;; - *-*-darwin2*) +- tmake_file="t-darwin-min-11 $tmake_file" + *-*-darwin2* | *-*-darwin) - tmake_file="t-darwin-min-11 $tmake_file" ++ tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file" ;; *-*-darwin1[89]*) diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index cd96831499ff..bdc563d5f748 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -76,7 +76,6 @@ optionals noSysDirs ( "14" = [ ./13/no-sys-dirs-riscv.patch ./13/mangle-NIX_STORE-in-__FILE__.patch - ./13/libsanitizer-fix-with-glibc-2.42.patch ]; "13" = [ ./13/no-sys-dirs-riscv.patch @@ -144,14 +143,11 @@ optionals noSysDirs ( ./14/libgcc-darwin-detection.patch ]; "14" = [ - # Patches from https://github.com/iains/gcc-14-branch/compare/04696df09633baf97cdbbdd6e9929b9d472161d3..gcc-14.2-darwin-r2 + # Patches from https://github.com/iains/gcc-14-branch (fetchpatch { - # There are no upstream release tags nor a static branch for 14.3.0 in https://github.com/iains/gcc-14-branch. - # aa4cd614456de65ee3417acb83c6cff0640144e9 is the merge base of https://github.com/iains/gcc-14-branch/tree/gcc-14-3-darwin-pre-0 and https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-14.3.0 - # 3e1d48d240f4aa5223c701b5c231c66f66ab1126 is the newest commit of https://github.com/iains/gcc-14-branch/tree/gcc-14-3-darwin-pre-0 name = "gcc-14-darwin-aarch64-support.patch"; - url = "https://github.com/iains/gcc-14-branch/compare/aa4cd614456de65ee3417acb83c6cff0640144e9..3e1d48d240f4aa5223c701b5c231c66f66ab1126.diff"; - hash = "sha256-BSTSYnkBJBEm++mGerVVyaCUC4dUyXq0N1tqbk25bO4="; + url = "https://raw.githubusercontent.com/Homebrew/homebrew-core/d23df58f83aeb2c3f43bdcc277a9fac0bbe3e896/Patches/gcc/gcc-14.4.0.diff"; + hash = "sha256-NU95q0xkP4wEi6XLJRWEhcMcL49gDuIHgZubC05QzRE="; }) ./14/libgcc-darwin-detection.patch ]; diff --git a/pkgs/development/compilers/gcc/versions.nix b/pkgs/development/compilers/gcc/versions.nix index ca6b2c91033d..a1350b30bffe 100644 --- a/pkgs/development/compilers/gcc/versions.nix +++ b/pkgs/development/compilers/gcc/versions.nix @@ -2,7 +2,7 @@ let majorMinorToVersionMap = { "16" = "16.1.0"; "15" = "15.2.0"; - "14" = "14.3.0"; + "14" = "14.4.0"; "13" = "13.4.0"; }; @@ -16,7 +16,7 @@ let # 4 digits: snapshots (14.2.1.20250322) "16.1.0" = "sha256-UO+02Uwzl6/zsNYaWr10i03THZ0/Kre+BbFx02pRD3k="; "15.2.0" = "sha256-Q4/ZloJrDIJIWinaA6ctcdbjVBqD7HAt9Ccfb+Al0k4="; - "14.3.0" = "sha256-4Nx3KXYlYxrI5Q+pL//v6Jmk63AlktpcMu8E4ik6yjo="; + "14.4.0" = "sha256-dStvVnvqyDFZx3p2gLExa914Rzi/+anQcBEsCdqQ9tk="; "13.4.0" = "sha256-nEzm27BAVo/cVFWIrAPFy8lajb8MeqSQFwhDr7WcqPU="; } ."${version}"; From 1f0b98a288c57924e7b523f4dfa475b8d22c7e5f Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Sat, 13 Jun 2026 19:49:52 +1000 Subject: [PATCH 06/10] gcc: 15.2.0 -> 15.3.0 https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&resolution=FIXED&target_milestone=15.3 --- .../gcc/patches/15/aarch64-sve-rtx.patch | 87 ------------------- .../patches/15/libgcc-darwin-detection.patch | 12 +++ .../compilers/gcc/patches/default.nix | 11 +-- pkgs/development/compilers/gcc/versions.nix | 4 +- 4 files changed, 18 insertions(+), 96 deletions(-) delete mode 100644 pkgs/development/compilers/gcc/patches/15/aarch64-sve-rtx.patch create mode 100644 pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch diff --git a/pkgs/development/compilers/gcc/patches/15/aarch64-sve-rtx.patch b/pkgs/development/compilers/gcc/patches/15/aarch64-sve-rtx.patch deleted file mode 100644 index 257c76d735da..000000000000 --- a/pkgs/development/compilers/gcc/patches/15/aarch64-sve-rtx.patch +++ /dev/null @@ -1,87 +0,0 @@ -Without the change `libhwy-1.3.0` ICEs when built for aarch64-linux as: -https://github.com/NixOS/nixpkgs/pull/320616#issuecomment-3764400891 - -Upstream report: http://gcc.gnu.org/PR120718 -Upstream fix: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=d755aa03db0ad5b71ee7f39b09c92870789f2f00 -Fetched as: -$ curl -L 'https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d755aa03db0ad5b71ee7f39b09c92870789f2f00' > aarch64-sve-rtx.patch - -From: Richard Sandiford -Date: Thu, 14 Aug 2025 16:56:50 +0000 (+0100) -Subject: Remove MODE_COMPOSITE_P test from simplify_gen_subreg [PR120718] -X-Git-Url: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d755aa03db0ad5b71ee7f39b09c92870789f2f00 - -Remove MODE_COMPOSITE_P test from simplify_gen_subreg [PR120718] - -simplify_gen_subreg rejected subregs of literal constants if -MODE_COMPOSITE_P. This was added by the fix for PR96648 in -g:c0f772894b6b3cd8ed5c5dd09d0c7917f51cf70f. Jakub said: - - As for the simplify_gen_subreg change, I think it would be desirable - to just avoid creating SUBREGs of constants on all targets and for all - constants, if simplify_immed_subreg simplified, fine, otherwise punt, - but as we are late in GCC11 development, the patch instead guards this - behavior on MODE_COMPOSITE_P (outermode) - i.e. only conversions to - powerpc{,64,64le} double double long double - and only for the cases where - simplify_immed_subreg was called. - -I'm not sure about relaxing the codes further, since subregs might -be wanted for CONST, SYMBOL_REF and LABEL_REF. But removing the -MODE_COMPOSITE_P is needed to fix PR120718, where we get an ICE -from generating a subreg of a V2SI const_vector. - -Unlike the trunk version, this backport does not remove the -VOIDmode test; see PR121501. - -gcc/ - PR rtl-optimization/120718 - * simplify-rtx.cc (simplify_context::simplify_gen_subreg): - Remove MODE_COMPOSITE_P condition. - -gcc/testsuite/ - PR rtl-optimization/120718 - * gcc.target/aarch64/sve/acle/general/pr120718.c: New test. ---- - -diff --git a/gcc/simplify-rtx.cc b/gcc/simplify-rtx.cc -index 88d31a71c05a..8d4cbf1371a3 100644 ---- a/gcc/simplify-rtx.cc -+++ b/gcc/simplify-rtx.cc -@@ -8317,14 +8317,11 @@ simplify_context::simplify_gen_subreg (machine_mode outermode, rtx op, - - if (GET_CODE (op) == SUBREG - || GET_CODE (op) == CONCAT -- || GET_MODE (op) == VOIDmode) -- return NULL_RTX; -- -- if (MODE_COMPOSITE_P (outermode) -- && (CONST_SCALAR_INT_P (op) -- || CONST_DOUBLE_AS_FLOAT_P (op) -- || CONST_FIXED_P (op) -- || GET_CODE (op) == CONST_VECTOR)) -+ || GET_MODE (op) == VOIDmode -+ || CONST_SCALAR_INT_P (op) -+ || CONST_DOUBLE_AS_FLOAT_P (op) -+ || CONST_FIXED_P (op) -+ || GET_CODE (op) == CONST_VECTOR) - return NULL_RTX; - - if (validate_subreg (outermode, innermode, op, byte)) -diff --git a/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c -new file mode 100644 -index 000000000000..9ca0938e36bf ---- /dev/null -+++ b/gcc/testsuite/gcc.target/aarch64/sve/acle/general/pr120718.c -@@ -0,0 +1,12 @@ -+/* { dg-options "-O2" } */ -+ -+#include -+typedef int __attribute__((vector_size(8))) v2si; -+typedef struct { int x; int y; } A; -+void bar(A a); -+void foo() -+{ -+ A a; -+ *(v2si *)&a = (v2si){0, (int)svcntd_pat(SV_ALL)}; -+ bar(a); -+} diff --git a/pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch b/pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch new file mode 100644 index 000000000000..20965f54be2b --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/15/libgcc-darwin-detection.patch @@ -0,0 +1,12 @@ +--- a/libgcc/config.host ++++ b/libgcc/config.host +@@ -236,7 +236,7 @@ + esac + tmake_file="$tmake_file t-slibgcc-darwin" + case ${host} in +- *-*-darwin2*) +- tmake_file="t-darwin-min-11 $tmake_file" ++ *-*-darwin2* | *-*-darwin) ++ tmake_file="t-darwin-min-11 t-darwin-libgccs1 $tmake_file" + ;; + *-*-darwin1[89]*) diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index bdc563d5f748..5dbb716713c2 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -105,9 +105,6 @@ optionals noSysDirs ( # c++tools: Don't check --enable-default-pie. # --enable-default-pie breaks bootstrap gcc otherwise, because libiberty.a is not found ++ optional (is14 || is15) ./c++tools-dont-check-enable-default-pie.patch -# http://gcc.gnu.org/PR120718 backport (will be inclkuded in 15.3.0) to -# fix `highway-1.3.0` ICE on aarch64-linux. -++ optional is15 ./15/aarch64-sve-rtx.patch ## 2. Patches relevant on specific platforms #################################### @@ -133,14 +130,14 @@ optionals noSysDirs ( "15" = [ # Fix libgcc_s.1.dylib build on Darwin 11+ by not reexporting unwind symbols that don't exist ./15/libgcc-darwin-fix-reexport.patch - # Patches from https://github.com/iains/gcc-15-branch/compare/releases/gcc-15..gcc-15.1-darwin-rc1 + # Patches from https://github.com/iains/gcc-15-branch (fetchpatch { name = "gcc-15-darwin-aarch64-support.patch"; - url = "https://raw.githubusercontent.com/Homebrew/formula-patches/a25079204c1cb3d78ba9dd7dd22b8aecce7ce264/gcc/gcc-15.1.0.diff"; - sha256 = "sha256-MJxSGv6LEP1sIM8cDqbmfUV7byV0bYgADeIBY/Teyu8="; + url = "https://raw.githubusercontent.com/Homebrew/homebrew-core/70e2a9e1d072fa3bc34cf41d97f4b65bede2b01e/Patches/gcc/gcc-15.3.0.diff"; + hash = "sha256-PeAloBdUu+zRJlv86Z4x/FI8I7LiR5CJ3JlAJKs1iKU="; }) # Fixes detection of Darwin deployment target. - ./14/libgcc-darwin-detection.patch + ./15/libgcc-darwin-detection.patch ]; "14" = [ # Patches from https://github.com/iains/gcc-14-branch diff --git a/pkgs/development/compilers/gcc/versions.nix b/pkgs/development/compilers/gcc/versions.nix index a1350b30bffe..2c91269d5d48 100644 --- a/pkgs/development/compilers/gcc/versions.nix +++ b/pkgs/development/compilers/gcc/versions.nix @@ -1,7 +1,7 @@ let majorMinorToVersionMap = { "16" = "16.1.0"; - "15" = "15.2.0"; + "15" = "15.3.0"; "14" = "14.4.0"; "13" = "13.4.0"; }; @@ -15,7 +15,7 @@ let # 3 digits: releases (14.2.0) # 4 digits: snapshots (14.2.1.20250322) "16.1.0" = "sha256-UO+02Uwzl6/zsNYaWr10i03THZ0/Kre+BbFx02pRD3k="; - "15.2.0" = "sha256-Q4/ZloJrDIJIWinaA6ctcdbjVBqD7HAt9Ccfb+Al0k4="; + "15.3.0" = "sha256-+lnBvu+JlfJ8TXHB3yJ1hxiTFdPm+v8btDBuYbDFMOs="; "14.4.0" = "sha256-dStvVnvqyDFZx3p2gLExa914Rzi/+anQcBEsCdqQ9tk="; "13.4.0" = "sha256-nEzm27BAVo/cVFWIrAPFy8lajb8MeqSQFwhDr7WcqPU="; } From 62da529c51dfc86c19a81aaa6b61e08db0c5364b Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Sat, 13 Jun 2026 21:25:48 +1000 Subject: [PATCH 07/10] gccNGPackages_15.gcc: 15.2.0 -> 15.3.0 https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&resolution=FIXED&target_milestone=15.3 --- pkgs/development/compilers/gcc/ng/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/compilers/gcc/ng/default.nix b/pkgs/development/compilers/gcc/ng/default.nix index c849367aa1fc..4eb9ca23b9b5 100644 --- a/pkgs/development/compilers/gcc/ng/default.nix +++ b/pkgs/development/compilers/gcc/ng/default.nix @@ -14,7 +14,7 @@ }@packageSetArgs: let versions = { - "15.2.0".officialRelease.sha256 = "sha256-Q4/ZloJrDIJIWinaA6ctcdbjVBqD7HAt9Ccfb+Al0k4="; + "15.3.0".officialRelease.sha256 = "sha256-+lnBvu+JlfJ8TXHB3yJ1hxiTFdPm+v8btDBuYbDFMOs="; } // gccVersions; From accd3f9567acad581e212f62e10184a5c59c0d13 Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Sat, 13 Jun 2026 20:05:33 +1000 Subject: [PATCH 08/10] minimal-bootstrap.gcc_latest: 15.2.0 -> 15.3.0 Also update mpc at the same time, 1.3.1 -> 1.4.1 --- pkgs/os-specific/linux/minimal-bootstrap/gcc/10.nix | 6 +++--- pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix | 10 +++++----- .../os-specific/linux/minimal-bootstrap/gcc/latest.nix | 10 +++++----- .../linux/minimal-bootstrap/gnumake/static.nix | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gcc/10.nix b/pkgs/os-specific/linux/minimal-bootstrap/gcc/10.nix index 25b06eb13f00..22db627fdb80 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gcc/10.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gcc/10.nix @@ -43,10 +43,10 @@ let hash = "sha256-tnugOD736KhWNzTi6InvXsPDuJigHQD6CmhprYHGzgE="; }; - mpcVersion = "1.3.1"; + mpcVersion = "1.4.1"; mpc = fetchurl { - url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.gz"; - hash = "sha256-q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg="; + url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.xz"; + hash = "sha256-kSBM0y8WS9O3yZLUpqjOZRlRGq2rMPeLaYLQv41z6TE="; }; in bash.runCommand "${pname}-${version}" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix b/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix index 3188453cea74..84429548ef45 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix @@ -22,7 +22,7 @@ }: let pname = "gcc"; - version = "15.2.0"; + version = "15.3.0"; linkerName = { i686-linux = "ld-linux.so.2"; @@ -32,7 +32,7 @@ let src = fetchurl { url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz"; - hash = "sha256-Q4/ZloJrDIJIWinaA6ctcdbjVBqD7HAt9Ccfb+Al0k4="; + hash = "sha256-+lnBvu+JlfJ8TXHB3yJ1hxiTFdPm+v8btDBuYbDFMOs="; }; gmpVersion = "6.3.0"; @@ -47,10 +47,10 @@ let hash = "sha256-tnugOD736KhWNzTi6InvXsPDuJigHQD6CmhprYHGzgE="; }; - mpcVersion = "1.3.1"; + mpcVersion = "1.4.1"; mpc = fetchurl { - url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.gz"; - hash = "sha256-q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg="; + url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.xz"; + hash = "sha256-kSBM0y8WS9O3yZLUpqjOZRlRGq2rMPeLaYLQv41z6TE="; }; in bash.runCommand "${pname}-${version}" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix b/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix index 8abf382e17d6..0489f9ceb125 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix @@ -21,11 +21,11 @@ }: let pname = "gcc"; - version = "15.2.0"; + version = "15.3.0"; src = fetchurl { url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz"; - hash = "sha256-Q4/ZloJrDIJIWinaA6ctcdbjVBqD7HAt9Ccfb+Al0k4="; + hash = "sha256-+lnBvu+JlfJ8TXHB3yJ1hxiTFdPm+v8btDBuYbDFMOs="; }; gmpVersion = "6.3.0"; @@ -40,10 +40,10 @@ let hash = "sha256-tnugOD736KhWNzTi6InvXsPDuJigHQD6CmhprYHGzgE="; }; - mpcVersion = "1.3.1"; + mpcVersion = "1.4.1"; mpc = fetchurl { - url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.gz"; - hash = "sha256-q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg="; + url = "mirror://gnu/mpc/mpc-${mpcVersion}.tar.xz"; + hash = "sha256-kSBM0y8WS9O3yZLUpqjOZRlRGq2rMPeLaYLQv41z6TE="; }; in bash.runCommand "${pname}-${version}" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnumake/static.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnumake/static.nix index 65369e28fb64..29baaebafcfd 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnumake/static.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnumake/static.nix @@ -70,7 +70,7 @@ bash.runCommand "${pname}-${version}" # Configure # - # Use std=gnu17 to avoid issue GCC 15.2.0 incompatibility. + # Use std=gnu17 to avoid issue GCC 15.3.0 incompatibility. # There is no newer release of gnumake available right now. bash ./configure \ --prefix=$out \ From ab01f7e3af86b03b8977d905551c71c7b7411f94 Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Tue, 7 Jul 2026 14:19:43 +1000 Subject: [PATCH 09/10] gnat-bootstrap{,15}: 15.2.0-1 -> 15.3.0-1 --- .../compilers/gnat-bootstrap/default.nix | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/gnat-bootstrap/default.nix b/pkgs/development/compilers/gnat-bootstrap/default.nix index 650bf5b37e40..6a07f0502832 100644 --- a/pkgs/development/compilers/gnat-bootstrap/default.nix +++ b/pkgs/development/compilers/gnat-bootstrap/default.nix @@ -83,31 +83,28 @@ stdenv.mkDerivation ( } .${stdenv.hostPlatform.system} or throwUnsupportedSystem; "15" = { - gccVersion = "15.2.0"; + gccVersion = "15.3.0"; + alireRevision = "1"; } // { x86_64-darwin = { - alireRevision = "1"; inherit url; - hash = "sha256-1YTqWsLBwNH/GBAtF5CL/YZHQvfE/3PE0LlLJ9HmjAg="; - upstreamTriplet = "x86_64-apple-darwin22.6.0"; + hash = "sha256-VUEX89/ZXXxE0ks61unWoM0Oza6v4v3EwJs0vSDBwTQ="; + upstreamTriplet = "x86_64-apple-darwin24.6.0"; }; x86_64-linux = { - alireRevision = "1"; inherit url; - hash = "sha256-b4hAg3ifoBRqgPxpfMYuOdunw7wzRTL/G5YGBO+im24="; + hash = "sha256-8CDxqAQW7zskadfdzMjJqzPN8GZ2qu/7NWvcQLDis1s="; upstreamTriplet = "x86_64-pc-linux-gnu"; }; aarch64-linux = { - alireRevision = "1"; inherit url; - hash = "sha256-0V/VHqOSYQI6LmvpUIHy3zB6hI3dG0njOcDsrg8oZq8="; + hash = "sha256-cLLYWqdZuEZxV4ofd0GtO/+pQDMKs6TAOrAHw3DgI94="; upstreamTriplet = "aarch64-linux-gnu"; }; aarch64-darwin = { - alireRevision = "2-pre0"; - url = "https://github.com/alire-project/GNAT-FSF-builds/releases/download/gnat-15.2.0-2-macos-pre0/gnat-${stdenv.hostPlatform.system}-${finalAttrs.version}.tar.gz"; - hash = "sha256-4bFtsjixfXYc8wYOc+5iAbp1MmiIS1h1NcdKno2IdJg="; + inherit url; + hash = "sha256-WKwNQJEghnXQLexKHswn494b4sz+usvgYEIoNaedzCk="; upstreamTriplet = "aarch64-apple-darwin24.6.0"; }; } From 8f12d45a148f814f155f065591a2c92a4d00134a Mon Sep 17 00:00:00 2001 From: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com> Date: Tue, 7 Jul 2026 23:24:48 +1000 Subject: [PATCH 10/10] gcc: revise mirror list Add an extra one from https://gcc.gnu.org/mirrors.html, and comment out old ones that don't seem to be keeping up with current releases --- pkgs/build-support/fetchurl/mirrors.nix | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix index 5d7ebc7cd87b..ba78f36a17c0 100644 --- a/pkgs/build-support/fetchurl/mirrors.nix +++ b/pkgs/build-support/fetchurl/mirrors.nix @@ -53,10 +53,13 @@ ]; # GCC + # The commented out ones don't seem to be keeping up with the latest releases + # as of 2026-07-07 they don't have tarballs for 14.4 or 15.3 gcc = [ - "https://mirror.koddos.net/gcc/" - "https://bigsearcher.com/mirrors/gcc/" - "ftp://ftp.nluug.nl/mirror/languages/gcc/" + # "https://mirror.koddos.net/gcc/" + # "https://bigsearcher.com/mirrors/gcc/" + "https://mirrorservice.org/sites/sourceware.org/pub/gcc/" + # "ftp://ftp.nluug.nl/mirror/languages/gcc/" "ftp://ftp.fu-berlin.de/unix/languages/gcc/" "ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/" "ftp://gcc.gnu.org/pub/gcc/"