Index: chrome/BUILD.gn |
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn |
index 74c0bbe11cc310295344d5b326a7c365cd9d3256..58586fc23837b5be48a04e3783ea06b361c5311e 100644 |
--- a/chrome/BUILD.gn |
+++ b/chrome/BUILD.gn |
@@ -5,6 +5,7 @@ |
import("//build/buildflag_header.gni") |
import("//build/config/chrome_build.gni") |
import("//build/config/compiler/compiler.gni") |
+import("//build/config/compiler/pgo/pgo.gni") |
import("//build/config/features.gni") |
import("//build/config/locales.gni") |
import("//build/config/sanitizers/sanitizers.gni") |
@@ -116,6 +117,16 @@ if (!is_android && !is_mac) { |
output_name = "chrome" |
} |
+ if (!is_win || is_clang) { |
+ # Normally, we need to pass specific flags to the linker to |
+ # create an executable that gathers profile data. However, when |
+ # using MSVC, we need to make sure we *don't* pass /GENPROFILE |
+ # when linking without generating any code, or else the linker |
+ # will give us fatal error LNK1264. So we add the PGO flags |
+ # on all configurations, execpt MSVC on Windows. |
+ configs += [ "//build/config/compiler/pgo:default_pgo_flags" ] |
+ } |
+ |
# Because the sources list varies so significantly per-platform, generally |
# each platform lists its own files rather than relying on filtering or |
# removing unused files. |
@@ -424,28 +435,7 @@ if (is_win) { |
configs -= [ "//build/config/win:default_incremental_linking" ] |
configs += [ "//build/config/win:no_incremental_linking" ] |
} |
- if (chrome_pgo_phase == 1) { |
- ldflags += [ |
- "/LTCG", |
- |
- # Make sure that enough memory gets allocated for the PGO profiling |
- # buffers and also cap this memory. Usually a PGI instrumented build |
- # of chrome_child.dll requires ~55MB of memory for storing its counter |
- # etc, normally the linker should automatically choose an appropriate |
- # amount of memory but it doesn't always do a good estimate and |
- # sometime allocates too little or too much (and so the instrumented |
- # image fails to start). Making sure that the buffer has a size in the |
- # [128 MB, 512 MB] range should prevent this from happening. |
- "/GENPROFILE:MEMMIN=134217728", |
- "/GENPROFILE:MEMMAX=536870912", |
- "/PogoSafeMode", |
- ] |
- } else if (chrome_pgo_phase == 2) { |
- ldflags += [ |
- "/LTCG", |
- "/USEPROFILE", |
- ] |
- } |
+ configs += [ "//build/config/compiler/pgo:default_pgo_flags" ] |
if (enable_plugins && enable_pdf) { |
deps += [ "//pdf" ] |