Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MinGW] Restore executable size check (reverted) #91698

Merged
merged 1 commit into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions platform/windows/platform_windows_builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@


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

if not objcopy or not strip:
print('`separate_debug_symbols` requires both "objcopy" and "strip" to function.')
return
if not objcopy or not strip:
print('`separate_debug_symbols` requires both "objcopy" and "strip" to function.')
return

os.system("{0} --only-keep-debug {1} {1}.debugsymbols".format(objcopy, target[0]))
os.system("{0} --strip-debug --strip-unneeded {1}".format(strip, target[0]))
os.system("{0} --add-gnu-debuglink={1}.debugsymbols {1}".format(objcopy, target[0]))
os.system("{0} --only-keep-debug {1} {1}.debugsymbols".format(objcopy, dst))
os.system("{0} --strip-debug --strip-unneeded {1}".format(strip, dst))
os.system("{0} --add-gnu-debuglink={1}.debugsymbols {1}".format(objcopy, dst))
Loading