Commit ad7ffb42 authored by Nelson Billing's avatar Nelson Billing Committed by Commit Bot

Add -generate-type-units to Android when ThinLTO.

- Add '-Wl,-mllvm -Wl,-generate-type-units' to ldflags for Chrome
Android builds using ThinLTO (use_thin_lto), which is typically the case
just for official builds (is_official).
- This brings the 32bit binary size of Chrome under the linker size
limit, so symbol_level can be raised back to "2" for these builds.
- Exclude builds with ThinLTO from the logic that lowers symbol_level to
"1" for non-component Android builds.

Change-Id: I26457985b26d0e84bf08640c5128b84eacdcc43e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992240
Commit-Queue: Nelson Billing <nbilling@google.com>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729971}
parent e0816f0d
......@@ -661,6 +661,17 @@ config("compiler") {
}
}
# This is done in Android case to keep binary size under linker limit for
# 32bit, especially since when ThinLTO is enabled Chrome Android build
# cannot yet support DWARF Fission. This workaround was copied from
# crosbug/1032159
if (is_android) {
ldflags += [
"-Wl,-mllvm",
"-Wl,-generate-type-units",
]
}
# Work-around for http://openradar.appspot.com/20356002
if (is_mac) {
ldflags += [ "-Wl,-all_load" ]
......
......@@ -225,7 +225,7 @@ if (strip_absolute_paths_from_debug_symbols_default) {
# If it wasn't manually set, set to an appropriate default.
assert(symbol_level >= -1 && symbol_level <= 2, "Invalid symbol_level")
if (symbol_level == -1) {
if (is_android && !is_component_build) {
if (is_android && !is_component_build && !use_thin_lto) {
# Reduce symbol level when it will cause invalid elf files to be created
# (due to file size). https://crbug.com/648948.
symbol_level = 1
......@@ -278,9 +278,11 @@ if (forbid_non_component_debug_builds) {
# Assert that the configuration isn't going to hit https://crbug.com/648948.
# An exception is made when target_os == "chromeos" as we only use the Android
# toolchain there to build relatively small binaries.
# toolchain there to build relatively small binaries. There is a workaround in
# place for builds using ThinLTO (through '-generate-type-units' flag), so
# these are exempt from limitation.
assert(ignore_elf32_limitations || !is_android || target_os == "chromeos" ||
is_component_build || symbol_level < 2,
is_component_build || use_thin_lto || symbol_level < 2,
"Android 32-bit non-component builds cannot have symbol_level=2 " +
"due to 4GiB file size limit, see https://crbug.com/648948. " +
"If you really want to try this out, " +
......
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