Commit 0aa02c66 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Enable Linux binary-size-related lto flags to Android

Shrinks thin-lto android build by ~3MB

Bug: 742655
Change-Id: I12ccaa8b13f021bae96a704ae5edadb2540cedb6
Reviewed-on: https://chromium-review.googlesource.com/789441
Commit-Queue: agrieve <agrieve@chromium.org>
Reviewed-by: default avatarPeter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519570}
parent 9658f84d
...@@ -551,7 +551,7 @@ config("compiler") { ...@@ -551,7 +551,7 @@ config("compiler") {
# Disable optimization for now because they increase binary size by too # Disable optimization for now because they increase binary size by too
# much. # much.
if (is_linux && use_lld) { if (use_lld && (is_android || is_linux)) {
ldflags += [ "-Wl,--lto-O0" ] ldflags += [ "-Wl,--lto-O0" ]
} }
...@@ -564,24 +564,6 @@ config("compiler") { ...@@ -564,24 +564,6 @@ config("compiler") {
if (is_mac) { if (is_mac) {
ldflags += [ "-Wl,-all_load" ] ldflags += [ "-Wl,-all_load" ]
} }
# Allows the linker to apply --gc-sections and ICF to the LTO object file.
# Also, when targeting ARM, without this flag, LTO produces a .text section
# that is larger than the maximum call displacement, preventing the linker
# from relocating calls (http://llvm.org/PR22999).
if (is_linux) {
if (use_lld) {
ldflags += [
"-Wl,-mllvm,-function-sections",
"-Wl,-mllvm,-data-sections",
]
} else {
ldflags += [
"-Wl,-plugin-opt,-function-sections",
"-Wl,-plugin-opt,-data-sections",
]
}
}
} }
# Pass the same C/C++ flags to the objective C/C++ compiler. # Pass the same C/C++ flags to the objective C/C++ compiler.
......
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