[llvm-readobj] Add support for TLSDESC_PLT and TLSDESC_GOT dynamic section tags to the llvm-readobj.

If module uses uses lazy TLSDESC relocations it should define DT_TLSDESC_PLT and DT_TLSDESC_GOT entries.
They were unknown for llvm-readobj before this patch.

Differential revision: http://reviews.llvm.org/D16224

llvm-svn: 257912
This commit is contained in:
George Rimar 2016-01-15 18:13:59 +00:00
parent 05535bccbc
commit d9e46a3a9f
3 changed files with 53 additions and 11 deletions

View File

@ -1,9 +1,14 @@
// clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \
// -o dynamic-table-so.mips
// clang -target mipsel-linux-gnu -lc dynamic-table.c \
// -o dynamic-table-exe.mips
int puts(const char *);
int main(void) {
puts("Hello, World");
}
// -o dynamic-table-so.mips
// clang -target mipsel-linux-gnu -lc dynamic-table.c \
// -o dynamic-table-exe.mips
// clang -target aarch64-linux-gnu -fPIC -shared dynamic-table.c \
// -o dynamic-table-so.aarch64
int puts(const char *);
__thread int foo;
int main(void) {
puts("Hello, World");
foo = 0;
}

View File

@ -108,6 +108,43 @@ ELF-X86-EXE: 0x0000001E FLAGS TEXTREL
ELF-X86-EXE: 0x6FFFFFFE VERNEED 0x4E4
ELF-X86-EXE: 0x6FFFFFFF VERNEEDNUM 3
ELF-X86-EXE: 0x6FFFFFF0 VERSYM 0x4C0
ELF-X86-EXE: 0x6FFFFFFA RELCOUNT 6
ELF-X86-EXE: 0x00000000 NULL 0x0
ELF-X86-EXE: ]
ELF-X86-EXE: 0x6FFFFFFA RELCOUNT 6
ELF-X86-EXE: 0x00000000 NULL 0x0
ELF-X86-EXE: ]
RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table-so.aarch64 \
RUN: | FileCheck %s -check-prefix ELF-AARCH64-SO
ELF-AARCH64-SO: Format: ELF64-aarch64-little
ELF-AARCH64-SO: Arch: aarch64
ELF-AARCH64-SO: AddressSize: 64bit
ELF-AARCH64-SO: LoadName:
ELF-AARCH64-SO: DynamicSection [ (26 entries)
ELF-AARCH64-SO: Tag Type Name/Value
ELF-AARCH64-SO: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
ELF-AARCH64-SO: 0x000000000000000C INIT 0x660
ELF-AARCH64-SO: 0x000000000000000D FINI 0x83C
ELF-AARCH64-SO: 0x0000000000000019 INIT_ARRAY 0x10DB8
ELF-AARCH64-SO: 0x000000000000001B INIT_ARRAYSZ 8 (bytes)
ELF-AARCH64-SO: 0x000000000000001A FINI_ARRAY 0x10DC0
ELF-AARCH64-SO: 0x000000000000001C FINI_ARRAYSZ 8 (bytes)
ELF-AARCH64-SO: 0x000000006FFFFEF5 GNU_HASH 0x1F0
ELF-AARCH64-SO: 0x0000000000000005 STRTAB 0x420
ELF-AARCH64-SO: 0x0000000000000006 SYMTAB 0x240
ELF-AARCH64-SO: 0x000000000000000A STRSZ 210 (bytes)
ELF-AARCH64-SO: 0x000000000000000B SYMENT 24 (bytes)
ELF-AARCH64-SO: 0x0000000000000003 PLTGOT 0x10FE8
ELF-AARCH64-SO: 0x0000000000000002 PLTRELSZ 96 (bytes)
ELF-AARCH64-SO: 0x0000000000000014 PLTREL RELA
ELF-AARCH64-SO: 0x0000000000000017 JMPREL 0x600
ELF-AARCH64-SO: 0x000000006FFFFEF6 TLSDESC_PLT 0x6D0
ELF-AARCH64-SO: 0x000000006FFFFEF7 TLSDESC_GOT 0x10FE0
ELF-AARCH64-SO: 0x0000000000000007 RELA 0x540
ELF-AARCH64-SO: 0x0000000000000008 RELASZ 192 (bytes)
ELF-AARCH64-SO: 0x0000000000000009 RELAENT 24 (bytes)
ELF-AARCH64-SO: 0x000000006FFFFFFE VERNEED 0x520
ELF-AARCH64-SO: 0x000000006FFFFFFF VERNEEDNUM 1
ELF-AARCH64-SO: 0x000000006FFFFFF0 VERSYM 0x4F2
ELF-AARCH64-SO: 0x000000006FFFFFF9 unknown 0x3
ELF-AARCH64-SO: 0x0000000000000000 NULL 0x0
ELF-AARCH64-SO: ]