Commit 76f2c1a5 authored by David 'Digit' Turner's avatar David 'Digit' Turner Committed by Commit Bot

android: Remove ELF SysV hash tables from chrome binaries.

This CL slightly reduces the size of libchrome.so by removing
the SysV symbol hash tables from them (only the GNU ones, which
are now supported by the crazy linker [1], will be included).

Note that this is not needed for libmonochrome.so which already
does that.

+ Only use one SysV format table for libchromium_android_linker.so
  since it is always loaded by the system linker, on platforms
  that do not support the GNU format.

This saves 445 bytes in ChromePublic.apk (woohoo!).

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1216122

BUG=851391
R=agrieve@chromium.org, pasko@chromium.org, rmcilroy@chromium.org, cjgrant@chromium.org

Change-Id: I9ed7901312a25cda3b77440c32a1a2645e14beca
Reviewed-on: https://chromium-review.googlesource.com/c/1254441
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: default avataragrieve <agrieve@chromium.org>
Reviewed-by: default avatarEgor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601094}
parent ad01a697
...@@ -22,4 +22,11 @@ shared_library("chromium_android_linker") { ...@@ -22,4 +22,11 @@ shared_library("chromium_android_linker") {
# Export JNI symbols. # Export JNI symbols.
configs -= [ "//build/config/android:hide_all_but_jni_onload" ] configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ] configs += [ "//build/config/android:hide_all_but_jni" ]
# The linker is used on Android platforms that do not support GNU-style
# hash tables, so ensure one isn't included in it to save space (since the SysV
# format is always supported). It would be nice to also remove the GNU version
# tables, for the same reason, but a linker flag to disable them doesn't seem
# to exist. This saves 52 bytes on ARM.
ldflags = [ "-Wl,--hash-style=sysv" ]
} }
...@@ -996,6 +996,18 @@ template("chrome_shared_library") { ...@@ -996,6 +996,18 @@ template("chrome_shared_library") {
if (chromium_linker_supported && use_lld) { if (chromium_linker_supported && use_lld) {
configs += [ "//build/config/android:lld_pack_relocations" ] configs += [ "//build/config/android:lld_pack_relocations" ]
} }
if (chromium_linker_supported && target_cpu != "mipsel" &&
target_cpu != "mipsel64") {
# By default, the static linker will create ELF executables with both
# SysV and GNU hash tables. Now that the chromium linker supports the
# GNU format, which is considerably smaller, ensure that the SysV one
# is never compiled in the final library. Note that MIPS platforms do
# not support the GNU format though.
if (!defined(ldflags)) {
ldflags = []
}
ldflags += [ "-Wl,--hash-style=gnu" ]
}
public_configs = extra_chrome_shared_library_configs public_configs = extra_chrome_shared_library_configs
deps += extra_chrome_shared_library_deps deps += extra_chrome_shared_library_deps
......
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