Chromium Code Reviews| Index: build/config/pgo/BUILD.gn |
| diff --git a/build/config/pgo/BUILD.gn b/build/config/pgo/BUILD.gn |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c804e90527e83d8aa68ed225d0dd23858ab2e681 |
| --- /dev/null |
| +++ b/build/config/pgo/BUILD.gn |
| @@ -0,0 +1,54 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import("//build/config/clang/clang.gni") |
| +import("//build/config/compiler/compiler.gni") |
| +import("//build/config/pgo/pgo.gni") |
| + |
| +# Applies linker flags necessary when profile-guided optimization is used. |
| +# Flags are only added if PGO is enabled, so that this config is safe to |
| +# include by default. |
| +config("default_pgo_ldflags") { |
| + visibility = [ ":default_pgo_flags" ] |
| + ldflags = [] |
| + |
| + if (is_clang && !is_nacl) { |
| + if (chrome_pgo_phase == 1) { |
| + ldflags += [ "-fprofile-instr-generate" ] |
| + } |
| + } |
| +} |
| + |
| +# Applies compiler flags necessary when profile-guided optimization is used. |
| +# Flags are only added if PGO is enabled, so that this config is safe to |
|
Sébastien Marchand
2016/11/17 17:31:15
I'm not sure that this is safe to assume that this
|
| +# include by default. |
| +config("pgo_flags") { |
| + visibility = [ ":default_pgo_flags" ] |
| + cflags = [] |
| + |
| + if (is_clang && !is_nacl) { |
|
Sébastien Marchand
2016/11/17 17:31:15
Could you add some TODO (assigned to me) to move t
|
| + if (chrome_pgo_phase == 1) { |
| + cflags += [ "-fprofile-instr-generate" ] |
| + } else if (chrome_pgo_phase == 2) { |
| + assert(pgo_data_path != "", |
| + "Please set pgo_data_path to point at the profile data") |
| + cflags += [ |
| + "-fprofile-instr-use=$pgo_data_path", |
| + |
| + # It's possible to have some profile data legitimately missing, and at least some |
| + # profile data always ends up being considered out of date, so make sure we don't |
| + # error for those cases. |
| + "-Wno-profile-instr-unprofiled", |
| + "-Wno-error=profile-instr-out-of-date", |
| + ] |
| + } |
| + } |
| +} |
| + |
| +config("default_pgo_flags") { |
| + configs = [ |
| + ":default_pgo_ldflags", |
| + ":pgo_flags", |
| + ] |
| +} |