| Index: build/config/compiler/BUILD.gn
|
| diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
|
| index 11b7190462a7a35c3872d21a22b6935349733bc2..7f57d912d6f1ec60650af9ce04dc3bf61fc37683 100644
|
| --- a/build/config/compiler/BUILD.gn
|
| +++ b/build/config/compiler/BUILD.gn
|
| @@ -470,8 +470,6 @@
|
| # 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) {
|
| - assert(use_lld, "POSIX LTO requires LLD")
|
| -
|
| if (use_thin_lto) {
|
| cflags += [ "-flto=thin" ]
|
| ldflags += [ "-flto=thin" ]
|
| @@ -479,11 +477,15 @@
|
| # Limit the parallelism to avoid too agressive competition between
|
| # linker jobs. This is still suboptimal to a potential dynamic
|
| # resource allocation scheme, but should be good enough.
|
| - ldflags += [
|
| - "-Wl,--thinlto-jobs=8",
|
| - "-Wl,--thinlto-cache-dir=" +
|
| - rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
| - ]
|
| + if (use_lld) {
|
| + ldflags += [
|
| + "-Wl,--thinlto-jobs=8",
|
| + "-Wl,--thinlto-cache-dir=" +
|
| + rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
|
| + ]
|
| + } else {
|
| + ldflags += [ "-Wl,-plugin-opt,jobs=8" ]
|
| + }
|
| } else {
|
| # Note: ThinLTO does not currently have this feature implemented
|
| # For Full LTO, it provides a measurable runtime speedup of Chrome.
|
| @@ -498,7 +500,11 @@
|
|
|
| # Apply a lower LTO optimization level as the default is too slow.
|
| if (is_linux) {
|
| - ldflags += [ "-Wl,--lto-O1" ]
|
| + if (use_lld) {
|
| + ldflags += [ "-Wl,--lto-O1" ]
|
| + } else {
|
| + ldflags += [ "-Wl,-plugin-opt,O1" ]
|
| + }
|
| } else if (is_mac) {
|
| ldflags += [ "-Wl,-mllvm,-O1" ]
|
| }
|
| @@ -514,10 +520,17 @@
|
| # that is larger than the maximum call displacement, preventing the linker
|
| # from relocating calls (http://llvm.org/PR22999).
|
| if (is_linux) {
|
| - ldflags += [
|
| - "-Wl,-mllvm,-function-sections",
|
| - "-Wl,-mllvm,-data-sections",
|
| - ]
|
| + if (use_lld) {
|
| + ldflags += [
|
| + "-Wl,-mllvm,-function-sections",
|
| + "-Wl,-mllvm,-data-sections",
|
| + ]
|
| + } else {
|
| + ldflags += [
|
| + "-Wl,-plugin-opt,-function-sections",
|
| + "-Wl,-plugin-opt,-data-sections",
|
| + ]
|
| + }
|
| }
|
| }
|
|
|
|
|