MSVC: Optimize global data to reduce binary size
Package global data in COMDAT sections for optimization. According to the docs, this can significantly reduce the size of the resulting binary executable. I've tested build Qt with /Gw locally with and without LTCG, the result shows /Gw can reduce the binary size indeed, but not "significantly". The result also reveals that exes can benefit much more from /Gw than dlls. The result can be seen from the QTBUG-98894 bug report. Microsoft Docs: https://docs.microsoft.com/en-us/cpp/build/reference/gw-optimize-global-data?view=msvc-170 Task-number: QTBUG-98894 Change-Id: Ibce34c98e791e519d669a5fe39c0027d1459c382 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Kai Koehne <kai.koehne@qt.io>
This commit is contained in:
parent
877d6cf6f6
commit
d2a0202cda
@ -199,7 +199,7 @@ if (MSVC)
|
||||
target_compile_options(PlatformCommonInternal INTERFACE -Zc:wchar_t)
|
||||
|
||||
target_compile_options(PlatformCommonInternal INTERFACE
|
||||
$<$<NOT:$<CONFIG:Debug>>:-guard:cf>
|
||||
$<$<NOT:$<CONFIG:Debug>>:-guard:cf -Gw>
|
||||
)
|
||||
|
||||
target_link_options(PlatformCommonInternal INTERFACE
|
||||
|
Loading…
x
Reference in New Issue
Block a user