ELF: Add support for emitting dynamic relocations in the Android relocation packing...
authorPeter Collingbourne <peter@pcc.me.uk>
Fri, 27 Oct 2017 17:49:40 +0000 (17:49 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Fri, 27 Oct 2017 17:49:40 +0000 (17:49 +0000)
commit5c54f15c55e7d5f73496b9a2957bd673dd785414
tree592eb9c14daab389d13af68b6168446df242a8b9
parent1d053791a1b67efcda1ea54fd95e741bd98ec053
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
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/Options.td
lld/ELF/SyntheticSections.cpp
lld/ELF/SyntheticSections.h
lld/ELF/Writer.cpp
lld/test/ELF/pack-dyn-relocs.s [new file with mode: 0644]
llvm/lib/Object/ELF.cpp
llvm/tools/llvm-readobj/ELFDumper.cpp