https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126847
--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Gaius Mulley <[email protected]>: https://gcc.gnu.org/g:11563ac4fd011000a77998496215336689e93a21 commit r16-9943-g11563ac4fd011000a77998496215336689e93a21 Author: Gaius Mulley <[email protected]> Date: Thu Nov 12 12:00:16 2026 +0000 [PATCH] PR modula2/125129: Many tests fail to link on FreeBSD This patch combines a series of patches starting with the above title. The squashing contains all the fixup patches for the original large patch. The fixups detect whether we have a Python3 interpreter and use posix shell commands. Not all targets have csin[l], ccos[l] and ctan[l]. On such systems the ISO libraries should be pruned thus allowing compile time failures for source which explicitly requests these intrinsics rather than universally fail on linking. This patch introduces a new tool mktargetsrc which will generate target versions of the Modula-2 libraries. The patch also introduces -fdump-builtins (an internal option) which is used by mktargetsrc. mktargetsrc replaces makeSystem and mktargetsrc improves the formatting of the autogenerated SYSTEM.def files. Bootstrapped on x86_64 Debian and FreeBSD15 and all regression tests pass. The original commits were: b3275d4a1f199872dffd9df4967673722f270671 dc80afc49b7a0eddaf2152379971e36d4d2bf953 e8de2a38c2c9bce2e1b8f94c5f263da57fefba79 dec6b80c937ebe580d81c0a6441dd3d0f668c50e 3f80e7f62a7796b925df3db1b4a31ae832f4d65e 781bfbc518c63e7b1431bf733d5a814ac1bf4e21 7939b2df31ca866332f10bdbab1a32e4828e7468 b1d85e7f8ef2bd152763bbccf1c280ad4ee10ed4 ce6480029c2bcc78e051a02e557bcfca2ec75477 gcc/ChangeLog: PR modula2/125129 * doc/gm2.texi (-fdump-builtins): New switch. gcc/m2/ChangeLog: PR modula2/126911 PR modula2/125129 * Make-lang.in (escape_path): New define. (RSTSRC): Remove. (gm2-libs.texi-check): Rewrite without $(objdir). (m2/gm2-libs.rst): Remove. (gm2-ebnf.rst): Ditto. (gm2-ebnf.rst-check): Ditto. (SYSTEM-pim-texi-check): Ditto. (m2/SYSTEM-pim.rst): Ditto. (m2/SYSTEM-iso.texi): Rewrite without $(objdir). (Builtins.texi-check): Rewrite specifying $(srcdir). (m2/Builtins.rst): Remove. (MC_ARGS): Add -I$(srcdir)/m2/gm2-libs-pim-common and -I$(srcdir)/m2/mc-boot-ch. (m2/mc-boot/$(SRC_PREFIX)%.o): Add -I$(srcdir)/m2/mc-boot-ch. (m2/mc-boot-ch/$(SRC_PREFIX)%.o): Ditto. (MC_BOOT_INCLUDES): New define. (m2/gm2-libs-boot/UnixArgs.o): Add MC_BOOT_INCLUDES. (m2/gm2-libs-boot/choosetemp.o): Ditto. (m2/gm2-libs-boot/errno.o): Ditto. (m2/gm2-libs-boot/dtoa.o): Ditto. (m2/gm2-libs-boot/ldtoa.o): Ditto. (m2/gm2-libs-boot/termios.o): Ditto. (m2/gm2-libs-boot/SysExceptions.o): Ditto. (m2/gm2-libs-boot/SysStorage.o): Ditto. (m2/gm2-libs/Builtins.def): Rewrite. (m2/gm2-libs/Builtins.mod): Ditto. (m2/gm2-libs/%.o): Ditto. * gm2-compiler/M2Options.def (SetDumpBuiltins): New procedure. (GetDumpBuiltins): New procedure function. * gm2-compiler/M2Options.mod (DumpBuiltinsFlag): New variable. (SetDumpBuiltins): Implement new procedure. (GetDumpBuiltins): Implement new procedure function. * gm2-compiler/M2Quads.mod (BuildComponentValue): Removed unused variable virtpos. * gm2-gcc/m2builtins.cc (GM2_BUG_REPORT): Reformat. (ASSERT): Ditto. (ERROR): Ditto. (dump_available): New function. (define_builtin): Call dump_available if GetDumpBuiltins is set. (dump_builtin): New function. (m2builtins_init): Call dump_builtin. * gm2-gcc/m2options.h (M2Options_SetDumpBuiltins): New prototype. (M2Options_GetDumpBuiltins): Ditto. * gm2-lang.cc (gm2_langhook_handle_option): Add OPT_fdump_builtins case. * gm2-libs-coroutines/SYSTEM.def: Move to... * gm2-libs-cor-common/SYSTEM.def: ...here. * gm2-libs-coroutines/SYSTEM.mod: Move to... * gm2-libs-cor-common/SYSTEM.mod: ...here. * gm2-libs-iso/ComplexMath.def: Move to... * gm2-libs-iso-common/ComplexMath.def: ...here. * gm2-libs-iso/ComplexMath.mod: Move to... * gm2-libs-iso-common/ComplexMath.mod: ...here. * gm2-libs-iso/LongComplexMath.def: Move to... * gm2-libs-iso-common/LongComplexMath.def: ...here. * gm2-libs-iso/LongComplexMath.mod: Move to... * gm2-libs-iso-common/LongComplexMath.mod: ...here. * gm2-libs-iso/SYSTEM.def: Move to... * gm2-libs-iso-common/SYSTEM.def: ...here. * gm2-libs-iso/SYSTEM.mod: Move to... * gm2-libs-iso-common/SYSTEM.mod: ...here. * gm2-libs-iso/ShortComplexMath.def: Move to... * gm2-libs-iso-common/ShortComplexMath.def: ...here. * gm2-libs-iso/ShortComplexMath.mod: Move to... * gm2-libs-iso-common/ShortComplexMath.mod: ...here. * gm2-libs-min/SYSTEM.def: * gm2-libs/Builtins.def: Move to... * gm2-libs-pim-common/Builtins.def: ...here. * gm2-libs/Builtins.mod: Move to... * gm2-libs-pim-common/Builtins.mod: ...here. * gm2-libs/SYSTEM.def: Move to... * gm2-libs-pim-common/SYSTEM.def: ...here. * gm2-libs/SYSTEM.mod: Move to... * gm2-libs-pim-common/SYSTEM.mod: ...here. * gm2-libs/cbuiltin.def: Move to... * gm2-libs-pim-common/cbuiltin.def: ...here. * lang.opt (fdump-builtins): Add. * tools-src/def2doc.py: Modified to process tags. * tools-src/makeSystem: Modified to reflect new tags. Replace echo with printf equivalent. * tools-src/mktargetsrc.py: New file. * gm2spec.cc (lang_specific_driver): Comment formatting. libgm2/ChangeLog: PR modula2/126847 PR modula2/125129 PR modula2/126863 PR modula2/125129 PR modula2/127359 * Makefile.am (AM_MAKEFLAGS): Add HAVE_PYTHON_INTERPRETER. * Makefile.in: Regenerate. * aclocal.m4: Regenerate. * configure.ac: Call AC_PYTHON_INTERPRETER. Remove call to AC_PYTHON_DEVEL. * libm2cor/Makefile.in: Regenerate. * libm2iso/Makefile.in: Regenerate. * libm2log/Makefile.in: Regenerate. * libm2min/Makefile.in: Regenerate. * libm2pim/Makefile.in: Regenerate. * libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Add gm2-libs-cor-common and pathname. Replace bash with $(SHELL). (SYSTEM.def): Rewrite rule. (SYSTEM.mod): Copy common file. * libm2iso/Makefile.am (AM_MAKEFLAGS): Add HAVE_PYTHON_INTERPRETER. (libm2iso_la_CFLAGS): Add m2pim pathname and ../libm2pim to include path. * libm2log/Makefile.am: Rewrite to handle HAVE_PYTHON_INTERPRETER. Falling back to the common versions of target sources if HAVE_PYTHON_INTERPRETER is false. * libm2min/Makefile.am: Ditto. * libm2pim/Makefile.am: Ditto. * ax_python_interpreter.m4: New file. gcc/testsuite/ChangeLog: PR modula2/125129 * gm2/exceptions/run/pass/exceptions-run-pass.exp: Use gm2_target_compiler rather than target_compile. * lib/gm2.exp (gm2_target_compile_default): Check check_effective_target_pie and append -fPIE if necessary. Signed-off-by: Gaius Mulley <[email protected]>
