1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

[llvm-readobj] Implement GNU-style output for dynamic table

GNU readelf tool prints slightly different dynamic table "header" and
surrounds dynamic tag names by brackets. This patch implements the same
formatting for GNU-style output of the `llvm-readobj`.

LLVM
```
DynamicSection [ (13 entries)
  Tag        Type                 Name/Value
  0x00000006 SYMTAB               0x168
  ...
]
```

GNU
```
Dynamic section at offset 0x1d0 contains 13 entries:
  Tag        Type                 Name/Value
  0x00000006 (SYMTAB)             0x168
  ...
```

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

llvm-svn: 361633
This commit is contained in:
Simon Atanasyan 2019-05-24 12:22:53 +00:00
parent 234a0edb79
commit 8a7e514b76
9 changed files with 326 additions and 206 deletions

View File

@ -1,6 +1,8 @@
// Check dynamic section tags in case of shared library file.
RUN: llvm-readobj --dynamic-table %p/Inputs/dynamic-table-so.mips \
RUN: | FileCheck %s -check-prefix ELF-MIPS
RUN: llvm-readelf --dynamic-table %p/Inputs/dynamic-table-so.mips \
RUN: | FileCheck %s --strict-whitespace -check-prefix ELF-MIPS-GNU
ELF-MIPS: Format: ELF32-mips
ELF-MIPS: Arch: mipsel
@ -33,6 +35,32 @@ ELF-MIPS: 0x6FFFFFF0 VERSYM 0x4C0
ELF-MIPS: 0x00000000 NULL 0x0
ELF-MIPS: ]
ELF-MIPS-GNU: Dynamic section at offset 0x{{.*}} contains 23 entries:
ELF-MIPS-GNU-NEXT: Tag Type Name/Value
ELF-MIPS-GNU-NEXT: 0x00000001 (NEEDED) Shared library: [libc.so.6]
ELF-MIPS-GNU-NEXT: 0x0000000c (INIT) 0x528
ELF-MIPS-GNU-NEXT: 0x0000000d (FINI) 0x860
ELF-MIPS-GNU-NEXT: 0x00000004 (HASH) 0x210
ELF-MIPS-GNU-NEXT: 0x00000005 (STRTAB) 0x3d8
ELF-MIPS-GNU-NEXT: 0x00000006 (SYMTAB) 0x2a8
ELF-MIPS-GNU-NEXT: 0x0000000a (STRSZ) 231 (bytes)
ELF-MIPS-GNU-NEXT: 0x0000000b (SYMENT) 16 (bytes)
ELF-MIPS-GNU-NEXT: 0x00000003 (PLTGOT) 0x108e0
ELF-MIPS-GNU-NEXT: 0x00000011 (REL) 0x518
ELF-MIPS-GNU-NEXT: 0x00000012 (RELSZ) 16 (bytes)
ELF-MIPS-GNU-NEXT: 0x00000013 (RELENT) 8 (bytes)
ELF-MIPS-GNU-NEXT: 0x70000001 (MIPS_RLD_VERSION) 1
ELF-MIPS-GNU-NEXT: 0x70000005 (MIPS_FLAGS) NOTPOT
ELF-MIPS-GNU-NEXT: 0x70000006 (MIPS_BASE_ADDRESS) 0x0
ELF-MIPS-GNU-NEXT: 0x7000000a (MIPS_LOCAL_GOTNO) 10
ELF-MIPS-GNU-NEXT: 0x70000011 (MIPS_SYMTABNO) 19
ELF-MIPS-GNU-NEXT: 0x70000012 (MIPS_UNREFEXTNO) 26
ELF-MIPS-GNU-NEXT: 0x70000013 (MIPS_GOTSYM) 0xd
ELF-MIPS-GNU-NEXT: 0x6ffffffe (VERNEED) 0x4e8
ELF-MIPS-GNU-NEXT: 0x6fffffff (VERNEEDNUM) 1
ELF-MIPS-GNU-NEXT: 0x6ffffff0 (VERSYM) 0x4c0
ELF-MIPS-GNU-NEXT: 0x00000000 (NULL) 0x0
// Check dynamic section tags in case of non-pic executable file.
RUN: llvm-readobj --dynamic-table %p/Inputs/dynamic-table-exe.mips \
RUN: | FileCheck %s -check-prefix ELF-MIPS-EXE
@ -151,6 +179,8 @@ ELF-X86-SO: 0x0000000000000000 NULL 0x0
RUN: llvm-readobj --dynamic-table %p/Inputs/dynamic-table-so.aarch64 \
RUN: | FileCheck %s -check-prefix ELF-AARCH64-SO
RUN: llvm-readelf --dynamic-table %p/Inputs/dynamic-table-so.aarch64 \
RUN: | FileCheck %s --strict-whitespace -check-prefix ELF-AARCH64-SO-GNU
ELF-AARCH64-SO: Format: ELF64-aarch64-little
ELF-AARCH64-SO: Arch: aarch64
@ -185,3 +215,32 @@ ELF-AARCH64-SO: 0x000000006FFFFFF0 VERSYM 0x4F2
ELF-AARCH64-SO: 0x000000006FFFFFF9 RELACOUNT 3
ELF-AARCH64-SO: 0x0000000000000000 NULL 0x0
ELF-AARCH64-SO: ]
ELF-AARCH64-SO-GNU: Dynamic section at offset 0x{{.*}} contains 26 entries:
ELF-AARCH64-SO-GNU-NEXT: Tag Type Name/Value
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
ELF-AARCH64-SO-GNU-NEXT: 0x000000000000000c (INIT) 0x660
ELF-AARCH64-SO-GNU-NEXT: 0x000000000000000d (FINI) 0x83c
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000019 (INIT_ARRAY) 0x10db8
ELF-AARCH64-SO-GNU-NEXT: 0x000000000000001b (INIT_ARRAYSZ) 8 (bytes)
ELF-AARCH64-SO-GNU-NEXT: 0x000000000000001a (FINI_ARRAY) 0x10dc0
ELF-AARCH64-SO-GNU-NEXT: 0x000000000000001c (FINI_ARRAYSZ) 8 (bytes)
ELF-AARCH64-SO-GNU-NEXT: 0x000000006ffffef5 (GNU_HASH) 0x1f0
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000005 (STRTAB) 0x420
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000006 (SYMTAB) 0x240
ELF-AARCH64-SO-GNU-NEXT: 0x000000000000000a (STRSZ) 210 (bytes)
ELF-AARCH64-SO-GNU-NEXT: 0x000000000000000b (SYMENT) 24 (bytes)
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000003 (PLTGOT) 0x10fe8
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000002 (PLTRELSZ) 96 (bytes)
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000014 (PLTREL) RELA
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000017 (JMPREL) 0x600
ELF-AARCH64-SO-GNU-NEXT: 0x000000006ffffef6 (TLSDESC_PLT) 0x6d0
ELF-AARCH64-SO-GNU-NEXT: 0x000000006ffffef7 (TLSDESC_GOT) 0x10fe0
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000007 (RELA) 0x540
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000008 (RELASZ) 192 (bytes)
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000009 (RELAENT) 24 (bytes)
ELF-AARCH64-SO-GNU-NEXT: 0x000000006ffffffe (VERNEED) 0x520
ELF-AARCH64-SO-GNU-NEXT: 0x000000006fffffff (VERNEEDNUM) 1
ELF-AARCH64-SO-GNU-NEXT: 0x000000006ffffff0 (VERSYM) 0x4f2
ELF-AARCH64-SO-GNU-NEXT: 0x000000006ffffff9 (RELACOUNT) 3
ELF-AARCH64-SO-GNU-NEXT: 0x0000000000000000 (NULL) 0x0

