| Index: build/config/compiler/BUILD.gn
|
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
| index 3cf72220237662772be19973c54a9c9de54012fd..9c91e40c35fe5fd3bad6386003902d341ce82791 100644
|
| --- a/build/config/compiler/BUILD.gn
|
| +++ b/build/config/compiler/BUILD.gn
|
| @@ -86,6 +86,10 @@ declare_args() {
|
| # TODO(brettw) it's weird that Mac and desktop Linux are different. We should
|
| # explore favoring size over speed in this case as well.
|
| optimize_for_size = is_android || is_ios
|
| +
|
| + # Gold icf level, values are "none", "safe", "all". If value isn't overridden,
|
| + # default initialization is below.
|
| + gold_icf_level = ""
|
| }
|
|
|
| # Apply the default logic for these values if they were not set explicitly.
|
| @@ -103,6 +107,16 @@ if (use_debug_fission == "default") {
|
| linux_use_bundled_binutils && cc_wrapper == ""
|
| }
|
|
|
| +if (gold_icf_level == "") {
|
| + if (use_gold && !is_clang) {
|
| + # Gold doesn't respect section alignment and breaks gcc builds with icf
|
| + # https://bugs.chromium.org/p/chromium/issues/detail?id=576197
|
| + gold_icf_level = "none"
|
| + } else {
|
| + gold_icf_level = "all"
|
| + }
|
| +}
|
| +
|
| # default_include_dirs ---------------------------------------------------------
|
| #
|
| # This is a separate config so that third_party code (which would not use the
|
| @@ -304,7 +318,7 @@ config("compiler") {
|
|
|
| if (!using_sanitizer && !(is_android && use_order_profiling)) {
|
| # TODO(brettw) common.gypi has this only for target toolset.
|
| - ldflags += [ "-Wl,--icf=all" ]
|
| + ldflags += [ "-Wl,--icf=${gold_icf_level}" ]
|
| }
|
|
|
| # TODO(thestig): Make this flag work with GN.
|
|
|