1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

ELF: Add support for emitting dynamic relocations in the Android relocation packing format.

The Android relocation packing format is a more compact
format for dynamic relocations in executables and DSOs
that is based on delta encoding and SLEBs. An overview
of the format can be found in the Android source code:
https://android.googlesource.com/platform/bionic/+/refs/heads/master/tools/relocation_packer/src/delta_encoder.h

This patch implements relocation packing using that format.

This implementation uses a more intelligent algorithm for compressing
relative relocations than Android's own relocation packer. As a
result it can generally create smaller relocation sections than
that packer. If I link Chromium for Android targeting ARM32 I get a
.rel.dyn of size 174693 bytes, as compared to 371832 bytes with gold
and the Android packer.

Differential Revision: https://reviews.llvm.org/D39152

llvm-svn: 316775
This commit is contained in:
Peter Collingbourne 2017-10-27 17:49:40 +00:00
parent 5fdbb3eb29
commit 002558db01
2 changed files with 8 additions and 0 deletions

View File

@ -201,6 +201,8 @@ StringRef llvm::object::getELFSectionTypeName(uint32_t Machine, unsigned Type) {
STRINGIFY_ENUM_CASE(ELF, SHT_PREINIT_ARRAY);
STRINGIFY_ENUM_CASE(ELF, SHT_GROUP);
STRINGIFY_ENUM_CASE(ELF, SHT_SYMTAB_SHNDX);
STRINGIFY_ENUM_CASE(ELF, SHT_ANDROID_REL);
STRINGIFY_ENUM_CASE(ELF, SHT_ANDROID_RELA);
STRINGIFY_ENUM_CASE(ELF, SHT_LLVM_ODRTAB);
STRINGIFY_ENUM_CASE(ELF, SHT_GNU_ATTRIBUTES);
STRINGIFY_ENUM_CASE(ELF, SHT_GNU_HASH);

View File

@ -1513,6 +1513,10 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
}
}
switch (Type) {
LLVM_READOBJ_TYPE_CASE(ANDROID_REL);
LLVM_READOBJ_TYPE_CASE(ANDROID_RELSZ);
LLVM_READOBJ_TYPE_CASE(ANDROID_RELA);
LLVM_READOBJ_TYPE_CASE(ANDROID_RELASZ);
LLVM_READOBJ_TYPE_CASE(BIND_NOW);
LLVM_READOBJ_TYPE_CASE(DEBUG);
LLVM_READOBJ_TYPE_CASE(FINI);
@ -1715,6 +1719,8 @@ void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
case DT_INIT_ARRAYSZ:
case DT_FINI_ARRAYSZ:
case DT_PREINIT_ARRAYSZ:
case DT_ANDROID_RELSZ:
case DT_ANDROID_RELASZ:
OS << Value << " (bytes)";
break;
case DT_NEEDED: