[llvm] 26a8ceb - [llvm-readobj] Display DT_RELRSZ/DT_RELRENT as " (bytes)"
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 5 10:02:53 PDT 2021
Author: Fangrui Song
Date: 2021-11-05T10:02:49-07:00
New Revision: 26a8ceba3ece38beac4ac10a2c55df2852536e64
URL: https://github.com/llvm/llvm-project/commit/26a8ceba3ece38beac4ac10a2c55df2852536e64
DIFF: https://github.com/llvm/llvm-project/commit/26a8ceba3ece38beac4ac10a2c55df2852536e64.diff
LOG: [llvm-readobj] Display DT_RELRSZ/DT_RELRENT as " (bytes)"
to match RELSZ/RELENT.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D113206
Added:
Modified:
lld/test/ELF/pack-dyn-relocs-arm2.s
lld/test/ELF/pack-dyn-relocs.s
llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test
llvm/tools/llvm-readobj/ELFDumper.cpp
Removed:
################################################################################
diff --git a/lld/test/ELF/pack-dyn-relocs-arm2.s b/lld/test/ELF/pack-dyn-relocs-arm2.s
index 0648edba217fb..cf2cd8bb597ec 100644
--- a/lld/test/ELF/pack-dyn-relocs-arm2.s
+++ b/lld/test/ELF/pack-dyn-relocs-arm2.s
@@ -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
diff --git a/lld/test/ELF/pack-dyn-relocs.s b/lld/test/ELF/pack-dyn-relocs.s
index 220addac24518..eed26d824906e 100644
--- a/lld/test/ELF/pack-dyn-relocs.s
+++ b/lld/test/ELF/pack-dyn-relocs.s
@@ -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.
diff --git a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test
index b830079129147..5610ed872df5c 100644
--- a/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test
+++ b/llvm/test/tools/llvm-readobj/ELF/dynamic-tags.test
@@ -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
diff --git a/llvm/tools/llvm-readobj/ELFDumper.cpp b/llvm/tools/llvm-readobj/ELFDumper.cpp
index 855d3f3488faf..4abea0b1d23d9 100644
--- a/llvm/tools/llvm-readobj/ELFDumper.cpp
+++ b/llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -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)";
More information about the llvm-commits
mailing list