[llvm-readobj] Display DT_RELRSZ/DT_RELRENT as " (bytes)"

to match RELSZ/RELENT.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D113206
This commit is contained in:
Fangrui Song 2021-11-05 10:02:49 -07:00
parent c68183b81e
commit 26a8ceba3e
4 changed files with 19 additions and 17 deletions

View File

@ -45,7 +45,7 @@
// CHECK-NEXT: }
// RUN: llvm-readobj -S --dynamic-table %t.exe | FileCheck --check-prefix=HEADER %s
// HEADER: 0x00000023 RELRSZ 0xC
// HEADER: 0x00000023 RELRSZ 12 (bytes)
.data
.align 2

View File

@ -137,8 +137,8 @@
// RELR32-HEADERS-NEXT: EntrySize: 4
// RELR32-HEADERS: 0x00000024 RELR [[ADDR]]
// RELR32-HEADERS: 0x00000023 RELRSZ 0x8
// RELR32-HEADERS: 0x00000025 RELRENT 0x4
// RELR32-HEADERS: 0x00000023 RELRSZ 8 (bytes)
// RELR32-HEADERS: 0x00000025 RELRENT 4 (bytes)
/// SHT_RELR section contains address/bitmap entries
/// encoding the offsets for relative relocation.
@ -319,8 +319,8 @@
// RELR64-HEADERS-NEXT: EntrySize: 8
// RELR64-HEADERS: 0x0000000000000024 RELR [[ADDR]]
// RELR64-HEADERS: 0x0000000000000023 RELRSZ 0x10
// RELR64-HEADERS: 0x0000000000000025 RELRENT 0x8
// RELR64-HEADERS: 0x0000000000000023 RELRSZ 16 (bytes)
// RELR64-HEADERS: 0x0000000000000025 RELRENT 8 (bytes)
/// SHT_RELR section contains address/bitmap entries
/// encoding the offsets for relative relocation.

View File

