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

Side by Side 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 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 unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/buildflag_header.gni") 5 import("//build/buildflag_header.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 import("//build/config/compiler/pgo/pgo.gni")
8 import("//build/config/features.gni") 9 import("//build/config/features.gni")
9 import("//build/config/locales.gni") 10 import("//build/config/locales.gni")
10 import("//build/config/sanitizers/sanitizers.gni") 11 import("//build/config/sanitizers/sanitizers.gni")
11 import("//build/config/ui.gni") 12 import("//build/config/ui.gni")
12 import("//build/config/win/console_app.gni") 13 import("//build/config/win/console_app.gni")
13 import("//build/config/win/manifest.gni") 14 import("//build/config/win/manifest.gni")
14 import("//build/toolchain/toolchain.gni") 15 import("//build/toolchain/toolchain.gni")
15 import("//chrome/chrome_paks.gni") 16 import("//chrome/chrome_paks.gni")
16 import("//chrome/common/features.gni") 17 import("//chrome/common/features.gni")
17 import("//chrome/process_version_rc_template.gni") 18 import("//chrome/process_version_rc_template.gni")
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 110 }
110 } 111 }
111 112
112 executable("chrome_initial") { 113 executable("chrome_initial") {
113 if (is_win) { 114 if (is_win) {
114 output_name = "initialexe/chrome" 115 output_name = "initialexe/chrome"
115 } else { 116 } else {
116 output_name = "chrome" 117 output_name = "chrome"
117 } 118 }
118 119
120 if (!is_win || is_clang) {
121 # Normally, we need to pass specific flags to the linker to
122 # create an executable that gathers profile data. However, when
123 # using MSVC, we need to make sure we *don't* pass /GENPROFILE
124 # when linking without generating any code, or else the linker
125 # will give us fatal error LNK1264. So we add the PGO flags
126 # on all configurations, execpt MSVC on Windows.
127 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
128 }
129
119 # Because the sources list varies so significantly per-platform, generally 130 # Because the sources list varies so significantly per-platform, generally
120 # each platform lists its own files rather than relying on filtering or 131 # each platform lists its own files rather than relying on filtering or
121 # removing unused files. 132 # removing unused files.
122 sources = [ 133 sources = [
123 "app/chrome_exe_resource.h", 134 "app/chrome_exe_resource.h",
124 ] 135 ]
125 defines = [] 136 defines = []
126 public_deps = [] 137 public_deps = []
127 deps = [ 138 deps = [
128 "//build/config/sanitizers:deps", 139 "//build/config/sanitizers:deps",
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 "/DELAYLOAD:wininet.dll", 429 "/DELAYLOAD:wininet.dll",
419 ] 430 ]
420 431
421 if (symbol_level == 2) { 432 if (symbol_level == 2) {
422 # Incremental linking doesn't work on this target in debug mode with 433 # Incremental linking doesn't work on this target in debug mode with
423 # full symbols, but does work in other cases, including minimal 434 # full symbols, but does work in other cases, including minimal
424 # symbols. 435 # symbols.
425 configs -= [ "//build/config/win:default_incremental_linking" ] 436 configs -= [ "//build/config/win:default_incremental_linking" ]
426 configs += [ "//build/config/win:no_incremental_linking" ] 437 configs += [ "//build/config/win:no_incremental_linking" ]
427 } 438 }
428 if (chrome_pgo_phase == 1) { 439 configs += [ "//build/config/compiler/pgo:default_pgo_flags" ]
429 ldflags += [
430 "/LTCG",
431
432 # Make sure that enough memory gets allocated for the PGO profiling
433 # buffers and also cap this memory. Usually a PGI instrumented build
434 # of chrome_child.dll requires ~55MB of memory for storing its counter
435 # etc, normally the linker should automatically choose an appropriate
436 # amount of memory but it doesn't always do a good estimate and
437 # sometime allocates too little or too much (and so the instrumented
438 # image fails to start). Making sure that the buffer has a size in the
439 # [128 MB, 512 MB] range should prevent this from happening.
440 "/GENPROFILE:MEMMIN=134217728",
441 "/GENPROFILE:MEMMAX=536870912",
442 "/PogoSafeMode",
443 ]
444 } else if (chrome_pgo_phase == 2) {
445 ldflags += [
446 "/LTCG",
447 "/USEPROFILE",
448 ]
449 }
450 440
451 if (enable_plugins && enable_pdf) { 441 if (enable_plugins && enable_pdf) {
452 deps += [ "//pdf" ] 442 deps += [ "//pdf" ]
453 } 443 }
454 } 444 }
455 } 445 }
456 copy("copy_first_run") { 446 copy("copy_first_run") {
457 sources = [ 447 sources = [
458 "app/firstRun", 448 "app/firstRun",
459 ] 449 ]
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1612 "//chrome/app/theme/$branding_path_component/product_logo_48.png", 1602 "//chrome/app/theme/$branding_path_component/product_logo_48.png",
1613 "//chrome/tools/build/linux/chrome-wrapper", 1603 "//chrome/tools/build/linux/chrome-wrapper",
1614 "//third_party/xdg-utils/scripts/xdg-mime", 1604 "//third_party/xdg-utils/scripts/xdg-mime",
1615 "//third_party/xdg-utils/scripts/xdg-settings", 1605 "//third_party/xdg-utils/scripts/xdg-settings",
1616 ] 1606 ]
1617 outputs = [ 1607 outputs = [
1618 "$root_out_dir/{{source_file_part}}", 1608 "$root_out_dir/{{source_file_part}}",
1619 ] 1609 ]
1620 } 1610 }
1621 } 1611 }
OLDNEW
« 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