Commit b41471b2 authored by Nico Weber's avatar Nico Weber

chromeos: Require lld for thinlto builds.

As far as I know, chrome-for-chromeos no longer links with gold,
so we can clean up the code a bit here.

No intended behavior change.

Bug: none
Change-Id: Idc0ee540b2ec8031cf33e483e161c118bebb4035
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429442
Auto-Submit: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarGeorge Burgess <gbiv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810580}
parent b786bf5b
...@@ -602,8 +602,7 @@ config("compiler") { ...@@ -602,8 +602,7 @@ config("compiler") {
# TODO(pcc): Make this conditional on is_official_build rather than on gn # TODO(pcc): Make this conditional on is_official_build rather than on gn
# flags for specific features. # flags for specific features.
if (!is_debug && use_thin_lto && is_a_target_toolchain) { if (!is_debug && use_thin_lto && is_a_target_toolchain) {
assert(use_lld || target_os == "chromeos", assert(use_lld, "LTO is only supported with lld")
"gold plugin only supported with ChromeOS")
cflags += [ cflags += [
"-flto=thin", "-flto=thin",
...@@ -638,33 +637,25 @@ config("compiler") { ...@@ -638,33 +637,25 @@ config("compiler") {
# Limit the parallelism to avoid too aggressive competition between # Limit the parallelism to avoid too aggressive competition between
# linker jobs. This is still suboptimal to a potential dynamic # linker jobs. This is still suboptimal to a potential dynamic
# resource allocation scheme, but should be good enough. # resource allocation scheme, but should be good enough.
if (use_lld) { ldflags += [ "-Wl,--thinlto-jobs=" + max_jobs_per_link ]
ldflags += [ "-Wl,--thinlto-jobs=" + max_jobs_per_link ]
# Limit the size of the ThinLTO cache to the lesser of 10% of # Limit the size of the ThinLTO cache to the lesser of 10% of
# available disk space, 10GB and 100000 files. # available disk space, 10GB and 100000 files.
cache_policy = cache_policy =
"cache_size=10%:cache_size_bytes=10g:cache_size_files=100000" "cache_size=10%:cache_size_bytes=10g:cache_size_files=100000"
ldflags += [ ldflags += [
"-Wl,--thinlto-cache-dir=" + "-Wl,--thinlto-cache-dir=" +
rebase_path("$root_out_dir/thinlto-cache", root_build_dir), rebase_path("$root_out_dir/thinlto-cache", root_build_dir),
"-Wl,--thinlto-cache-policy,$cache_policy", "-Wl,--thinlto-cache-policy,$cache_policy",
] ]
} else {
ldflags += [ "-Wl,-plugin-opt,jobs=" + max_jobs_per_link ]
}
if (use_lld) { ldflags += [ "-Wl,--lto-O" + lto_opt_level ]
ldflags += [ "-Wl,--lto-O" + lto_opt_level ] if (thin_lto_enable_optimizations) {
if (thin_lto_enable_optimizations) { if (is_android) {
if (is_android) { # TODO(gbiv): We ideally shouldn't need to specify this; ThinLTO
# TODO(gbiv): We ideally shouldn't need to specify this; ThinLTO # should be able to better manage binary size increases on its own.
# should be able to better manage binary size increases on its own. ldflags += [ "-Wl,-mllvm,-import-instr-limit=5" ]
ldflags += [ "-Wl,-mllvm,-import-instr-limit=5" ]
}
} }
} else {
not_needed([ "lto_opt_level" ])
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment