Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(573)

Unified Diff: chrome/BUILD.gn

Issue 2507333002: Add the possibility to build with PGO when using Clang (Closed)
Patch Set: Add the possibility to build with PGO when using Clang Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« build/config/compiler/pgo/BUILD.gn ('K') | « build/config/compiler/pgo/pgo.gni ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/BUILD.gn
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index ec75dcdb41c4531fca2bb3beef6c097211fbf650..1bc98e42a45f3cc1b63c44008c6a6c1b26ff158d 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" ]
Sébastien Marchand 2016/11/24 15:57:07 This config will be applied to chrome.exe, do you
+ }
+
# 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.
@@ -425,28 +436,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" ]
« build/config/compiler/pgo/BUILD.gn ('K') | « build/config/compiler/pgo/pgo.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698