Chromium Code Reviews| Index: build/config/compiler/BUILD.gn |
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn |
| index 7f4578d80b614254fad0d8eb080b9df472e851fa..1c771c3669bfd225b78431b79f052275b4a89d5f 100644 |
| --- a/build/config/compiler/BUILD.gn |
| +++ b/build/config/compiler/BUILD.gn |
| @@ -443,18 +443,28 @@ config("compiler") { |
| # TODO(pcc): Make this conditional on is_official_build rather than on gn |
| # flags for specific features. |
| if (!is_debug && (allow_posix_link_time_opt || is_cfi) && !is_nacl) { |
| - cflags += [ "-flto" ] |
| - ldflags += [ "-flto" ] |
| + if (use_thin_lto) { |
| + cflags += [ "-flto=thin" ] |
| + ldflags += [ "-flto=thin" ] |
| + } else { |
| + cflags += [ "-flto" ] |
| + ldflags += [ "-flto" ] |
| - # Apply a lower LTO optimization level as the default is too slow. |
| - if (is_linux) { |
| - if (use_lld) { |
| - ldflags += [ "-Wl,--lto-O1" ] |
| - } else { |
| - ldflags += [ "-Wl,-plugin-opt,O1" ] |
| + # Apply a lower LTO optimization level as the default is too slow. |
| + if (is_linux) { |
| + if (use_lld) { |
| + ldflags += [ "-Wl,--lto-O1" ] |
| + } else { |
| + ldflags += [ "-Wl,-plugin-opt,O1" ] |
| + } |
| + } else if (is_mac) { |
| + ldflags += [ "-Wl,-mllvm,-O1" ] |
| } |
| - } else if (is_mac) { |
| - ldflags += [ "-Wl,-mllvm,-O1" ] |
| + |
| + # Note: ThinLTO does not currently have this feature implemented |
| + # For Full LTO, it provides a measurable runtime speedup of Chrome. |
| + cflags += [ "-fwhole-program-vtables" ] |
| + ldflags += [ "-fwhole-program-vtables" ] |
|
Dirk Pranke
2016/09/12 21:15:38
Can you move these four lines up next to lines 450
krasin1
2016/09/12 21:35:06
Done. Good idea.
|
| } |
| # Work-around for http://openradar.appspot.com/20356002 |
| @@ -469,9 +479,6 @@ config("compiler") { |
| if (is_linux) { |
| ldflags += [ "-Wl,-plugin-opt,-function-sections" ] |
| } |
| - |
| - cflags += [ "-fwhole-program-vtables" ] |
| - ldflags += [ "-fwhole-program-vtables" ] |
| } |
| # Pass the same C/C++ flags to the objective C/C++ compiler. |