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

            Bug ID: 119558
           Summary: [meta-bug] Improve Link Time Optimization on Windows
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tanksherman27 at gmail dot com
  Target Milestone: ---

Currently, LTO support on Windows is not ideal. Bug reports to MinGW and gcc
cross compilers targeting Windows commonly mention that Windows LTO is either
broken or subpar when compared to Linux, whether it be compiler crashes, the
resulting assembly faulting or not functioning properly, or the code quality
just not being ideal despite the increased optimization opportunities LTO is
supposed to grant. Not many really work on the Windows parts of gcc in my
observations, so it's only natural that LTO for Windows would also be
overlooked.

This meta bug is an effort to change that by drawing attention to any issues
inherent to Windows LTO, as well as any areas it is falling behind Linux in,
with the goal of making LTO as stable and able to produce performant code as it
is is on Linux. It's an attempt to make tracking all the Windows LTO related
issues easier by having one single meta bug that contains all the problems
rather than developers having to track each one individually. Currently, there
are only a few known problems out of many out there:

-The -Os optimization level crashes gcc at times when combined with LTO< due to
the -fdeclone-ctor-dtor option. This seems to only happen on Windows, and
despite some reports of it having been fixed, this is still an issue
-Some discussion on the mailing lists have mentioned that Windows LTO is not
able to using the lto-plugin properly in some cases, instead falling back on a
less maintained path in collect2, resulting in lower quality emitted code (This
needs to be investigated, see
https://gcc.gnu.org/pipermail/gcc/2025-March/245844.html)
-LTO seems to not works properly with mingw-w64-flint, resulting in a pseudo
relocation error if it was compiled with LTO and linked into a program
(https://github.com/msys2/MINGW-packages/commit/37b1c4ab disabled LTO for the
library as a result)

These are all the known issues for now, but more issues are expected to be
added given that LTO support for Windows is a wide issue and there are bound to
be more problems with LTO than the currently known ones

Reply via email to