https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125129

--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Gaius Mulley <[email protected]>:

https://gcc.gnu.org/g:b3275d4a1f199872dffd9df4967673722f270671

commit r17-3227-gb3275d4a1f199872dffd9df4967673722f270671
Author: Gaius Mulley <[email protected]>
Date:   Wed Aug 12 13:16:28 2026 +0100

    PR modula2/125129: Many tests fail to link on FreeBSD

    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 which is used by mktargetsrc.  mktargetsrc
    replaces makeSystem and mktargetsrc improves the formatting of the
    autogenerated SYSTEM.def files.
    Bootstrapped on x86_64 Debian, FreeBSD15 and ppc64le GNU/Linux.

    gcc/ChangeLog:

            PR modula2/125129
            * doc/gm2.texi (-fdump-builtins): New switch.

    gcc/m2/ChangeLog:

            PR modula2/125129
            * Make-lang.in (escape_path): New define.
            (GM2_FOR_TARGET_ESC): 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/SYSTEM.def): Ditto.
            (m2/gm2-libs-iso/SYSTEM.def): Ditto.
            (m2/gm2-libs-coroutines/SYSTEM.def): 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 funmction.
            (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.
            Add tags.
            * gm2-libs-iso/ComplexMath.mod: Move to...
            * gm2-libs-iso-common/ComplexMath.mod: ...here.
            Add tags.
            * gm2-libs-iso/LongComplexMath.def: Move to...
            * gm2-libs-iso-common/LongComplexMath.def: ...here.
            Add tags.
            * gm2-libs-iso/LongComplexMath.mod: Move to...
            * gm2-libs-iso-common/LongComplexMath.mod: ...here.
            Add tags.
            * gm2-libs-iso/SYSTEM.def: Move to...
            * gm2-libs-iso-common/SYSTEM.def: ...here.
            Add tags.
            * gm2-libs-iso/SYSTEM.mod: Move to...
            * gm2-libs-iso-common/SYSTEM.mod: ...here.
            Add tags.
            * gm2-libs-iso/ShortComplexMath.def: Move to...
            * gm2-libs-iso-common/ShortComplexMath.def: ...here.
            Add tags.
            * gm2-libs-iso/ShortComplexMath.mod: Move to...
            * gm2-libs-iso-common/ShortComplexMath.mod: ...here.
            Add tags.
            * gm2-libs/Builtins.def: Move to...
            * gm2-libs-pim-common/Builtins.def: ...here.
            Add tags.
            * gm2-libs/Builtins.mod: Move to...
            * gm2-libs-pim-common/Builtins.mod: ...here.
            Add tags.
            * gm2-libs/SYSTEM.def: Move to...
            * gm2-libs-pim-common/SYSTEM.def: ...here.
            Add tags.
            * gm2-libs/SYSTEM.mod: Move to...
            * gm2-libs-pim-common/SYSTEM.mod: ...here.
            Add tags.
            * gm2-libs/cbuiltin.def: Move to...
            * gm2-libs-pim-common/cbuiltin.def: ...here.
            Add tags.
            * gm2-libs-min/SYSTEM.def: Add tags.
            * lang.opt (fdump-builtins): Add.
            * tools-src/def2doc.py: Modified to process tags.
            * tools-src/makeSystem: Modified to reflect new tags.
            * tools-src/mktargetsrc.py: New file.

    libgm2/ChangeLog:

            PR modula2/125129
            * Makefile.am (GM2_FOR_TARGET_ESC): New define.
            (AM_MAKEFLAGS): Add GM2_FOR_TARGET_ESC.
            Add HAVE_PYTHON_INTERPRETER.
            * Makefile.in: Regenerate.
            * aclocal.m4: Regenerate.
            * config.h.in: Regenerate.
            * configure: Regenerate.
            * configure.ac: Call AC_PYTHON_DEVEL.
            Call GCC_PICFLAG.
            * libm2cor/Makefile.am (libm2cor_la_M2FLAGS): Add
            gm2-libs-cor-common and pathname.
            (SYSTEM.def): Rewrite rule.
            (SYSTEM.mod): Copy common file.
            * libm2cor/Makefile.in: Regenerate.
            * libm2iso/Makefile.am (AM_MAKEFLAGS): Add GM2_FOR_TARGET_ESC.
            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.
            * libm2iso/Makefile.in: Regenerate.
            * libm2log/Makefile.in: Regenerate.
            * libm2min/Makefile.in: Regenerate.
            * libm2pim/Makefile.in: Regenerate.
            * ax_python_devel.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]>

Reply via email to