gcc16, gccgo16, gfortran16, gnat16: init at 16.1.0

Changes: https://gcc.gnu.org/gcc-16/changes.html
Porting guide: https://gcc.gnu.org/gcc-16/porting_to.html

Added logic to avoid evaluation of gnatprove on gnat16, as it isn't
ported to that compiler version yet.

Co-authored-by: sempiternal-aurora <78790545+sempiternal-aurora@users.noreply.github.com>
This commit is contained in:
Sergei Trofimovich
2026-04-30 21:00:58 +01:00
committed by sempiternal-aurora
parent 4f10ad5174
commit 5af8e1ffe0
5 changed files with 77 additions and 4 deletions

View File

@@ -0,0 +1,10 @@
{ wrapCC, gcc16 }:
wrapCC (
gcc16.cc.override {
name = "gfortran";
langFortran = true;
langCC = false;
langC = false;
profiledCompiler = false;
}
)

View File

@@ -58,6 +58,16 @@ optionals noSysDirs (
]
++ (
{
"16" = [
# Do not try looking for binaries and libraries in /lib and /usr/lib
./13/no-sys-dirs-riscv.patch
# Mangle the nix store hash in __FILE__ to prevent unneeded runtime references
#
# TODO: Remove these and the `useMacroPrefixMap` conditional
# in `cc-wrapper` once <https://gcc.gnu.org/PR111527>
# is fixed.
./13/mangle-NIX_STORE-in-__FILE__.patch
];
"15" = [
# Do not try looking for binaries and libraries in /lib and /usr/lib
./13/no-sys-dirs-riscv.patch

View File

@@ -1,5 +1,6 @@
let
majorMinorToVersionMap = {
"16" = "16.1.0";
"15" = "15.2.0";
"14" = "14.3.0";
"13" = "13.4.0";
@@ -13,6 +14,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=";
"14.3.0" = "sha256-4Nx3KXYlYxrI5Q+pL//v6Jmk63AlktpcMu8E4ik6yjo=";
"13.4.0" = "sha256-nEzm27BAVo/cVFWIrAPFy8lajb8MeqSQFwhDr7WcqPU=";

View File

@@ -21,9 +21,14 @@ makeScopeWithSplicing' {
xmlada = self.callPackage ../development/ada-modules/xmlada { };
gnatprove = self.callPackage ../development/ada-modules/gnatprove {
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14;
};
gnatprove =
# They haven't released a version of gnatprove for gnat16 yet
if lib.versionOlder gnat.version "16" then
self.callPackage ../development/ada-modules/gnatprove {
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_14;
}
else
null;
gnatcoll-core = self.callPackage ../development/ada-modules/gnatcoll/core.nix { };

View File

@@ -3739,6 +3739,7 @@ with pkgs;
gcc13Stdenv = overrideCC gccStdenv buildPackages.gcc13;
gcc14Stdenv = overrideCC gccStdenv buildPackages.gcc14;
gcc15Stdenv = overrideCC gccStdenv buildPackages.gcc15;
gcc16Stdenv = overrideCC gccStdenv buildPackages.gcc16;
# This is not intended for use in nixpkgs but for providing a faster-running
# compiler to nixpkgs users by building gcc with reproducibility-breaking
@@ -3841,9 +3842,10 @@ with pkgs;
gcc13
gcc14
gcc15
gcc16
;
gcc_latest = gcc15;
gcc_latest = gcc16;
libgccjit = gcc.cc.override {
name = "libgccjit";
@@ -3941,6 +3943,34 @@ with pkgs;
}
);
gnat16 = wrapCC (
gcc16.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-bootstrap14
else
buildPackages.gnat16;
stdenv =
if
stdenv.hostPlatform == stdenv.targetPlatform
&& stdenv.buildPlatform == stdenv.hostPlatform
&& stdenv.buildPlatform.isDarwin
&& stdenv.buildPlatform.isx86_64
then
overrideCC stdenv gnat-bootstrap14
else
stdenv;
}
);
gnat-bootstrap = gnat-bootstrap13;
gnat-bootstrap13 = wrapCCWith (
{
@@ -3962,6 +3992,7 @@ with pkgs;
gnat13Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat13; });
gnat14Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat14; });
gnat15Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat15; });
gnat16Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat16; });
gnatPackages = gnat13Packages;
inherit (gnatPackages)
@@ -4029,6 +4060,21 @@ with pkgs;
}
);
gccgo16 = wrapCC (
gcc16.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-mcode = ghdl.override { backend = "mcode"; };
ghdl-gcc = ghdl.override { backend = "gcc"; };