MSVC: enable identical COMDAT folding for release builds
According to Microsoft's docs, /OPT:ICF is enabled by the linker by default unless /OPT:NOICF or /DEBUG is specified. If we are in RelWithDebInfo mode, /DEBUG is passed to the linker to generate debug symbols, however, it caused the identical COMDAT folding be disabled. We now pass /OPT:ICF to the linker explicitly to prevent this. [1] https://docs.microsoft.com/en-us/cpp/build/reference/opt-optimizations?view=msvc-160 Change-Id: I02099edb81034ace7bb19f1164d57829e3979a5f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
d8bd8308f8
commit
f27f9e7bd3
@ -194,7 +194,7 @@ if (MSVC)
|
||||
|
||||
target_link_options(PlatformCommonInternal INTERFACE
|
||||
-DYNAMICBASE -NXCOMPAT
|
||||
$<$<NOT:$<CONFIG:Debug>>:-OPT:REF>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-OPT:REF -OPT:ICF>
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -85,8 +85,8 @@ QMAKE_RUN_CXX_IMP_BATCH = $(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ @<<
|
||||
|
||||
QMAKE_LINK = link
|
||||
QMAKE_LFLAGS = /NOLOGO /DYNAMICBASE /NXCOMPAT
|
||||
QMAKE_LFLAGS_RELEASE = /OPT:REF /INCREMENTAL:NO
|
||||
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = /DEBUG /OPT:REF /INCREMENTAL:NO
|
||||
QMAKE_LFLAGS_RELEASE = /OPT:REF /OPT:ICF /INCREMENTAL:NO
|
||||
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_LFLAGS_RELEASE /DEBUG
|
||||
QMAKE_LFLAGS_DEBUG = /DEBUG
|
||||
QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:CONSOLE
|
||||
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
|
||||
|
Loading…
x
Reference in New Issue
Block a user