mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
c38aa8169e
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
23 lines
1.0 KiB
Plaintext
23 lines
1.0 KiB
Plaintext
# RUN: llvm-elfabi --elf %p/Inputs/gnu_hash.so --emit-tbe=- | FileCheck %s
|
|
|
|
# CHECK: --- !tapi-tbe
|
|
# CHECK-NEXT: TbeVersion: 1.0
|
|
# CHECK-NEXT: SoName: libsomething.so
|
|
# CHECK-NEXT: Arch: x86_64
|
|
# CHECK-NEXT: NeededLibs:
|
|
# CHECK-NEXT: - libm.so.6
|
|
# CHECK-NEXT: - libc.so.6
|
|
# CHECK-NEXT: - ld-linux-x86-64.so.2
|
|
# CHECK-NEXT: Symbols:
|
|
# CHECK-NEXT: AGlobalInteger: { Type: Object, Size: 4 }
|
|
# CHECK-NEXT: AThreadLocalLongInteger: { Type: TLS, Size: 8 }
|
|
# CHECK-NEXT: _ITM_deregisterTMCloneTable: { Type: NoType, Undefined: true, Weak: true }
|
|
# CHECK-NEXT: _ITM_registerTMCloneTable: { Type: NoType, Undefined: true, Weak: true }
|
|
# CHECK-NEXT: _Z11rotateArrayPii: { Type: Func }
|
|
# CHECK-NEXT: __cxa_finalize: { Type: Func, Undefined: true, Weak: true }
|
|
# CHECK-NEXT: __gmon_start__: { Type: NoType, Undefined: true, Weak: true }
|
|
# CHECK-NEXT: __tls_get_addr: { Type: Func, Undefined: true }
|
|
# CHECK-NEXT: _fini: { Type: Func }
|
|
# CHECK-NEXT: _init: { Type: Func }
|
|
# CHECK-NEXT: ...
|