View File

@ -28,14 +28,19 @@ ProgramHeaders:
# Test handling of a .dynamic section with an invalid entsize (i.e. not 2 * sizeof(Elf_Dyn)).
# RUN: yaml2obj %s --docnum=2 -o %t.bad-entsize
# RUN: llvm-readobj --dynamic-table %t.bad-entsize | FileCheck %s --check-prefix BAD-ENTSIZE
# RUN: llvm-readelf --dynamic-table %t.bad-entsize | FileCheck %s --check-prefix BAD-ENTSIZE
# RUN: llvm-readobj --dynamic-table %t.bad-entsize | FileCheck %s --check-prefix BAD-ENTSIZE-LLVM
# RUN: llvm-readelf --dynamic-table %t.bad-entsize | FileCheck %s --check-prefix BAD-ENTSIZE-GNU
# BAD-ENTSIZE: DynamicSection [ (2 entries)
# BAD-ENTSIZE-NEXT: Tag Type Name/Value
# BAD-ENTSIZE-NEXT: 0x0000000000000015 DEBUG 0x0
# BAD-ENTSIZE-NEXT: 0x0000000000000000 NULL 0x0
# BAD-ENTSIZE-NEXT: ]
# BAD-ENTSIZE-LLVM: DynamicSection [ (2 entries)
# BAD-ENTSIZE-LLVM-NEXT: Tag Type Name/Value
# BAD-ENTSIZE-LLVM-NEXT: 0x0000000000000015 DEBUG 0x0
# BAD-ENTSIZE-LLVM-NEXT: 0x0000000000000000 NULL 0x0
# BAD-ENTSIZE-LLVM-NEXT: ]
# BAD-ENTSIZE-GNU: Dynamic section at offset 0x{{.*}} contains 2 entries:
# BAD-ENTSIZE-GNU-NEXT: Tag Type Name/Value
# BAD-ENTSIZE-GNU-NEXT: 0x0000000000000015 (DEBUG) 0x0
# BAD-ENTSIZE-GNU-NEXT: 0x0000000000000000 (NULL) 0x0
--- !ELF
FileHeader:

View File

@ -2,15 +2,23 @@
## section when it is not in a PT_DYNAMIC segment.
# RUN: yaml2obj %s -o %t.o
# RUN: llvm-readobj --dynamic-table %t.o 2>&1 | FileCheck %s
# RUN: llvm-readelf --dynamic-table %t.o 2>&1 | FileCheck %s
# RUN: llvm-readobj --dynamic-table %t.o 2>&1 \
# RUN: | FileCheck --check-prefixes=WARNING,LLVM %s
# RUN: llvm-readelf --dynamic-table %t.o 2>&1 \
# RUN: | FileCheck --check-prefixes=WARNING,GNU %s
# CHECK: warning: The SHT_DYNAMIC section '.dynamic' is not contained within the PT_DYNAMIC segment
# CHECK: DynamicSection [ (2 entries)
# CHECK-NEXT: Tag Type Name/Value
# CHECK-NEXT: 0x0000000000000018 BIND_NOW 0x1
# CHECK-NEXT: 0x0000000000000000 NULL 0x0
# CHECK-NEXT: ]
# WARNING: warning: The SHT_DYNAMIC section '.dynamic' is not contained within the PT_DYNAMIC segment
# LLVM: DynamicSection [ (2 entries)
# LLVM-NEXT: Tag Type Name/Value
# LLVM-NEXT: 0x0000000000000018 BIND_NOW 0x1
# LLVM-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-NEXT: ]
# GNU: Dynamic section at offset 0x{{.*}} contains 2 entries:
# GNU-NEXT: Tag Type Name/Value
# GNU-NEXT: 0x0000000000000018 (BIND_NOW) 0x1
# GNU-NEXT: 0x0000000000000000 (NULL) 0x0
--- !ELF
FileHeader:

View File

