[Bug lto/115300] gcc 14 cannot compile itself on Windows when bootstrap-lto is specified

tanksherman27 at gmail dot com via Gcc-bugs <[email protected]> Wed, 05 Aug 2026 07:11:56 +0000
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115300

--- Comment #7 from Julian Waters <tanksherman27 at gmail dot com> ---
The patch to omit the insn-emit object files does help slightly, but there are
still far too many symbols being exported. Is there any hint as to which object
files don't need to be exported for the plugin API? I'd much rather include
logic to exclude these object files than lose the ability to run LTO with gcc
for Windows, as to my knowledge gcc's LTO capabilities come from the linker
plugin.

# g++ -std=c++14 -no-pie   -g -D__USE_MINGW_ACCESS -DIN_GCC    -fno-exceptions
-fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-error=narrowing
-Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute
-Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings  -DHAVE_CONFIG_H -no-pie
-static-libstdc++ -static-libgcc -Wl,--stack,67108864
-Wl,--undefined=HOST_EXTRA_OBJS_SYMBOL -o cc1plus.exe       cp/cp-lang.o
c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o
cp/coroutines.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o
cp/contracts.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o
cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o
cp/mangle.o cp/mapper-client.o cp/mapper-resolver.o cp/method.o cp/module.o
cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/reflect.o
cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o
cp/vtable-class-hierarchy.o attribs.o c-family/c-common.o
c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o
c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o
c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o
c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o
c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o
c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o
c-family/c-type-mismatch.o i386-c.o winnt-c.o winnt-cxx.o msformat-c.o
cc1plus-checksum.o simple-diagnostic-path.o diagnostics/lazy-paths.o
libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a
../libdecnumber/libdecnumber.a ../libcody/libcody.a         libcommon.a
../libcpp/libcpp.a  -liconv ../libbacktrace/.libs/libbacktrace.a
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -lws2_32 -L/ucrt64/lib
-lisl -L/ucrt64/lib -L/ucrt64/lib -L/ucrt64/lib -lmpc -lmpfr -lgmp
-Wl,--export-all-symbols -Wl,--out-implib=cc1plus.exe.a
-Wl,--exclude-modules-for-implib,insn-emit-1.o:insn-emit-2.o:insn-emit-3.o:insn-emit-4.o:insn-emit-5.o:insn-emit-6.o:insn-emit-7.o:insn-emit-8.o:insn-emit-9.o:insn-emit-10.o
 -L./../zlib -lz -lzstd
C:/msys64/ucrt64/lib/gcc/x86_64-w64-mingw32/15.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
error: export ordinal too large: 89084
collect2.exe: error: ld returned 1 exit status