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

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

https://gcc.gnu.org/g:9d3338579f6448dcffa6f0b818c45374f925f3d5

commit r17-5416-g9d3338579f6448dcffa6f0b818c45374f925f3d5
Author: Zhongteng Gui <[email protected]>
Date:   Sat Oct 10 01:17:17 2026 +0800

    lto, mingw: Do not export symbols from some frontends [PR115300]

    This patch works around bootstrapping on x86_64-w64-mingw32 targets with
    bootstrap-lto-lean and --enable-plugin enabled.  Note that
    i686-w64-mingw32 targets still fail with bootstrap-lto-lean even without
    --enable-plugin due to a segfault in lto1.exe.

    --enable-plugin adds -Wl,--export-all-symbols and -Wl,[email protected]
    to PLUGINLIBS on MinGW hosts, so that a plugin can resolve back into the
    compiler it is loaded by.  These options are also passed to frontends
    that do not install compiler-proper import libraries.

    With bootstrap-lto-lean, their PE export tables can exceed the 16-bit
    ordinal limit and some LTO symbols cannot be exported with their
    resulting types.

    Use the MinGW host makefile fragment to omit the plugin export options
    when linking gnat1, f951, lto1, lto-dump, cc1obj, and cc1objplus.  This
    keeps the target-specific handling out of the language-independent
    makefiles.

    Unlike the executables, libgccjit still needs its public import library.
    Generate a PE definition file from the existing libgccjit export list,
    disable automatic exports, and keep --out-implib for the public API.

    cc1 and cc1plus also still need to export their public APIs, so add
    -fno-lto to their MinGW link flags when bootstrap-lto-lean provides
    -ffat-lto-objects.  Add -ffat-lto-objects to the bootstrap-lto-lean
    configuration for MinGW targets so that cc1 and cc1plus can be linked
    with LTO objects.

            PR lto/115300

    config/ChangeLog:

            * bootstrap-lto-lean.mk (STAGE3_CFLAGS): Add -ffat-lto-objects for
            mingw targets.
            (STAGEfeedback_CFLAGS): Likewise.

    gcc/ChangeLog:

            * config/i386/x-mingw32: Avoid exporting compiler-internal symbols
            from frontends without a plugin API.  Add -fno-lto when linking
            cc1 and cc1plus with fat LTO objects.

    gcc/jit/ChangeLog:

            * Make-lang.in (LIBGCCJIT_DEF_FILE): New variable, dynamically
            generated from libgccjit.exports.
            (LIBGCCJIT_EXTRA_OPTS): Add LIBGCCJIT_DEF_FILE and disable
            automatic exports.
            (libgccjit): Add LIBGCCJIT_DEF_FILE to the link dependencies.
            (jit.mostlyclean): Remove LIBGCCJIT_DEF_FILE and its temporary
            file.

    Signed-off-by: Zhongteng Gui <[email protected]>
    Signed-off-by: Jonathan Yong <[email protected]>
  • [Bug lto/115300] gcc 14 cannot ... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to