@ -1,13 +1,17 @@
# Check we are able to dump the dynamic section without a DT_NULL entry correctly.
# RUN: yaml2obj -docnum=1 %s -o %t.o
# RUN: llvm-readobj --dynamic-table %t.o | FileCheck %s --check-prefix=NONULL
# RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix=NONULL
# RUN: llvm-readobj --dynamic-table %t.o | FileCheck %s --check-prefix=NONULL-LLVM
# RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix=NONULL-GNU
# NONULL: DynamicSection [ (1 entries)
# NONULL-NEXT: Tag Type Name/Value
# NONULL-NEXT: 0x0000000000000015 DEBUG 0x0
# NONULL-NEXT: ]
# NONULL-LLVM: DynamicSection [ (1 entries)
# NONULL-LLVM-NEXT: Tag Type Name/Value
# NONULL-LLVM-NEXT: 0x0000000000000015 DEBUG 0x0
# NONULL-LLVM-NEXT: ]
# NONULL-GNU: Dynamic section at offset {{.*}} contains 1 entries:
# NONULL-GNU-NEXT: Tag Type Name/Value
# NONULL-GNU-NEXT: 0x0000000000000015 (DEBUG) 0x0
--- !ELF
FileHeader:
@ -39,14 +43,19 @@ ProgramHeaders:
# past the DT_NULL entry, which works as a terminator.
# RUN: yaml2obj -docnum=2 %s -o %t.o
# RUN: llvm-readobj --dynamic-table %t.o | FileCheck %s --check-prefix=LONG
# RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix=LONG
# RUN: llvm-readobj --dynamic-table %t.o | FileCheck %s --check-prefix=LONG-LLVM
# RUN: llvm-readelf --dynamic-table %t.o | FileCheck %s --check-prefix=LONG-GNU
# LONG: DynamicSection [ (2 entries)
# LONG-NEXT: Tag Type Name/Value
# LONG-NEXT: 0x0000000000000015 DEBUG 0x0
# LONG-NEXT: 0x0000000000000000 NULL 0x0
# LONG-NEXT: ]
# LONG-LLVM: DynamicSection [ (2 entries)
# LONG-LLVM-NEXT: Tag Type Name/Value
# LONG-LLVM-NEXT: 0x0000000000000015 DEBUG 0x0
# LONG-LLVM-NEXT: 0x0000000000000000 NULL 0x0
# LONG-LLVM-NEXT: ]
# LONG-GNU: Dynamic section at offset {{.*}} contains 2 entries:
# LONG-GNU-NEXT: Tag Type Name/Value
# LONG-GNU-NEXT: 0x0000000000000015 (DEBUG) 0x0
# LONG-GNU-NEXT: 0x0000000000000000 (NULL) 0x0
--- !ELF
FileHeader:

View File

