Windows: Configure MinGW LTO with -fno-use-linker-plugin -fwhole-program

- Works around and closes #102867.
- Works around and closes #102982.

Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
This commit is contained in:
Rémi Verschelde 2025-02-20 16:30:13 +01:00
parent fe799deee0
commit 26fd3458f9
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -781,6 +781,10 @@ def configure_mingw(env: "SConsEnvironment"):
else:
env.Append(CCFLAGS=["-flto"])
env.Append(LINKFLAGS=["-flto"])
if not env["use_llvm"]:
# For mingw-gcc LTO, disable linker plugin and enable whole program to work around GH-102867.
env.Append(CCFLAGS=["-fno-use-linker-plugin", "-fwhole-program"])
env.Append(LINKFLAGS=["-fno-use-linker-plugin", "-fwhole-program"])
if env["use_asan"]:
env.Append(LINKFLAGS=["-Wl,--stack," + str(STACK_SIZE_SANITIZERS)])