···11+As originally implemented, the error message check
22+described in the configure script
33+breaks detection of Ada compiler support on x86_64-darwin,
44+because the assembler in the version of cctools currently used
55+unconditionally emits a deprecation message to stdout,
66+with no way to disable it.
77+88+Furthermore, GCC 3.4 was the minimum version needed to build GNAT
99+as far back as GCC 4.4 (see the GCC git repo, tags/releases/gcc-4.4.0,
1010+gcc/doc/install.texi, lines 2052-2053 [1]);
1111+GCC 3.4 is newer than any of the broken GCC versions
1212+that the configure script works around
1313+(see the part of the comment in the configure script
1414+before the context in the patch below),
1515+and GCC 4.4 is older than any GCC that Nix currently packages (GCC 4.8).
1616+1717+We therefore choose to not check for error messages,
1818+and just check for an error code.
1919+There's no harm in still checking for an object file being created, though.
2020+2121+[1]: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/doc/install.texi;h=6bdfbece981f7fb6c26da672d45e5d3ba7879c69;hb=b7fc996728085c0591ea7c5d0e1c84a8f6a29bd8#l2052
2222+--- a/configure 2022-08-19 18:09:52.000000000 +1000
2323++++ b/configure 2022-12-26 17:30:49.000000000 +1100
2424+@@ -5622,8 +5622,7 @@
2525+ # Other compilers, like HP Tru64 UNIX cc, exit successfully when
2626+ # given a .adb file, but produce no object file. So we must check
2727+ # if an object file was really produced to guard against this.
2828+-errors=`(${CC} -c conftest.adb) 2>&1 || echo failure`
2929+-if test x"$errors" = x && test -f conftest.$ac_objext; then
3030++if ${CC} -c conftest.adb && test -f conftest.$ac_objext; then
3131+ acx_cv_cc_gcc_supports_ada=yes
3232+ fi
3333+ rm -f conftest.*
···11-{ lib, version, hostPlatform, targetPlatform
11+{ lib, version, buildPlatform, hostPlatform, targetPlatform
22, gnatboot ? null
33, langAda ? false
44, langJava ? false
···2222 export lib=$out;
2323'' + lib.optionalString langAda ''
2424 export PATH=${gnatboot}/bin:$PATH
2525+''
2626+2727+# On x86_64-darwin, the gnatboot bootstrap compiler that we need to build a
2828+# native GCC with Ada support emits assembly that is accepted by the Clang
2929+# integrated assembler, but not by the GNU assembler in cctools-port that Nix
3030+# usually in the x86_64-darwin stdenv. In particular, x86_64-darwin gnatboot
3131+# emits MOVQ as the mnemonic for quadword interunit moves, such as between XMM
3232+# and general registers (e.g "movq %xmm0, %rbp"); the cctools-port assembler,
3333+# however, only recognises MOVD for such moves.
3434+#
3535+# Therefore, for native x86_64-darwin builds that support Ada, we have to use
3636+# the Clang integrated assembler to build (at least stage 1 of) GCC, but have to
3737+# target GCC at the cctools-port GNU assembler. In the wrapped x86_64-darwin
3838+# gnatboot, the former is provided as `as`, while the latter is provided as
3939+# `gas`.
4040+#
4141++ lib.optionalString (
4242+ langAda
4343+ && buildPlatform == hostPlatform
4444+ && hostPlatform == targetPlatform
4545+ && targetPlatform.isx86_64
4646+ && targetPlatform.isDarwin
4747+ ) ''
4848+ export AS_FOR_BUILD=${gnatboot}/bin/as
4949+ export AS_FOR_TARGET=${gnatboot}/bin/gas
2550''
26512752# NOTE 2020/3/18: This environment variable prevents configure scripts from