@ -13,15 +13,14 @@
# LLVM-HEXAGON-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-HEXAGON-NEXT: ]
# GNU-HEXAGON: DynamicSection [ (6 entries)
# GNU-HEXAGON: Dynamic section at offset {{.*}} contains 6 entries:
# GNU-HEXAGON-NEXT: Tag Type Name/Value
# GNU-HEXAGON-NEXT: 0x0000000000000004 HASH 0x1000
# GNU-HEXAGON-NEXT: 0x0000000070000000 HEXAGON_SYMSZ 0x10
# GNU-HEXAGON-NEXT: 0x0000000070000001 HEXAGON_VER 4096
# GNU-HEXAGON-NEXT: 0x0000000070000002 HEXAGON_PLT 0x1000
# GNU-HEXAGON-NEXT: 0x000000001234abcd unknown 0x1
# GNU-HEXAGON-NEXT: 0x0000000000000000 NULL 0x0
# GNU-HEXAGON-NEXT: ]
# GNU-HEXAGON-NEXT: 0x0000000000000004 (HASH) 0x1000
# GNU-HEXAGON-NEXT: 0x0000000070000000 (HEXAGON_SYMSZ) 0x10
# GNU-HEXAGON-NEXT: 0x0000000070000001 (HEXAGON_VER) 4096
# GNU-HEXAGON-NEXT: 0x0000000070000002 (HEXAGON_PLT) 0x1000
# GNU-HEXAGON-NEXT: 0x000000001234abcd (unknown) 0x1
# GNU-HEXAGON-NEXT: 0x0000000000000000 (NULL) 0x0
# Test that MIPS machine-specific tags can be dumped.
@ -81,57 +80,56 @@
# LLVM-MIPS-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-MIPS-NEXT: ]
# GNU-MIPS: DynamicSection [ (48 entries)
# GNU-MIPS-NEXT: Tag Type Name/Value
# GNU-MIPS-NEXT: 0x0000000000000004 HASH 0x1000
# GNU-MIPS-NEXT: 0x0000000070000001 MIPS_RLD_VERSION 305419896
# GNU-MIPS-NEXT: 0x0000000070000002 MIPS_TIME_STAMP 0x11223344
# GNU-MIPS-NEXT: 0x0000000070000003 MIPS_ICHECKSUM 0x11112222
# GNU-MIPS-NEXT: 0x0000000070000004 MIPS_IVERSION 0x1
# GNU-MIPS-NEXT: 0x0000000070000005 MIPS_FLAGS QUICKSTART SGI_ONLY PIXIE CORD
# GNU-MIPS-NEXT: 0x0000000070000006 MIPS_BASE_ADDRESS 0x87654321
# GNU-MIPS-NEXT: 0x0000000070000007 MIPS_MSYM 0x1000
# GNU-MIPS-NEXT: 0x0000000070000008 MIPS_CONFLICT 0x1000
# GNU-MIPS-NEXT: 0x0000000070000009 MIPS_LIBLIST 0x1000
# GNU-MIPS-NEXT: 0x000000007000000a MIPS_LOCAL_GOTNO 1
# GNU-MIPS-NEXT: 0x000000007000000b MIPS_CONFLICTNO 0x1
# GNU-MIPS-NEXT: 0x0000000070000010 MIPS_LIBLISTNO 0x1
# GNU-MIPS-NEXT: 0x0000000070000011 MIPS_SYMTABNO 1
# GNU-MIPS-NEXT: 0x0000000070000012 MIPS_UNREFEXTNO 0
# GNU-MIPS-NEXT: 0x0000000070000013 MIPS_GOTSYM 0x0
# GNU-MIPS-NEXT: 0x0000000070000014 MIPS_HIPAGENO 0x88776655
# GNU-MIPS-NEXT: 0x0000000070000016 MIPS_RLD_MAP 0x1000
# GNU-MIPS-NEXT: 0x0000000070000017 MIPS_DELTA_CLASS 0x1000
# GNU-MIPS-NEXT: 0x0000000070000018 MIPS_DELTA_CLASS_NO 0x1
# GNU-MIPS-NEXT: 0x0000000070000019 MIPS_DELTA_INSTANCE 0x1000
# GNU-MIPS-NEXT: 0x000000007000001a MIPS_DELTA_INSTANCE_NO0x1
# GNU-MIPS-NEXT: 0x000000007000001b MIPS_DELTA_RELOC 0x1000
# GNU-MIPS-NEXT: 0x000000007000001c MIPS_DELTA_RELOC_NO 0x1
# GNU-MIPS-NEXT: 0x000000007000001d MIPS_DELTA_SYM 0x1000
# GNU-MIPS-NEXT: 0x000000007000001e MIPS_DELTA_SYM_NO 0x1
# GNU-MIPS-NEXT: 0x0000000070000020 MIPS_DELTA_CLASSSYM 0x1000
# GNU-MIPS-NEXT: 0x0000000070000021 MIPS_DELTA_CLASSSYM_NO0x1
# GNU-MIPS-NEXT: 0x0000000070000022 MIPS_CXX_FLAGS 0x88887777
# GNU-MIPS-NEXT: 0x0000000070000023 MIPS_PIXIE_INIT 0x1000
# GNU-MIPS-NEXT: 0x0000000070000025 MIPS_LOCALPAGE_GOTIDX0x1
# GNU-MIPS-NEXT: 0x0000000070000026 MIPS_LOCAL_GOTIDX 0x1
# GNU-MIPS-NEXT: 0x0000000070000027 MIPS_HIDDEN_GOTIDX 0x1
# GNU-MIPS-NEXT: 0x0000000070000028 MIPS_PROTECTED_GOTIDX0x1
# GNU-MIPS-NEXT: 0x0000000070000029 MIPS_OPTIONS 0x1000
# GNU-MIPS-NEXT: 0x000000007000002a MIPS_INTERFACE 0x1000
# GNU-MIPS-NEXT: 0x000000007000002b MIPS_DYNSTR_ALIGN 0x88888888
# GNU-MIPS-NEXT: 0x000000007000002c MIPS_INTERFACE_SIZE 0x10
# GNU-MIPS-NEXT: 0x000000007000002d MIPS_RLD_TEXT_RESOLVE_ADDR0x8
# GNU-MIPS-NEXT: 0x000000007000002e MIPS_PERF_SUFFIX 0x0
# GNU-MIPS-NEXT: 0x000000007000002f MIPS_COMPACT_SIZE 0x10
# GNU-MIPS-NEXT: 0x0000000070000030 MIPS_GP_VALUE 0x1
# GNU-MIPS-NEXT: 0x0000000070000031 MIPS_AUX_DYNAMIC 0x1000
# GNU-MIPS-NEXT: 0x0000000070000032 MIPS_PLTGOT 0x1000
# GNU-MIPS-NEXT: 0x0000000070000034 MIPS_RWPLT 0x1000
# GNU-MIPS-NEXT: 0x0000000070000035 MIPS_RLD_MAP_REL 0x1000
# GNU-MIPS-NEXT: 0x000000001234abcd unknown 0x1
# GNU-MIPS-NEXT: 0x0000000000000000 NULL 0x0
# GNU-MIPS-NEXT: ]
# GNU-MIPS: Dynamic section at offset {{.*}} contains 48 entries:
# GNU-MIPS-NEXT: Tag Type Name/Value
# GNU-MIPS-NEXT: 0x0000000000000004 (HASH) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000001 (MIPS_RLD_VERSION) 305419896
# GNU-MIPS-NEXT: 0x0000000070000002 (MIPS_TIME_STAMP) 0x11223344
# GNU-MIPS-NEXT: 0x0000000070000003 (MIPS_ICHECKSUM) 0x11112222
# GNU-MIPS-NEXT: 0x0000000070000004 (MIPS_IVERSION) 0x1
# GNU-MIPS-NEXT: 0x0000000070000005 (MIPS_FLAGS) QUICKSTART SGI_ONLY PIXIE CORD
# GNU-MIPS-NEXT: 0x0000000070000006 (MIPS_BASE_ADDRESS) 0x87654321
# GNU-MIPS-NEXT: 0x0000000070000007 (MIPS_MSYM) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000008 (MIPS_CONFLICT) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000009 (MIPS_LIBLIST) 0x1000
# GNU-MIPS-NEXT: 0x000000007000000a (MIPS_LOCAL_GOTNO) 1
# GNU-MIPS-NEXT: 0x000000007000000b (MIPS_CONFLICTNO) 0x1
# GNU-MIPS-NEXT: 0x0000000070000010 (MIPS_LIBLISTNO) 0x1
# GNU-MIPS-NEXT: 0x0000000070000011 (MIPS_SYMTABNO) 1
# GNU-MIPS-NEXT: 0x0000000070000012 (MIPS_UNREFEXTNO) 0
# GNU-MIPS-NEXT: 0x0000000070000013 (MIPS_GOTSYM) 0x0
# GNU-MIPS-NEXT: 0x0000000070000014 (MIPS_HIPAGENO) 0x88776655
# GNU-MIPS-NEXT: 0x0000000070000016 (MIPS_RLD_MAP) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000017 (MIPS_DELTA_CLASS) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000018 (MIPS_DELTA_CLASS_NO) 0x1
# GNU-MIPS-NEXT: 0x0000000070000019 (MIPS_DELTA_INSTANCE) 0x1000
# GNU-MIPS-NEXT: 0x000000007000001a (MIPS_DELTA_INSTANCE_NO) 0x1
# GNU-MIPS-NEXT: 0x000000007000001b (MIPS_DELTA_RELOC) 0x1000
# GNU-MIPS-NEXT: 0x000000007000001c (MIPS_DELTA_RELOC_NO) 0x1
# GNU-MIPS-NEXT: 0x000000007000001d (MIPS_DELTA_SYM) 0x1000
# GNU-MIPS-NEXT: 0x000000007000001e (MIPS_DELTA_SYM_NO) 0x1
# GNU-MIPS-NEXT: 0x0000000070000020 (MIPS_DELTA_CLASSSYM) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000021 (MIPS_DELTA_CLASSSYM_NO) 0x1
# GNU-MIPS-NEXT: 0x0000000070000022 (MIPS_CXX_FLAGS) 0x88887777
# GNU-MIPS-NEXT: 0x0000000070000023 (MIPS_PIXIE_INIT) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000025 (MIPS_LOCALPAGE_GOTIDX) 0x1
# GNU-MIPS-NEXT: 0x0000000070000026 (MIPS_LOCAL_GOTIDX) 0x1
# GNU-MIPS-NEXT: 0x0000000070000027 (MIPS_HIDDEN_GOTIDX) 0x1
# GNU-MIPS-NEXT: 0x0000000070000028 (MIPS_PROTECTED_GOTIDX) 0x1
# GNU-MIPS-NEXT: 0x0000000070000029 (MIPS_OPTIONS) 0x1000
# GNU-MIPS-NEXT: 0x000000007000002a (MIPS_INTERFACE) 0x1000
# GNU-MIPS-NEXT: 0x000000007000002b (MIPS_DYNSTR_ALIGN) 0x88888888
# GNU-MIPS-NEXT: 0x000000007000002c (MIPS_INTERFACE_SIZE) 0x10
# GNU-MIPS-NEXT: 0x000000007000002d (MIPS_RLD_TEXT_RESOLVE_ADDR) 0x8
# GNU-MIPS-NEXT: 0x000000007000002e (MIPS_PERF_SUFFIX) 0x0
# GNU-MIPS-NEXT: 0x000000007000002f (MIPS_COMPACT_SIZE) 0x10
# GNU-MIPS-NEXT: 0x0000000070000030 (MIPS_GP_VALUE) 0x1
# GNU-MIPS-NEXT: 0x0000000070000031 (MIPS_AUX_DYNAMIC) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000032 (MIPS_PLTGOT) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000034 (MIPS_RWPLT) 0x1000
# GNU-MIPS-NEXT: 0x0000000070000035 (MIPS_RLD_MAP_REL) 0x1000
# GNU-MIPS-NEXT: 0x000000001234abcd (unknown) 0x1
# GNU-MIPS-NEXT: 0x0000000000000000 (NULL) 0x0
# Test that PPC64 machine-specific tags can be dumped.
@ -147,10 +145,9 @@
# LLVM-PPC-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-PPC-NEXT: ]
# GNU-PPC: DynamicSection [ (4 entries)
# GNU-PPC: Dynamic section at offset {{.*}} contains 4 entries:
# GNU-PPC-NEXT: Tag Type Name/Value
# GNU-PPC-NEXT: 0x0000000000000004 HASH 0x1000
# GNU-PPC-NEXT: 0x0000000070000000 PPC64_GLINK 0x1000
# GNU-PPC-NEXT: 0x000000001234abcd unknown 0x1
# GNU-PPC-NEXT: 0x0000000000000000 NULL 0x0
# GNU-PPC-NEXT: ]
# GNU-PPC-NEXT: 0x0000000000000004 (HASH) 0x1000
# GNU-PPC-NEXT: 0x0000000070000000 (PPC64_GLINK) 0x1000
# GNU-PPC-NEXT: 0x000000001234abcd (unknown) 0x1
# GNU-PPC-NEXT: 0x0000000000000000 (NULL) 0x0

