Skip to content

Commit 15d37ed

Browse files
committed
[MinGW] Restore executable size check.
1 parent 9c7e403 commit 15d37ed

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

platform/windows/platform_windows_builders.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@
55

66

77
def make_debug_mingw(target, source, env):
8-
objcopy = get_mingw_tool("objcopy", env["mingw_prefix"], env["arch"])
9-
strip = get_mingw_tool("strip", env["mingw_prefix"], env["arch"])
8+
dst = str(target[0])
9+
# Force separate debug symbols if executable size is larger than 1.9 GB.
10+
if env["separate_debug_symbols"] or os.stat(dst).st_size >= 2040109465:
11+
objcopy = get_mingw_tool("objcopy", env["mingw_prefix"], env["arch"])
12+
strip = get_mingw_tool("strip", env["mingw_prefix"], env["arch"])
1013

11-
if not objcopy or not strip:
12-
print('`separate_debug_symbols` requires both "objcopy" and "strip" to function.')
13-
return
14+
if not objcopy or not strip:
15+
print('`separate_debug_symbols` requires both "objcopy" and "strip" to function.')
16+
return
1417

15-
os.system("{0} --only-keep-debug {1} {1}.debugsymbols".format(objcopy, target[0]))
16-
os.system("{0} --strip-debug --strip-unneeded {1}".format(strip, target[0]))
17-
os.system("{0} --add-gnu-debuglink={1}.debugsymbols {1}".format(objcopy, target[0]))
18+
os.system("{0} --only-keep-debug {1} {1}.debugsymbols".format(objcopy, dst))
19+
os.system("{0} --strip-debug --strip-unneeded {1}".format(strip, dst))
20+
os.system("{0} --add-gnu-debuglink={1}.debugsymbols {1}".format(objcopy, dst))

0 commit comments

Comments
 (0)