@ -44,9 +44,9 @@
# LLVM64-NEXT: 0x0000000000000020 PREINIT_ARRAY 0x1000
# LLVM64-NEXT: 0x0000000000000021 PREINIT_ARRAYSZ 16 (bytes)
# LLVM64-NEXT: 0x0000000000000022 SYMTAB_SHNDX 0x1000
# LLVM64-NEXT: 0x0000000000000023 RELRSZ 0x10
# LLVM64-NEXT: 0x0000000000000023 RELRSZ 16 (bytes)
# LLVM64-NEXT: 0x0000000000000024 RELR 0x1000
# LLVM64-NEXT: 0x0000000000000025 RELRENT 0x4321
# LLVM64-NEXT: 0x0000000000000025 RELRENT 17185 (bytes)
# LLVM64-NEXT: 0x000000006000000F ANDROID_REL 0x1000
# LLVM64-NEXT: 0x0000000060000010 ANDROID_RELSZ 16 (bytes)
# LLVM64-NEXT: 0x0000000060000011 ANDROID_RELA 0x1000
@ -109,9 +109,9 @@
# GNU64-NEXT: 0x0000000000000020 (PREINIT_ARRAY) 0x1000
# GNU64-NEXT: 0x0000000000000021 (PREINIT_ARRAYSZ) 16 (bytes)
# GNU64-NEXT: 0x0000000000000022 (SYMTAB_SHNDX) 0x1000
# GNU64-NEXT: 0x0000000000000023 (RELRSZ) 0x10
# GNU64-NEXT: 0x0000000000000023 (RELRSZ) 16 (bytes)
# GNU64-NEXT: 0x0000000000000024 (RELR) 0x1000
# GNU64-NEXT: 0x0000000000000025 (RELRENT) 0x4321
# GNU64-NEXT: 0x0000000000000025 (RELRENT) 17185 (bytes)
# GNU64-NEXT: 0x000000006000000f (ANDROID_REL) 0x1000
# GNU64-NEXT: 0x0000000060000010 (ANDROID_RELSZ) 16 (bytes)
# GNU64-NEXT: 0x0000000060000011 (ANDROID_RELA) 0x1000
@ -335,9 +335,9 @@ ProgramHeaders:
# LLVM32-NEXT: 0x00000020 PREINIT_ARRAY 0x1000
# LLVM32-NEXT: 0x00000021 PREINIT_ARRAYSZ 16 (bytes)
# LLVM32-NEXT: 0x00000022 SYMTAB_SHNDX 0x1000
# LLVM32-NEXT: 0x00000023 RELRSZ 0x10
# LLVM32-NEXT: 0x00000023 RELRSZ 16 (bytes)
# LLVM32-NEXT: 0x00000024 RELR 0x1000
# LLVM32-NEXT: 0x00000025 RELRENT 0x4321
# LLVM32-NEXT: 0x00000025 RELRENT 17185 (bytes)
# LLVM32-NEXT: 0x6000000F ANDROID_REL 0x1000
# LLVM32-NEXT: 0x60000010 ANDROID_RELSZ 16 (bytes)
# LLVM32-NEXT: 0x60000011 ANDROID_RELA 0x1000
@ -400,9 +400,9 @@ ProgramHeaders:
# GNU32-NEXT: 0x00000020 (PREINIT_ARRAY) 0x1000
# GNU32-NEXT: 0x00000021 (PREINIT_ARRAYSZ) 16 (bytes)
# GNU32-NEXT: 0x00000022 (SYMTAB_SHNDX) 0x1000
# GNU32-NEXT: 0x00000023 (RELRSZ) 0x10
# GNU32-NEXT: 0x00000023 (RELRSZ) 16 (bytes)
# GNU32-NEXT: 0x00000024 (RELR) 0x1000
# GNU32-NEXT: 0x00000025 (RELRENT) 0x4321
# GNU32-NEXT: 0x00000025 (RELRENT) 17185 (bytes)
# GNU32-NEXT: 0x6000000f (ANDROID_REL) 0x1000
# GNU32-NEXT: 0x60000010 (ANDROID_RELSZ) 16 (bytes)
# GNU32-NEXT: 0x60000011 (ANDROID_RELA) 0x1000
@ -530,9 +530,9 @@ Sections:
# PHENTSIZE-LLVM-NEXT: 0x0000000000000020 PREINIT_ARRAY 0x1000
# PHENTSIZE-LLVM-NEXT: 0x0000000000000021 PREINIT_ARRAYSZ 16 (bytes)
# PHENTSIZE-LLVM-NEXT: 0x0000000000000022 SYMTAB_SHNDX 0x1000
# PHENTSIZE-LLVM-NEXT: 0x0000000000000023 RELRSZ 0x10
# PHENTSIZE-LLVM-NEXT: 0x0000000000000023 RELRSZ 16 (bytes)
# PHENTSIZE-LLVM-NEXT: 0x0000000000000024 RELR 0x1000
# PHENTSIZE-LLVM-NEXT: 0x0000000000000025 RELRENT 0x4321
# PHENTSIZE-LLVM-NEXT: 0x0000000000000025 RELRENT 17185 (bytes)
# PHENTSIZE-LLVM-NEXT: 0x000000006000000F ANDROID_REL 0x1000
# PHENTSIZE-LLVM-NEXT: 0x0000000060000010 ANDROID_RELSZ 16 (bytes)
# PHENTSIZE-LLVM-NEXT: 0x0000000060000011 ANDROID_RELA 0x1000
@ -596,9 +596,9 @@ Sections:
# PHENTSIZE-GNU-NEXT: 0x0000000000000020 (PREINIT_ARRAY) 0x1000
# PHENTSIZE-GNU-NEXT: 0x0000000000000021 (PREINIT_ARRAYSZ) 16 (bytes)
# PHENTSIZE-GNU-NEXT: 0x0000000000000022 (SYMTAB_SHNDX) 0x1000
# PHENTSIZE-GNU-NEXT: 0x0000000000000023 (RELRSZ) 0x10
# PHENTSIZE-GNU-NEXT: 0x0000000000000023 (RELRSZ) 16 (bytes)
# PHENTSIZE-GNU-NEXT: 0x0000000000000024 (RELR) 0x1000
# PHENTSIZE-GNU-NEXT: 0x0000000000000025 (RELRENT) 0x4321
# PHENTSIZE-GNU-NEXT: 0x0000000000000025 (RELRENT) 17185 (bytes)
# PHENTSIZE-GNU-NEXT: 0x000000006000000f (ANDROID_REL) 0x1000
# PHENTSIZE-GNU-NEXT: 0x0000000060000010 (ANDROID_RELSZ) 16 (bytes)
# PHENTSIZE-GNU-NEXT: 0x0000000060000011 (ANDROID_RELA) 0x1000

View File

@ -2298,6 +2298,8 @@ std::string ELFDumper<ELFT>::getDynamicEntry(uint64_t Type,
case DT_INIT_ARRAYSZ:
case DT_FINI_ARRAYSZ:
case DT_PREINIT_ARRAYSZ:
case DT_RELRSZ:
case DT_RELRENT:
case DT_ANDROID_RELSZ:
case DT_ANDROID_RELASZ:
return std::to_string(Value) + " (bytes)";