Skip to content

Commit 9205528

Browse files
committed
Merge pull request #111566 from Repiteo/scons/mingw-big-obj
SCons: Enable MinGW big objects universally
2 parents 9659dc1 + d86a428 commit 9205528

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

platform/windows/detect.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,7 @@ def spawn_capture(sh, escape, cmd, args, env):
350350

351351
env.AppendUnique(CCFLAGS=["/Gd", "/GR", "/nologo"])
352352
env.AppendUnique(CCFLAGS=["/utf-8"]) # Force to use Unicode encoding.
353-
# Once it was thought that only debug builds would be too large,
354-
# but this has recently stopped being true. See the mingw function
355-
# for notes on why this shouldn't be enabled for gcc
356-
env.AppendUnique(CCFLAGS=["/bigobj"])
353+
env.AppendUnique(CCFLAGS=["/bigobj"]) # Support big objects.
357354

358355
env.AppendUnique(
359356
CPPDEFINES=[
@@ -450,10 +447,6 @@ def spawn_capture(sh, escape, cmd, args, env):
450447
LIBS += ["dxgi", "dxguid"]
451448
LIBS += ["version"] # Mesa dependency.
452449

453-
# Needed for avoiding C1128.
454-
if env["target"] == "release_debug":
455-
env.Append(CXXFLAGS=["/bigobj"])
456-
457450
# PIX
458451
if env["arch"] not in ["x86_64", "arm64"] or env["pix_path"] == "" or not os.path.exists(env["pix_path"]):
459452
env["use_pix"] = False
@@ -637,12 +630,6 @@ def configure_mingw(env: "SConsEnvironment"):
637630
print("Detected GCC to be a wrapper for Clang.")
638631
env["use_llvm"] = True
639632

640-
if env.dev_build:
641-
# Allow big objects. It's supposed not to have drawbacks but seems to break
642-
# GCC LTO, so enabling for debug builds only (which are not built with LTO
643-
# and are the only ones with too big objects).
644-
env.Append(CCFLAGS=["-Wa,-mbig-obj"])
645-
646633
if env["windows_subsystem"] == "gui":
647634
env.Append(LINKFLAGS=["-Wl,--subsystem,windows"])
648635
else:
@@ -660,6 +647,10 @@ def configure_mingw(env: "SConsEnvironment"):
660647
if env["use_static_cpp"]:
661648
env.Append(LINKFLAGS=["-static"])
662649

650+
# NOTE: Big objects have historically broken LTO on mingw-gcc specifically. While that no
651+
# longer appears to be the case, this notice is retained for posterity.
652+
env.AppendUnique(CCFLAGS=["-Wa,-mbig-obj"]) # Support big objects.
653+
663654
if env["arch"] == "x86_32":
664655
env["x86_libtheora_opt_gcc"] = True
665656

0 commit comments

Comments
 (0)