Index: build/config/win/BUILD.gn |
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn |
index 2b9f7bf77373532e5cca7d033bdd5459d460279f..c36f80cca1754d7571c0fb80d0bf48aa69d76100 100644 |
--- a/build/config/win/BUILD.gn |
+++ b/build/config/win/BUILD.gn |
@@ -86,15 +86,32 @@ config("compiler") { |
lib_dirs = [ "$clang_base_path/lib/clang/$clang_version/lib/windows" ] |
} |
- # Ensures that the PDB file contains FIXUP information (growing the PDB file |
- # by about 5%) but does not otherwise alter the output binary. This |
+ # /PROFILE ensures that the PDB file contains FIXUP information (growing the |
+ # PDB file by about 5%) but does not otherwise alter the output binary. This |
# information is used by the Syzygy optimization tool when decomposing the |
# release image. It is enabled for syzyasan builds and opportunistically for |
# other builds where it is not prohibited (not supported when incrementally |
# linking, using /debug:fastlink, or building with clang). |
- if (is_syzyasan || |
- (!is_debug && !is_component_build && !is_win_fastlink && !is_clang)) { |
+ if (is_syzyasan) { |
+ assert(!is_win_fastlink) |
ldflags = [ "/PROFILE" ] |
+ } else { |
+ if (!is_debug && !is_component_build && !is_clang) { |
+ if (is_win_fastlink) { |
+ # /PROFILE implies the following linker flags. Therefore if we are |
+ # skipping /PROFILE because it is incompatible with /DEBUG:FASTLINK |
+ # we should explicitly add these flags in order to avoid unintended |
+ # consequences such as larger binaries. |
+ ldflags = [ |
+ "/OPT:REF", |
+ "/OPT:ICF", |
+ "/INCREMENTAL:NO", |
+ "/FIXED:NO", |
+ ] |
+ } else { |
+ ldflags = [ "/PROFILE" ] |
+ } |
+ } |
} |
# arflags apply only to static_libraries. The normal linker configs are only |