New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 851391 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Sep 11
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Android crazy linker: Support GNU hash table format

Project Member Reported by digit@google.com, Jun 11 2018

Issue description

GNU hash tables are considerably smaller and faster than the standard ELF hash table format.

The crazy linker should be updated to support them, since this would allow:

- Reducing the size of the generated libraries (by a few hundred bytes).

- Faster symbol resolution, which will become important when we split
  Chrome into several shared libraries for release builds
  (see  https://crbug.com/846761 )
 
Project Member

Comment 1 by bugdroid1@chromium.org, Sep 11

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/2c987e28e8e9c3f82e67e9187773e98a26ce7044

commit 2c987e28e8e9c3f82e67e9187773e98a26ce7044
Author: David 'Digit' Turner <digit@google.com>
Date: Tue Sep 11 14:03:04 2018

android: crazy_linker: Add GNU hash table support.

The static linker currently generates two symbol hash tables by
default in each ELF binary (executables or shared libraries).
One uses the old, slow and large SysV format, and the other the
much smaller and much faster GNU format.

This CL adds support for the GNU format to the crazy linker
library (which turns out to require very little code).

This will allow the removal of the SysV table whenever the
chromium linker is being used (i.e. for ChromePublic.apk and
ChromeModernPublic.apk and their derivatives).

This will also be handy when we split libchrome.so into
several native libraries in the future (e.g. to support
android app feature modules like VR), which will require
exporting a lot more symbols.

Note that MonochromePublic.apk, which only runs on Android N+
already uses GNU tables exclusively (for the record, support
for this format was added in Android M / API level 23).

+ Add unit-tests. And scripts to generate the test data from
  a known list of symbols.

+ Add a small script to regenerate all auto-generated sources
  at once.

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

Change-Id: I42b1aac46445b5b4d4b3b4f69eaa69ea47e7ab3c
Reviewed-on: https://chromium-review.googlesource.com/1216122
Commit-Queue: David Turner <digit@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590291}
[modify] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/BUILD.gn
[modify] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/run_tests.sh
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_elf_hash_table.cpp
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_elf_hash_table.h
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_elf_hash_table_test_data.h
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_elf_hash_table_unittest.cpp
[modify] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_elf_symbols.cpp
[modify] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_elf_symbols.h
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_elf_symbols_unittest.cpp
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_gnu_hash_table.cpp
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_gnu_hash_table.h
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_gnu_hash_table_test_data.h
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/src/crazy_linker_gnu_hash_table_unittest.cpp
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/tests/generate_test_elf_hash_tables.py
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/tests/generate_test_gnu_hash_tables.py
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/tests/pylib/__init__.py
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/tests/pylib/elf_utils.py
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/tests/pylib/source_utils.py
[modify] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/tests/test_load_library.cpp
[add] https://crrev.com/2c987e28e8e9c3f82e67e9187773e98a26ce7044/third_party/android_crazy_linker/src/update_auto_generated_sources.sh

Status: Fixed (was: Assigned)
Project Member

Comment 3 by bugdroid1@chromium.org, Oct 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/76f2c1a57a1151a6b04edef5bb4d0d957868462b

commit 76f2c1a57a1151a6b04edef5bb4d0d957868462b
Author: David 'Digit' Turner <digit@google.com>
Date: Fri Oct 19 09:49:11 2018

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: agrieve <agrieve@chromium.org>
Reviewed-by: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601094}
[modify] https://crrev.com/76f2c1a57a1151a6b04edef5bb4d0d957868462b/base/android/linker/BUILD.gn
[modify] https://crrev.com/76f2c1a57a1151a6b04edef5bb4d0d957868462b/chrome/android/BUILD.gn

Sign in to add a comment