Skip to content

Commit ce1a2d2

Browse files
committed
Fix binary size regression with MSVC
Reduce sel_ldr.exe from 3.0M to 1.6M by changing linker flags. The old Google release is 1.5M. This commit was generated via LLM. I verified that /DEBUG really is passed in the linker command line for some reason, as per its comment.
1 parent a89e8f9 commit ce1a2d2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎site_scons/site_tools/target_platform_windows.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,10 @@ def RES(*argv, **karg):
402402
],
403403
# Omit the absolute pathname of the .pdb debugging info file
404404
# from the executable, and just use a relative pathname.
405-
LINKFLAGS_OPTIMIZED=['/PDBALTPATH:%_PDB%'],
405+
# SCons passes /DEBUG when PDB is set, which defaults to incremental
406+
# linking without dead-code removal, so override that explicitly.
407+
LINKFLAGS_OPTIMIZED=['/PDBALTPATH:%_PDB%', '/INCREMENTAL:NO', '/OPT:REF',
408+
'/OPT:ICF'],
406409

407410
# Settings for component_builders
408411
COMPONENT_LIBRARY_LINK_SUFFIXES=['.lib'],

0 commit comments

Comments
 (0)