View File

@ -68,70 +68,69 @@
# LLVM-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-NEXT: ]
# GNU: DynamicSection [ (61 entries)
# GNU: Dynamic section at offset {{.*}} contains 61 entries:
# GNU-NEXT: Tag Type Name/Value
# GNU-NEXT: 0x0000000000000001 NEEDED Shared library: [D]
# GNU-NEXT: 0x0000000000000002 PLTRELSZ 16 (bytes)
# GNU-NEXT: 0x0000000000000003 PLTGOT 0x1000
# GNU-NEXT: 0x0000000000000004 HASH 0x1000
# GNU-NEXT: 0x0000000000000005 STRTAB 0x1000
# GNU-NEXT: 0x0000000000000006 SYMTAB 0x1000
# GNU-NEXT: 0x0000000000000007 RELA 0x1000
# GNU-NEXT: 0x0000000000000008 RELASZ 16 (bytes)
# GNU-NEXT: 0x0000000000000009 RELAENT 1929 (bytes)
# GNU-NEXT: 0x000000000000000a STRSZ 16 (bytes)
# GNU-NEXT: 0x000000000000000b SYMENT 2439 (bytes)
# GNU-NEXT: 0x000000000000000c INIT 0x1000
# GNU-NEXT: 0x000000000000000d FINI 0x1000
# GNU-NEXT: 0x000000000000000e SONAME Library soname: [U]
# GNU-NEXT: 0x000000000000000f RPATH f
# GNU-NEXT: 0x0000000000000010 SYMBOLIC 0x1234567890abcdef
# GNU-NEXT: 0x0000000000000011 REL 0x1000
# GNU-NEXT: 0x0000000000000012 RELSZ 16 (bytes)
# GNU-NEXT: 0x0000000000000013 RELENT 291 (bytes)
# GNU-NEXT: 0x0000000000000014 PLTREL RELA
# GNU-NEXT: 0x0000000000000015 DEBUG 0xfedcba0987654321
# GNU-NEXT: 0x0000000000000016 TEXTREL 0x1122334455667788
# GNU-NEXT: 0x0000000000000017 JMPREL 0x1000
# GNU-NEXT: 0x0000000000000018 BIND_NOW 0x8877665544332211
# GNU-NEXT: 0x0000000000000019 INIT_ARRAY 0x1000
# GNU-NEXT: 0x000000000000001a FINI_ARRAY 0x1000
# GNU-NEXT: 0x000000000000001b INIT_ARRAYSZ 16 (bytes)
# GNU-NEXT: 0x000000000000001c FINI_ARRAYSZ 16 (bytes)
# GNU-NEXT: 0x000000000000001d RUNPATH w
# GNU-NEXT: 0x000000000000001e FLAGS ORIGIN SYMBOLIC TEXTREL BIND_NOW STATIC_TLS {{$}}
# GNU-NEXT: 0x0000000000000020 PREINIT_ARRAY 0x1000
# GNU-NEXT: 0x0000000000000021 PREINIT_ARRAYSZ 16 (bytes)
# GNU-NEXT: 0x0000000000000022 SYMTAB_SHNDX 0x1000
# GNU-NEXT: 0x0000000000000023 RELRSZ 0x10
# GNU-NEXT: 0x0000000000000024 RELR 0x1000
# GNU-NEXT: 0x0000000000000025 RELRENT 0x4321
# GNU-NEXT: 0x000000006000000f ANDROID_REL 0x1000
# GNU-NEXT: 0x0000000060000010 ANDROID_RELSZ 16 (bytes)
# GNU-NEXT: 0x0000000060000011 ANDROID_RELA 0x1000
# GNU-NEXT: 0x0000000060000012 ANDROID_RELASZ 16 (bytes)
# GNU-NEXT: 0x000000006fffe000 ANDROID_RELR 0x1000
# GNU-NEXT: 0x000000006fffe001 ANDROID_RELRSZ 0x10
# GNU-NEXT: 0x000000006fffe003 ANDROID_RELRENT 0x1234
# GNU-NEXT: 0x000000006ffffef5 GNU_HASH 0x1000
# GNU-NEXT: 0x000000006ffffef6 TLSDESC_PLT 0x1000
# GNU-NEXT: 0x000000006ffffef7 TLSDESC_GOT 0x1000
# GNU-NEXT: 0x000000006ffffff9 RELACOUNT 0
# GNU-NEXT: 0x000000006ffffffa RELCOUNT 0
# GNU-NEXT: 0x000000006ffffffb FLAGS_1 NOW GLOBAL GROUP NODELETE LOADFLTR INITFIRST NOOPEN ORIGIN DIRECT TRANS INTERPOSE NODEFLIB NODUMP CONFALT ENDFILTEE DISPRELDNE DISPRELPND NODIRECT IGNMULDEF NOKSYMS NOHDR EDITED NORELOC SYMINTPOSE GLOBAUDIT SINGLETON {{$}}
# GNU-NEXT: 0x000000006ffffff0 VERSYM 0x1000
# GNU-NEXT: 0x000000006ffffffc VERDEF 0x1000
# GNU-NEXT: 0x000000006ffffffd VERDEFNUM 0
# GNU-NEXT: 0x000000006ffffffe VERNEED 0x1000
# GNU-NEXT: 0x000000006fffffff VERNEEDNUM 0
# GNU-NEXT: 0x000000007ffffffd AUXILIARY Auxiliary library: [D]
# GNU-NEXT: 0x000000007ffffffe USED Not needed object: [U]
# GNU-NEXT: 0x000000007fffffff FILTER Filter library: [U]
# GNU-NEXT: 0x0000000012345678 unknown 0x8765432187654321
# GNU-NEXT: 0x000000006abcdef0 unknown 0x9988776655443322
# GNU-NEXT: 0x0000000076543210 unknown 0x5555666677778888
# GNU-NEXT: 0x0000000000000000 NULL 0x0
# GNU-NEXT: ]
# GNU-NEXT: 0x0000000000000001 (NEEDED) Shared library: [D]
# GNU-NEXT: 0x0000000000000002 (PLTRELSZ) 16 (bytes)
# GNU-NEXT: 0x0000000000000003 (PLTGOT) 0x1000
# GNU-NEXT: 0x0000000000000004 (HASH) 0x1000
# GNU-NEXT: 0x0000000000000005 (STRTAB) 0x1000
# GNU-NEXT: 0x0000000000000006 (SYMTAB) 0x1000
# GNU-NEXT: 0x0000000000000007 (RELA) 0x1000
# GNU-NEXT: 0x0000000000000008 (RELASZ) 16 (bytes)
# GNU-NEXT: 0x0000000000000009 (RELAENT) 1929 (bytes)
# GNU-NEXT: 0x000000000000000a (STRSZ) 16 (bytes)
# GNU-NEXT: 0x000000000000000b (SYMENT) 2439 (bytes)
# GNU-NEXT: 0x000000000000000c (INIT) 0x1000
# GNU-NEXT: 0x000000000000000d (FINI) 0x1000
# GNU-NEXT: 0x000000000000000e (SONAME) Library soname: [U]
# GNU-NEXT: 0x000000000000000f (RPATH) f
# GNU-NEXT: 0x0000000000000010 (SYMBOLIC) 0x1234567890abcdef
# GNU-NEXT: 0x0000000000000011 (REL) 0x1000
# GNU-NEXT: 0x0000000000000012 (RELSZ) 16 (bytes)
# GNU-NEXT: 0x0000000000000013 (RELENT) 291 (bytes)
# GNU-NEXT: 0x0000000000000014 (PLTREL) RELA
# GNU-NEXT: 0x0000000000000015 (DEBUG) 0xfedcba0987654321
# GNU-NEXT: 0x0000000000000016 (TEXTREL) 0x1122334455667788
# GNU-NEXT: 0x0000000000000017 (JMPREL) 0x1000
# GNU-NEXT: 0x0000000000000018 (BIND_NOW) 0x8877665544332211
# GNU-NEXT: 0x0000000000000019 (INIT_ARRAY) 0x1000
# GNU-NEXT: 0x000000000000001a (FINI_ARRAY) 0x1000
# GNU-NEXT: 0x000000000000001b (INIT_ARRAYSZ) 16 (bytes)
# GNU-NEXT: 0x000000000000001c (FINI_ARRAYSZ) 16 (bytes)
# GNU-NEXT: 0x000000000000001d (RUNPATH) w
# GNU-NEXT: 0x000000000000001e (FLAGS) ORIGIN SYMBOLIC TEXTREL BIND_NOW STATIC_TLS {{$}}
# GNU-NEXT: 0x0000000000000020 (PREINIT_ARRAY) 0x1000
# GNU-NEXT: 0x0000000000000021 (PREINIT_ARRAYSZ) 16 (bytes)
# GNU-NEXT: 0x0000000000000022 (SYMTAB_SHNDX) 0x1000
# GNU-NEXT: 0x0000000000000023 (RELRSZ) 0x10
# GNU-NEXT: 0x0000000000000024 (RELR) 0x1000
# GNU-NEXT: 0x0000000000000025 (RELRENT) 0x4321
# GNU-NEXT: 0x000000006000000f (ANDROID_REL) 0x1000
# GNU-NEXT: 0x0000000060000010 (ANDROID_RELSZ) 16 (bytes)
# GNU-NEXT: 0x0000000060000011 (ANDROID_RELA) 0x1000
# GNU-NEXT: 0x0000000060000012 (ANDROID_RELASZ) 16 (bytes)
# GNU-NEXT: 0x000000006fffe000 (ANDROID_RELR) 0x1000
# GNU-NEXT: 0x000000006fffe001 (ANDROID_RELRSZ) 0x10
# GNU-NEXT: 0x000000006fffe003 (ANDROID_RELRENT) 0x1234
# GNU-NEXT: 0x000000006ffffef5 (GNU_HASH) 0x1000
# GNU-NEXT: 0x000000006ffffef6 (TLSDESC_PLT) 0x1000
# GNU-NEXT: 0x000000006ffffef7 (TLSDESC_GOT) 0x1000
# GNU-NEXT: 0x000000006ffffff9 (RELACOUNT) 0
# GNU-NEXT: 0x000000006ffffffa (RELCOUNT) 0
# GNU-NEXT: 0x000000006ffffffb (FLAGS_1) NOW GLOBAL GROUP NODELETE LOADFLTR INITFIRST NOOPEN ORIGIN DIRECT TRANS INTERPOSE NODEFLIB NODUMP CONFALT ENDFILTEE DISPRELDNE DISPRELPND NODIRECT IGNMULDEF NOKSYMS NOHDR EDITED NORELOC SYMINTPOSE GLOBAUDIT SINGLETON {{$}}
# GNU-NEXT: 0x000000006ffffff0 (VERSYM) 0x1000
# GNU-NEXT: 0x000000006ffffffc (VERDEF) 0x1000
# GNU-NEXT: 0x000000006ffffffd (VERDEFNUM) 0
# GNU-NEXT: 0x000000006ffffffe (VERNEED) 0x1000
# GNU-NEXT: 0x000000006fffffff (VERNEEDNUM) 0
# GNU-NEXT: 0x000000007ffffffd (AUXILIARY) Auxiliary library: [D]
# GNU-NEXT: 0x000000007ffffffe (USED) Not needed object: [U]
# GNU-NEXT: 0x000000007fffffff (FILTER) Filter library: [U]
# GNU-NEXT: 0x0000000012345678 (unknown) 0x8765432187654321
# GNU-NEXT: 0x000000006abcdef0 (unknown) 0x9988776655443322
# GNU-NEXT: 0x0000000076543210 (unknown) 0x5555666677778888
# GNU-NEXT: 0x0000000000000000 (NULL) 0x0
--- !ELF
FileHeader:

