diff options
| author | Armando Montanez <amontanez@google.com> | 2019-01-24 22:39:21 +0000 |
|---|---|---|
| committer | Armando Montanez <amontanez@google.com> | 2019-01-24 22:39:21 +0000 |
| commit | 8367b0750fe1129f1a95ba182c19e36ae4f4d4c5 (patch) | |
| tree | 346bafc87569c782d5e9c9516f1351aaf3034b95 /llvm/test/tools/llvm-elfabi/binary-read-arch.test | |
| parent | 7211c571756a55175ef50962888e3e9501402f4d (diff) | |
| download | bcm5719-llvm-8367b0750fe1129f1a95ba182c19e36ae4f4d4c5.tar.gz bcm5719-llvm-8367b0750fe1129f1a95ba182c19e36ae4f4d4c5.zip | |
[elfabi] Add support for reading dynamic symbols from binaries
This patch adds initial support for reading dynamic symbols from ELF binaries. Currently, STT_NOTYPE, STT_OBJECT, STT_FUNC, and STT_TLS are explicitly supported. Other symbol types are mapped to ELFSymbolType::Unknown to improve signal/noise ratio.
Symbols must meet two criteria to be read into in an ELFStub:
- The symbol's binding must be STB_GLOBAL or STB_WEAK.
- The symbol's visibility must be STV_DEFAULT or STV_PROTECTED.
This filters out symbols that aren't of interest during compile-time linking against a shared object.
This change uses DT_HASH and DT_GNU_HASH to determine the size of .dynsym. Using hash tables to determine the number of symbols in .dynsym allows llvm-elfabi to work on binaries without relying on section headers.
Differential Revision: https://reviews.llvm.org/D56031
llvm-svn: 352121
Diffstat (limited to 'llvm/test/tools/llvm-elfabi/binary-read-arch.test')
| -rw-r--r-- | llvm/test/tools/llvm-elfabi/binary-read-arch.test | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/test/tools/llvm-elfabi/binary-read-arch.test b/llvm/test/tools/llvm-elfabi/binary-read-arch.test index f2c2d8bd56d..23f99a3721f 100644 --- a/llvm/test/tools/llvm-elfabi/binary-read-arch.test +++ b/llvm/test/tools/llvm-elfabi/binary-read-arch.test @@ -18,11 +18,12 @@ Sections: Flags: [ SHF_ALLOC ] Address: 0x0008 AddressAlign: 8 - Content: "0a0000000000000001000000000000000500000000000000000000000000000000000000000000000000000000000000" + Content: "0a000000000000000100000000000000050000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000" # DT_STRSZ 1 (0x1) # DT_STRTAB 0x0 + # DT_SYMTAB 0x0 # DT_NULL 0x0 - Size: 48 + Size: 64 Link: .dynstr ProgramHeaders: - Type: PT_LOAD |

