From 481208bdff2dc2f61d4f4fde51e6bd2a939f7d68 Mon Sep 17 00:00:00 2001 From: zinzilulo <214774502+zinzilulo@users.noreply.github.com> Date: Wed, 27 May 2026 17:47:18 +0100 Subject: [PATCH] cc-wrapper, gcc, gnat, gnat-bootstrap: fix GCC 13 and GNAT 13/14/15 builds on darwin --- pkgs/build-support/cc-wrapper/default.nix | 8 +- .../compilers/gcc/common/configure-flags.nix | 19 +- .../compilers/gcc/common/dependencies.nix | 3 +- pkgs/development/compilers/gcc/default.nix | 14 +- .../13/gnat13-aarch64-darwin-trampoline.patch | 202 ++++++++++++++++++ .../compilers/gcc/patches/default.nix | 24 ++- .../gnat-darwin-dylib-install-name-13.patch | 18 -- .../compilers/gnat-bootstrap/default.nix | 19 +- pkgs/top-level/all-packages.nix | 37 ++-- 9 files changed, 278 insertions(+), 66 deletions(-) create mode 100644 pkgs/development/compilers/gcc/patches/13/gnat13-aarch64-darwin-trampoline.patch delete mode 100644 pkgs/development/compilers/gcc/patches/gnat-darwin-dylib-install-name-13.patch diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 3c30f5cd308e..d14dea8b7f60 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -27,6 +27,7 @@ isGNU ? false, isClang ? cc.isClang or false, isFlang ? cc.isFlang or false, + isAlireGNAT ? false, isZig ? cc.isZig or false, isArocc ? cc.isArocc or false, isCcache ? cc.isCcache or false, @@ -721,7 +722,7 @@ stdenvNoCC.mkDerivation { touch "$out/nix-support/libc-cflags" touch "$out/nix-support/libc-ldflags" '' - + optionalString (!isArocc) '' + + optionalString (!isArocc && !(isAlireGNAT && targetPlatform.isDarwin)) '' echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-crt1-cflags '' + '' @@ -796,7 +797,9 @@ stdenvNoCC.mkDerivation { # ${cc_solib}/lib64 (even though it does actually search there...).. # This confuses libtool. So add it to the compiler tool search # path explicitly. - + optionalString (!nativeTools && !isArocc) '' + # Injecting CFlags and LDFlags causes duplicate rpath at linking + # stage for Alire GNAT. Skip adding flags here. + + optionalString (!nativeTools && !isArocc && !isAlireGNAT) '' ccLDFlags=() ccCFlags=() if [ -e "${cc_solib}/lib64" -a ! -L "${cc_solib}/lib64" ]; then @@ -811,7 +814,6 @@ stdenvNoCC.mkDerivation { touch "$out/nix-support/gnat-cflags" touch "$out/nix-support/gnat-ldflags" basePath=$(echo $cc/lib/*/*/*) - ccCFlags+=("-B$basePath" "-I$basePath/adainclude") gnatCFlags="-I$basePath/adainclude -I$basePath/adalib" echo "$gnatCFlags" >> $out/nix-support/gnat-cflags diff --git a/pkgs/development/compilers/gcc/common/configure-flags.nix b/pkgs/development/compilers/gcc/common/configure-flags.nix index 66099c229743..d7b9344574f1 100644 --- a/pkgs/development/compilers/gcc/common/configure-flags.nix +++ b/pkgs/development/compilers/gcc/common/configure-flags.nix @@ -8,7 +8,9 @@ threadsCross, version, - apple-sdk, + is13, + apple-sdk_14, + apple-sdk_15, binutils, gmp, mpfr, @@ -53,6 +55,8 @@ let targetPlatform ; + appleSdk = if langAda && !is13 then apple-sdk_15 else apple-sdk_14; + # See https://github.com/NixOS/nixpkgs/pull/209870#issuecomment-1500550903 disableBootstrap' = disableBootstrap && !langFortran && !langGo; @@ -159,12 +163,11 @@ let # gcc builds for cross-compilers (build != host) or cross-built # gcc (host != target) always apply the offset prefix to disentangle # target headers from build or host headers: - # ${with_build_sysroot}${native_system_header_dir} - # or ${test_exec_prefix}/${target_noncanonical}/sys-include - # or ${with_sysroot}${native_system_header_dir} + # ${with_sysroot}${native_system_header_dir} + # and ${with_build_sysroot}${native_system_header_dir} # While native build (build == host == target) uses passed headers # path as is: - # ${with_build_sysroot}${native_system_header_dir} + # ${with_sysroot}${native_system_header_dir} # # Nixpkgs uses flat directory structure for both native and cross # cases. As a result libc headers don't get found for cross case @@ -175,10 +178,14 @@ let # We pick "/" path to effectively avoid sysroot offset and make it work # as a native case. # Darwin requires using the SDK as the sysroot for `SDKROOT` to work correctly. - "--with-build-sysroot=${if targetPlatform.isDarwin then apple-sdk.sdkroot else "/"}" + "--with-build-sysroot=${if targetPlatform.isDarwin then appleSdk.sdkroot else "/"}" # Same with the stdlibc++ headers embedded in the gcc output "--with-gxx-include-dir=${placeholder "out"}/include/c++/${version}/" ] + ++ lib.optionals (!withoutTargetLibc && targetPlatform.isDarwin && !crossDarwin) [ + # Building on Darwin often requires --with-sysroot. + "--with-sysroot=${appleSdk.sdkroot}" + ] # Basic configuration ++ [ diff --git a/pkgs/development/compilers/gcc/common/dependencies.nix b/pkgs/development/compilers/gcc/common/dependencies.nix index 9d8feadde99e..105fac5fe094 100644 --- a/pkgs/development/compilers/gcc/common/dependencies.nix +++ b/pkgs/development/compilers/gcc/common/dependencies.nix @@ -2,6 +2,7 @@ lib, stdenv, version, + is13, buildPackages, targetPackages, texinfo, @@ -43,9 +44,9 @@ in nativeBuildInputs = [ texinfo which - gettext autoconf269 ] + ++ optionals (!is13) [ gettext ] ++ optionals (perl != null) [ perl ] ++ optionals (with stdenv.targetPlatform; isVc4 || isRedox || isSnapshot && flex != null) [ flex ] ++ optionals langAda [ gnat-bootstrap ] diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 615cd2b3b19a..3012bccba8d7 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -58,7 +58,8 @@ nukeReferences, callPackage, majorMinorVersion, - apple-sdk, + apple-sdk_14, + apple-sdk_15, darwin, }: @@ -84,6 +85,8 @@ let majorVersion = versions.major version; is13 = majorVersion == "13"; + appleSdk = if langAda && !is13 then apple-sdk_15 else apple-sdk_14; + # releases have a form: MAJOR.MINOR.MICRO, like 14.2.1 # snapshots have a form like MAJOR.MINOR.MICRO.DATE, like 14.2.1.20250322 isSnapshot = lib.length (lib.splitVersion version) == 4; @@ -127,7 +130,8 @@ let ; # inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc${majorVersion}.cc.override)" | jq '.[]' --raw-output' inherit - apple-sdk + apple-sdk_14 + apple-sdk_15 autoconf269 binutils buildPackages @@ -149,6 +153,7 @@ let gnat-bootstrap gnused isl + is13 langAda langC langCC @@ -375,6 +380,11 @@ pipe NIX_LDFLAGS = optionalString hostPlatform.isSunOS "-lm"; + # Override isysroot for GNAT on Darwin due to SDK version sensitivity; GNAT 14+ requires Apple SDK 15 or later. + NIX_CFLAGS_COMPILE = optionalString ( + hostPlatform.isDarwin && langAda + ) "-isysroot ${appleSdk.sdkroot}"; + inherit (callFile ./common/extra-target-flags.nix { }) EXTRA_FLAGS_FOR_TARGET EXTRA_LDFLAGS_FOR_TARGET diff --git a/pkgs/development/compilers/gcc/patches/13/gnat13-aarch64-darwin-trampoline.patch b/pkgs/development/compilers/gcc/patches/13/gnat13-aarch64-darwin-trampoline.patch new file mode 100644 index 000000000000..2065a90d136a --- /dev/null +++ b/pkgs/development/compilers/gcc/patches/13/gnat13-aarch64-darwin-trampoline.patch @@ -0,0 +1,202 @@ +From a41f0707bdcc9fb6dab39eb8ce7e392138d16dc0 Mon Sep 17 00:00:00 2001 +From: zinzilulo <214774502+zinzilulo@users.noreply.github.com> +Date: Wed, 27 May 2026 18:25:14 +0100 +Subject: [PATCH] Allow GNAT 13 bootstrap on aarch64-darwin with nested + trampoline symbol mismatch + +This patch renames nested function trampoline helper symbols from the +__gcc_* namespace to __builtin_* across GCC and libgcc in order to allow +GNAT 13 to build on aarch64-darwin under bootstrap constraints where the +prebuilt stage1 compiler does not provide the newer symbol set. + +The change updates builtin definitions, Darwin export lists, +documentation, +and libgcc implementations of the heap trampoline hooks used by +-ftrampoline-impl=heap. + +This is a bootstrap compatibility workaround to bridge the ABI mismatch +between the Alire/GNAT-FSF-build GNAT 13.2.0-2 compiler and the +IainS/gcc-13-branch 13.4-darwin-r0 source tree. +--- + gcc/builtins.def | 4 ++-- + gcc/config/darwin.h | 8 ++++---- + gcc/doc/invoke.texi | 4 ++-- + gcc/tree.cc | 8 ++++---- + libgcc/config/aarch64/heap-trampoline.c | 8 ++++---- + libgcc/config/i386/heap-trampoline.c | 8 ++++---- + libgcc/libgcc-std.ver.in | 4 ++-- + libgcc/libgcc2.h | 4 ++-- + 8 files changed, 24 insertions(+), 24 deletions(-) + +diff --git a/gcc/builtins.def b/gcc/builtins.def +index 448cf837ec8..5bf4769ae47 100644 +--- a/gcc/builtins.def ++++ b/gcc/builtins.def +@@ -1067,8 +1067,8 @@ DEF_BUILTIN_STUB (BUILT_IN_ADJUST_TRAMPOLINE, "__builtin_adjust_trampoline") + DEF_BUILTIN_STUB (BUILT_IN_INIT_DESCRIPTOR, "__builtin_init_descriptor") + DEF_BUILTIN_STUB (BUILT_IN_ADJUST_DESCRIPTOR, "__builtin_adjust_descriptor") + DEF_BUILTIN_STUB (BUILT_IN_NONLOCAL_GOTO, "__builtin_nonlocal_goto") +-DEF_EXT_LIB_BUILTIN (BUILT_IN_GCC_NESTED_PTR_CREATED, "__gcc_nested_func_ptr_created", BT_FN_VOID_PTR_PTR_PTR, ATTR_NOTHROW_LIST) +-DEF_EXT_LIB_BUILTIN (BUILT_IN_GCC_NESTED_PTR_DELETED, "__gcc_nested_func_ptr_deleted", BT_FN_VOID, ATTR_NOTHROW_LIST) ++DEF_EXT_LIB_BUILTIN (BUILT_IN_GCC_NESTED_PTR_CREATED, "__builtin_nested_func_ptr_created", BT_FN_VOID_PTR_PTR_PTR, ATTR_NOTHROW_LIST) ++DEF_EXT_LIB_BUILTIN (BUILT_IN_GCC_NESTED_PTR_DELETED, "__builtin_nested_func_ptr_deleted", BT_FN_VOID, ATTR_NOTHROW_LIST) + + /* Implementing __builtin_setjmp. */ + DEF_BUILTIN_STUB (BUILT_IN_SETJMP_SETUP, "__builtin_setjmp_setup") +diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h +index 0cc6f021365..47bca6f1db1 100644 +--- a/gcc/config/darwin.h ++++ b/gcc/config/darwin.h +@@ -433,10 +433,10 @@ extern GTY(()) int darwin_ms_struct; + ___emutls_get_address -exported_symbol ___emutls_get_address \ + -U ___emutls_register_common \ + -exported_symbol ___emutls_register_common \ +- -U ___gcc_nested_func_ptr_created \ +- -exported_symbol ___gcc_nested_func_ptr_created \ +- -U ___gcc_nested_func_ptr_deleted \ +- -exported_symbol ___gcc_nested_func_ptr_deleted \ ++ -U ___builtin_nested_func_ptr_created \ ++ -exported_symbol ___builtin_nested_func_ptr_created \ ++ -U ___builtin_nested_func_ptr_deleted \ ++ -exported_symbol ___builtin_nested_func_ptr_deleted \ + }} \ + }}}\ + %{!r:%{!nostdlib:%{!nostartfiles:%E}}} %{T*} %{F*} "\ +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index 8f82ba0ecfa..4d5bba42fcd 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -18718,8 +18718,8 @@ for nested functions. + By default, trampolines are generated on stack. However, certain platforms + (such as the Apple M1) do not permit an executable stack. Compiling with + @option{-ftrampoline-impl=heap} generate calls to +-@code{__gcc_nested_func_ptr_created} and +-@code{__gcc_nested_func_ptr_deleted} in order to allocate and ++@code{__builtin_nested_func_ptr_created} and ++@code{__builtin_nested_func_ptr_deleted} in order to allocate and + deallocate trampoline space on the executable heap. These functions are + implemented in libgcc, and will only be provided on specific targets: + x86_64 Darwin, x86_64 and aarch64 Linux. @emph{PLEASE NOTE}: Heap +diff --git a/gcc/tree.cc b/gcc/tree.cc +index 032b87ee1c8..54abc791c88 100644 +--- a/gcc/tree.cc ++++ b/gcc/tree.cc +@@ -9874,17 +9874,17 @@ build_common_builtin_nodes (void) + ptr_type_node, // void *func + ptr_ptr_type_node, // void **dst + NULL_TREE); +- local_define_builtin ("__builtin___gcc_nested_func_ptr_created", ftype, ++ local_define_builtin ("__builtin___builtin_nested_func_ptr_created", ftype, + BUILT_IN_GCC_NESTED_PTR_CREATED, +- "__gcc_nested_func_ptr_created", ECF_NOTHROW); ++ "__builtin_nested_func_ptr_created", ECF_NOTHROW); + } + + if (!builtin_decl_explicit_p (BUILT_IN_GCC_NESTED_PTR_DELETED)) + { + ftype = build_function_type_list (void_type_node, NULL_TREE); +- local_define_builtin ("__builtin___gcc_nested_func_ptr_deleted", ftype, ++ local_define_builtin ("__builtin___builtin_nested_func_ptr_deleted", ftype, + BUILT_IN_GCC_NESTED_PTR_DELETED, +- "__gcc_nested_func_ptr_deleted", ECF_NOTHROW); ++ "__builtin_nested_func_ptr_deleted", ECF_NOTHROW); + } + + ftype = build_function_type_list (void_type_node, +diff --git a/libgcc/config/aarch64/heap-trampoline.c b/libgcc/config/aarch64/heap-trampoline.c +index b2c69aa5892..2e47cf56dc6 100644 +--- a/libgcc/config/aarch64/heap-trampoline.c ++++ b/libgcc/config/aarch64/heap-trampoline.c +@@ -26,8 +26,8 @@ int get_trampolines_per_page (void); + struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); + void *allocate_trampoline_page (void); + +-void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst); +-void __gcc_nested_func_ptr_deleted (void); ++void __builtin_nested_func_ptr_created (void *chain, void *func, void **dst); ++void __builtin_nested_func_ptr_deleted (void); + + #if defined(__linux__) + static const unsigned char aarch64_trampoline_insns[6][4] = { +@@ -115,7 +115,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_data *parent) + + HEAP_T_ATTR + void +-__gcc_nested_func_ptr_created (void *chain, void *func, void **dst) ++__builtin_nested_func_ptr_created (void *chain, void *func, void **dst) + { + if (tramp_ctrl_curr == NULL) + { +@@ -163,7 +163,7 @@ __gcc_nested_func_ptr_created (void *chain, void *func, void **dst) + + HEAP_T_ATTR + void +-__gcc_nested_func_ptr_deleted (void) ++__builtin_nested_func_ptr_deleted (void) + { + if (tramp_ctrl_curr == NULL) + abort (); +diff --git a/libgcc/config/i386/heap-trampoline.c b/libgcc/config/i386/heap-trampoline.c +index 2e8df1cfbd2..34aace2b5a6 100644 +--- a/libgcc/config/i386/heap-trampoline.c ++++ b/libgcc/config/i386/heap-trampoline.c +@@ -26,8 +26,8 @@ int get_trampolines_per_page (void); + struct tramp_ctrl_data *allocate_tramp_ctrl (struct tramp_ctrl_data *parent); + void *allocate_trampoline_page (void); + +-void __gcc_nested_func_ptr_created (void *chain, void *func, void **dst); +-void __gcc_nested_func_ptr_deleted (void); ++void __builtin_nested_func_ptr_created (void *chain, void *func, void **dst); ++void __builtin_nested_func_ptr_deleted (void); + + #if __x86_64__ + +@@ -179,7 +179,7 @@ allocate_tramp_ctrl (struct tramp_ctrl_data *parent) + + HEAP_T_ATTR + void +-__gcc_nested_func_ptr_created (void *chain, void *func, void **dst) ++__builtin_nested_func_ptr_created (void *chain, void *func, void **dst) + { + if (tramp_ctrl_curr == NULL) + { +@@ -233,7 +233,7 @@ __gcc_nested_func_ptr_created (void *chain, void *func, void **dst) + + HEAP_T_ATTR + void +-__gcc_nested_func_ptr_deleted (void) ++__builtin_nested_func_ptr_deleted (void) + { + if (tramp_ctrl_curr == NULL) + abort (); +diff --git a/libgcc/libgcc-std.ver.in b/libgcc/libgcc-std.ver.in +index ad854bf0ded..acc4e6cfab8 100644 +--- a/libgcc/libgcc-std.ver.in ++++ b/libgcc/libgcc-std.ver.in +@@ -1947,6 +1947,6 @@ GCC_7.0.0 { + + %inherit GCC_14.0.0 GCC_7.0.0 + GCC_14.0.0 { +- __gcc_nested_func_ptr_created +- __gcc_nested_func_ptr_deleted ++ __builtin_nested_func_ptr_created ++ __builtin_nested_func_ptr_deleted + } +diff --git a/libgcc/libgcc2.h b/libgcc/libgcc2.h +index a7a5dff0184..ac7eaab4f01 100644 +--- a/libgcc/libgcc2.h ++++ b/libgcc/libgcc2.h +@@ -29,8 +29,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #pragma GCC visibility push(default) + #endif + +-extern void __gcc_nested_func_ptr_created (void *, void *, void **); +-extern void __gcc_nested_func_ptr_deleted (void); ++extern void __builtin_nested_func_ptr_created (void *, void *, void **); ++extern void __builtin_nested_func_ptr_deleted (void); + + extern int __gcc_bcmp (const unsigned char *, const unsigned char *, size_t); + extern void __clear_cache (void *, void *); +-- +2.50.1 (Apple Git-155) + diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index 5be64c16ce84..048cfee9ffde 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -1,6 +1,7 @@ { lib, stdenv, + is13, langC, langAda, langObjC, @@ -139,16 +140,6 @@ optionals noSysDirs ( atLeast14 && stdenv.hostPlatform.isDarwin && langAda ) ../patches/14/gcc-darwin-remove-coreservices.patch -# 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 ]; - "13" = [ ./gnat-darwin-dylib-install-name-13.patch ]; - } - .${majorVersion} or [ ] -) - # 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. @@ -185,6 +176,19 @@ 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) ./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"; diff --git a/pkgs/development/compilers/gcc/patches/gnat-darwin-dylib-install-name-13.patch b/pkgs/development/compilers/gcc/patches/gnat-darwin-dylib-install-name-13.patch deleted file mode 100644 index 19c405d1226d..000000000000 --- a/pkgs/development/compilers/gcc/patches/gnat-darwin-dylib-install-name-13.patch +++ /dev/null @@ -1,18 +0,0 @@ ---- a/gcc/ada/gcc-interface/Makefile.in -+++ b/gcc/ada/gcc-interface/Makefile.in -@@ -788,13 +788,13 @@ 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) \ - $(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) \ - $(THREADSLIB) -Wl,libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) - cd $(RTSDIR); $(LN_S) libgnat$(hyphen)$(LIBRARY_VERSION)$(soext) \ - libgnat$(soext) diff --git a/pkgs/development/compilers/gnat-bootstrap/default.nix b/pkgs/development/compilers/gnat-bootstrap/default.nix index ef7ed876e583..fad7f427fbe6 100644 --- a/pkgs/development/compilers/gnat-bootstrap/default.nix +++ b/pkgs/development/compilers/gnat-bootstrap/default.nix @@ -65,6 +65,11 @@ stdenv.mkDerivation ( hash = "sha256-DC95udGSzRDE22ON4UpekxTYWOSBeUdJvILbSFj6MFQ="; upstreamTriplet = "x86_64-pc-linux-gnu"; }; + aarch64-darwin = { + inherit url; + hash = "sha256-Bjl6iuM2xLknezR92j/kpDYpxqTcxK1v8rffmivOAVw="; + upstreamTriplet = "aarch64-apple-darwin23.2.0"; + }; } .${stdenv.hostPlatform.system} or throwUnsupportedSystem; "14" = { @@ -87,6 +92,11 @@ stdenv.mkDerivation ( hash = "sha256-SVW/0yyj6ZH1GAjvD+unII+zSLGd3KGFt1bjjQ3SEFU="; upstreamTriplet = "aarch64-linux-gnu"; }; + aarch64-darwin = { + inherit url; + hash = "sha256-/nARwdQzAMd41fslUbrgloxn0hVZp9PokfQ9yPmL1g8="; + upstreamTriplet = "aarch64-apple-darwin23.6.0"; + }; } .${stdenv.hostPlatform.system} or throwUnsupportedSystem; }; @@ -194,7 +204,7 @@ stdenv.mkDerivation ( # [2]: https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/Fixed-Headers.html + lib.optionalString (stdenv.hostPlatform.isDarwin) '' - upstreamBuildPrefix="/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/x86_64-darwin/gcc/install" + upstreamBuildPrefix="/Users/runner/work/GNAT-FSF-builds/GNAT-FSF-builds/sbx/${stdenv.hostPlatform.system}/gcc/install" for i in "$out"/lib/*.dylib "$out"/lib/gcc/*/*/adalib/*.dylib; do if [[ -f "$i" && ! -h "$i" ]]; then install_name_tool -id "$i" "$i" || true @@ -236,7 +246,12 @@ stdenv.mkDerivation ( "x86_64-linux" "x86_64-darwin" ] - ++ lib.optionals (lib.versionAtLeast majorVersion "14") [ "aarch64-linux" ]; + ++ lib.optionals (lib.versionAtLeast majorVersion "13") [ + "aarch64-darwin" + ] + ++ lib.optionals (lib.versionAtLeast majorVersion "14") [ + "aarch64-linux" + ]; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ece4f96a5030..f43606b32c14 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3849,9 +3849,8 @@ with pkgs; stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform && stdenv.buildPlatform.isDarwin - && stdenv.buildPlatform.isx86_64 then - overrideCC stdenv gnat-bootstrap13 + overrideCC gccStdenv gnat-bootstrap13 else stdenv; } @@ -3877,9 +3876,8 @@ with pkgs; stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform && stdenv.buildPlatform.isDarwin - && stdenv.buildPlatform.isx86_64 then - overrideCC stdenv gnat-bootstrap14 + overrideCC gccStdenv gnat-bootstrap14 else stdenv; } @@ -3905,9 +3903,8 @@ with pkgs; stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform && stdenv.buildPlatform.isDarwin - && stdenv.buildPlatform.isx86_64 then - overrideCC stdenv gnat-bootstrap14 + overrideCC gccStdenv gnat-bootstrap14 else stdenv; } @@ -3933,31 +3930,23 @@ with pkgs; stdenv.hostPlatform == stdenv.targetPlatform && stdenv.buildPlatform == stdenv.hostPlatform && stdenv.buildPlatform.isDarwin - && stdenv.buildPlatform.isx86_64 then - overrideCC stdenv gnat-bootstrap14 + overrideCC gccStdenv gnat-bootstrap14 else stdenv; } ); gnat-bootstrap = gnat-bootstrap13; - gnat-bootstrap13 = wrapCCWith ( - { - cc = callPackage ../development/compilers/gnat-bootstrap { majorVersion = "13"; }; - } - // lib.optionalAttrs (stdenv.hostPlatform.isDarwin) { - bintools = bintoolsDualAs; - } - ); - gnat-bootstrap14 = wrapCCWith ( - { - cc = callPackage ../development/compilers/gnat-bootstrap { majorVersion = "14"; }; - } - // lib.optionalAttrs (stdenv.hostPlatform.isDarwin) { - bintools = bintoolsDualAs; - } - ); + gnat-bootstrap13 = wrapCCWith { + cc = callPackage ../development/compilers/gnat-bootstrap { majorVersion = "13"; }; + isAlireGNAT = true; + }; + + gnat-bootstrap14 = wrapCCWith { + cc = callPackage ../development/compilers/gnat-bootstrap { majorVersion = "14"; }; + isAlireGNAT = true; + }; gnat13Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat13; }); gnat14Packages = recurseIntoAttrs (callPackage ./ada-packages.nix { gnat = buildPackages.gnat14; });