View File

@ -5,15 +5,23 @@
## We check that we warn about this case.
# RUN: yaml2obj --docnum=1 %s -o %t.o
# RUN: llvm-readobj --dynamic-table %t.o 2>&1 | FileCheck %s --check-prefixes=WARNING,CHECK
# RUN: llvm-readelf --dynamic-table %t.o 2>&1 | FileCheck %s --check-prefixes=WARNING,CHECK
# RUN: llvm-readobj --dynamic-table %t.o 2>&1 \
# RUN: | FileCheck %s --check-prefixes=WARNING,LLVM
# RUN: llvm-readelf --dynamic-table %t.o 2>&1 \
# RUN: | FileCheck %s --check-prefixes=WARNING,GNU
# WARNING: warning: The SHT_DYNAMIC section '.dynamic' is not at the start of PT_DYNAMIC segment
# CHECK: DynamicSection [ (2 entries)
# CHECK-NEXT: Tag Type Name/Value
# CHECK-NEXT: 0x0000000000000018 BIND_NOW 0x1
# CHECK-NEXT: 0x0000000000000000 NULL 0x0
# CHECK-NEXT: ]
# LLVM: DynamicSection [ (2 entries)
# LLVM-NEXT: Tag Type Name/Value
# LLVM-NEXT: 0x0000000000000018 BIND_NOW 0x1
# LLVM-NEXT: 0x0000000000000000 NULL 0x0
# LLVM-NEXT: ]
# GNU: Dynamic section at offset 0x{{.*}} contains 2 entries:
# GNU-NEXT: Tag Type Name/Value
# GNU-NEXT: 0x0000000000000018 (BIND_NOW) 0x1
# GNU-NEXT: 0x0000000000000000 (NULL) 0x0
--- !ELF
FileHeader:

