Fix x86 Android size regression from removing -mstackrealign

-mstackrealign implied -fno-omit-frame-pointer which greatly
shrank the unwind tables (.eh_frame section).  Removing the flag
(in crrev.com/499401) therefore improved code size but requires
emission of full unwind tables, significantly impacting overall
binary size.  When building for x86 Android and optimizing for
size and generating unwind tables, this fix enables frame pointers.

Bug: 762629
Change-Id: I43515e6159a2aa1ef06e362c52f6525d2d67bf4f
Reviewed-on: https://chromium-review.googlesource.com/657566
Reviewed-by: Wez <wez@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#502860}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: a0c6c3f8dd59d7392d60ad37879ffc4490458704
This commit is contained in:
Paul Jensen 2017-09-19 16:03:20 +00:00 коммит произвёл Commit Bot
Родитель 0c6445ed0f
Коммит 8532ace0b1
2 изменённых файлов: 22 добавлений и 13 удалений

Просмотреть файл

@ -69,17 +69,6 @@ declare_args() {
msvs_xtree_patched = false
}
# Omit unwind support in official builds to save space.
# We can use breakpad for these builds.
exclude_unwind_tables = (is_chrome_branded && is_official_build) ||
(is_chromecast && !is_cast_desktop_build && !is_debug)
# If true, optimize for size. Does not affect windows builds.
# Linux & Mac favor speed over size.
# 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
# Enable fatal linker warnings. Building Chromium with certain versions
# of binutils can cause linker warning.
# See: https://bugs.chromium.org/p/chromium/issues/detail?id=457359

Просмотреть файл

@ -66,6 +66,20 @@ declare_args() {
use_pic = true
}
# Exclude unwind tables for official builds as unwinding can be done from stack
# dumps produced by Crashpad at a later time "offline" in the crash server.
# For unofficial (e.g. development) builds and non-Chrome branded (e.g. Cronet
# which doesn't use Crashpad, crbug.com/479283) builds it's useful to be able
# to unwind at runtime.
exclude_unwind_tables = (is_chrome_branded && is_official_build) ||
(is_chromecast && !is_cast_desktop_build && !is_debug)
# If true, optimize for size. Does not affect windows builds.
# Linux & Mac favor speed over size.
# 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
# Determine whether to enable or disable frame pointers, based on the platform
# and build arguments.
if (is_mac || is_ios) {
@ -84,8 +98,14 @@ if (is_mac || is_ios) {
# there to avoid the unnecessary overhead.
enable_frame_pointers = current_cpu != "arm"
} else if (is_android) {
# Ensure that stacks from arm64 crash dumps are usable (crbug.com/391706).
enable_frame_pointers = current_cpu == "arm64"
enable_frame_pointers =
# Ensure that stacks from arm64 crash dumps are usable (crbug.com/391706).
current_cpu == "arm64" ||
# For x86 Android, unwind tables are huge without frame pointers
# (crbug.com/762629). Enabling frame pointers grows the code size slightly
# but overall shrinks binaries considerably by avoiding huge unwind
# tables.
(current_cpu == "x86" && !exclude_unwind_tables && optimize_for_size)
} else {
# Explicitly ask for frame pointers, otherwise:
# * Stacks may be missing for sanitizer and profiling builds.