View File

@ -73,9 +73,9 @@ LLVM-VERDEF-NEXT: Predecessor: VERSION1
LLVM-VERDEF-NEXT: }
LLVM-VERDEF-NEXT: }
GNU-VERDEF: 0x000000006ffffff0 VERSYM 0x24c
GNU-VERDEF: 0x000000006ffffffc VERDEF 0x25c
GNU-VERDEF: 0x000000006ffffffd VERDEFNUM 3
GNU-VERDEF: 0x000000006ffffff0 (VERSYM) 0x24c
GNU-VERDEF: 0x000000006ffffffc (VERDEF) 0x25c
GNU-VERDEF: 0x000000006ffffffd (VERDEFNUM) 3
GNU-VERDEF: Version symbols section '.gnu.version' contains 8 entries:
GNU-VERDEF-NEXT: Addr: 000000000000024c Offset: 0x00024c Link: 1 (.dynsym)

View File

@ -206,8 +206,6 @@ private:
void loadDynamicTable(const ELFFile<ELFT> *Obj);
void parseDynamicTable();
void printValue(uint64_t Type, uint64_t Value);
StringRef getDynamicString(uint64_t Offset) const;
StringRef getSymbolVersion(StringRef StrTab, const Elf_Sym *symb,
bool &IsDefault) const;
@ -262,7 +260,18 @@ private:
public:
Elf_Dyn_Range dynamic_table() const {
return DynamicTable.getAsArrayRef<Elf_Dyn>();
// A valid .dynamic section contains an array of entries terminated
// with a DT_NULL entry. However, sometimes the section content may
// continue past the DT_NULL entry, so to dump the section correctly,
// we first find the end of the entries by iterating over them.
Elf_Dyn_Range Table = DynamicTable.getAsArrayRef<Elf_Dyn>();
size_t Size = 0;
while (Size < Table.size())
if (Table[Size++].getTag() == DT_NULL)
break;
return Table.slice(0, Size);
}
Elf_Sym_Range dynamic_symbols() const {
@ -283,6 +292,8 @@ public:
bool &IsDefault) const;
void printSymbolsHelper(bool IsDynamic) const;
void printDynamicEntry(raw_ostream &OS, uint64_t Type, uint64_t Value) const;
const Elf_Shdr *getDotSymtabSec() const { return DotSymtabSec; }
const Elf_Shdr *getDotCGProfileSec() const { return DotCGProfileSec; }
const Elf_Shdr *getDotAddrsigSec() const { return DotAddrsigSec; }
@ -292,6 +303,7 @@ public:
const DynRegionInfo &getDynRelaRegion() const { return DynRelaRegion; }
const DynRegionInfo &getDynRelrRegion() const { return DynRelrRegion; }
const DynRegionInfo &getDynPLTRelRegion() const { return DynPLTRelRegion; }
const DynRegionInfo &getDynamicTableRegion() const { return DynamicTable; }
const Elf_Hash *getHashTable() const { return HashTable; }
const Elf_GnuHash *getGnuHashTable() const { return GnuHashTable; }
};
@ -340,6 +352,7 @@ public:
virtual void printSymbols(const ELFFile<ELFT> *Obj, bool PrintSymbols,
bool PrintDynamicSymbols) = 0;
virtual void printHashSymbols(const ELFFile<ELFT> *Obj) {}
virtual void printDynamic(const ELFFile<ELFT> *Obj) {}
virtual void printDynamicRelocations(const ELFFile<ELFT> *Obj) = 0;
virtual void printSymtabMessage(const ELFFile<ELFT> *Obj, StringRef Name,
size_t Offset) {}
@ -384,6 +397,7 @@ public:
void printSymbols(const ELFO *Obj, bool PrintSymbols,
bool PrintDynamicSymbols) override;
void printHashSymbols(const ELFO *Obj) override;
void printDynamic(const ELFFile<ELFT> *Obj) override;
void printDynamicRelocations(const ELFO *Obj) override;
void printSymtabMessage(const ELFO *Obj, StringRef Name,
size_t Offset) override;
@ -488,6 +502,7 @@ public:
void printSectionHeaders(const ELFO *Obj) override;
void printSymbols(const ELFO *Obj, bool PrintSymbols,
bool PrintDynamicSymbols) override;
void printDynamic(const ELFFile<ELFT> *Obj) override;
void printDynamicRelocations(const ELFO *Obj) override;
void printProgramHeaders(const ELFO *Obj, bool PrintProgramHeaders,
cl::boolOrDefault PrintSectionMapping) override;
@ -1764,8 +1779,8 @@ static void printLibrary(raw_ostream &OS, const Twine &Tag, const Twine &Name) {
}
template <class ELFT>
void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
raw_ostream &OS = W.getOStream();
void ELFDumper<ELFT>::printDynamicEntry(raw_ostream &OS, uint64_t Type,
uint64_t Value) const {
const char *ConvChar =
(opts::Output == opts::GNU) ? "0x%" PRIx64 : "0x%" PRIX64;
switch (Type) {
@ -1883,41 +1898,7 @@ template <> void ELFDumper<ELF32LE>::printUnwindInfo() {
} // end anonymous namespace
template <class ELFT> void ELFDumper<ELFT>::printDynamicTable() {
// A valid .dynamic section contains an array of entries terminated with
// a DT_NULL entry. However, sometimes the section content may continue
// past the DT_NULL entry, so to dump the section correctly, we first find
// the end of the entries by iterating over them.
size_t Size = 0;
Elf_Dyn_Range DynTableEntries = dynamic_table();
for (; Size < DynTableEntries.size();)
if (DynTableEntries[Size++].getTag() == DT_NULL)
break;
if (!Size)
return;
raw_ostream &OS = W.getOStream();
W.startLine() << "DynamicSection [ (" << Size << " entries)\n";
bool Is64 = ELFT::Is64Bits;
W.startLine() << " Tag" << (Is64 ? " " : " ") << "Type"
<< " "
<< "Name/Value\n";
for (size_t I = 0; I < Size; ++I) {
const Elf_Dyn &Entry = DynTableEntries[I];
uintX_t Tag = Entry.getTag();
W.startLine() << " "
<< format_hex(Tag, Is64 ? 18 : 10, opts::Output != opts::GNU)
<< " "
<< format(
"%-21s",
getTypeString(
ObjF->getELFFile()->getHeader()->e_machine, Tag));
printValue(Tag, Entry.getVal());
OS << "\n";
}
W.startLine() << "]\n";
ELFDumperStyle->printDynamic(ObjF->getELFFile());
}
template <class ELFT> void ELFDumper<ELFT>::printNeededLibraries() {
@ -3344,6 +3325,35 @@ void GNUStyle<ELFT>::printDynamicRelocation(const ELFO *Obj, Elf_Rela R,
printRelocation(Obj, Sym, SymbolName, R, IsRela);
}
template <class ELFT> void GNUStyle<ELFT>::printDynamic(const ELFO *Obj) {
Elf_Dyn_Range Table = this->dumper()->dynamic_table();
if (Table.empty())
return;
const DynRegionInfo &DynamicTableRegion =
this->dumper()->getDynamicTableRegion();
OS << "Dynamic section at offset "
<< format_hex(reinterpret_cast<const uint8_t *>(DynamicTableRegion.Addr) -
Obj->base(),
1)
<< " contains " << Table.size() << " entries:\n";
bool Is64 = ELFT::Is64Bits;
if (Is64)
OS << " Tag Type Name/Value\n";
else
OS << " Tag Type Name/Value\n";
for (auto Entry : Table) {
uintX_t Tag = Entry.getTag();
std::string TypeString = getTypeString(Obj->getHeader()->e_machine, Tag);
OS << format(" 0x%0*x %-20s ", Is64 ? 16 : 8, Tag,
("(" + TypeString + ")").c_str());
this->dumper()->printDynamicEntry(OS, Tag, Entry.getVal());
OS << "\n";
}
}
template <class ELFT>
void GNUStyle<ELFT>::printDynamicRelocations(const ELFO *Obj) {
const DynRegionInfo &DynRelRegion = this->dumper()->getDynRelRegion();
@ -4502,6 +4512,31 @@ void LLVMStyle<ELFT>::printDynamicSymbols(const ELFO *Obj) {
this->dumper()->printSymbolsHelper(true);
}
template <class ELFT> void LLVMStyle<ELFT>::printDynamic(const ELFFile<ELFT> *Obj) {
Elf_Dyn_Range Table = this->dumper()->dynamic_table();
if (Table.empty())
return;
raw_ostream &OS = W.getOStream();
W.startLine() << "DynamicSection [ (" << Table.size() << " entries)\n";
bool Is64 = ELFT::Is64Bits;
if (Is64)
W.startLine() << " Tag Type Name/Value\n";
else
W.startLine() << " Tag Type Name/Value\n";
for (auto Entry : Table) {
uintX_t Tag = Entry.getTag();
W.startLine() << " " << format_hex(Tag, Is64 ? 18 : 10, true) << " "
<< format("%-21s",
getTypeString(Obj->getHeader()->e_machine, Tag));
this->dumper()->printDynamicEntry(OS, Tag, Entry.getVal());
OS << "\n";
}
W.startLine() << "]\n";
}
template <class ELFT>
void LLVMStyle<ELFT>::printDynamicRelocations(const ELFO *Obj) {
const DynRegionInfo &DynRelRegion = this->dumper()->getDynRelRegion();