[llvm-readobj/ELF] Dump DT_VERDEF/DT_VERDEFNUM correctly.
authorDavide Italiano <davide@freebsd.org>
Thu, 15 Oct 2015 22:04:55 +0000 (22:04 +0000)
committerDavide Italiano <davide@freebsd.org>
Thu, 15 Oct 2015 22:04:55 +0000 (22:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250464 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-readobj/Inputs/verdef.elf-x86-64 [new file with mode: 0755]
test/tools/llvm-readobj/elf-versioninfo.test [new file with mode: 0644]
tools/llvm-readobj/ELFDumper.cpp

diff --git a/test/tools/llvm-readobj/Inputs/verdef.elf-x86-64 b/test/tools/llvm-readobj/Inputs/verdef.elf-x86-64
new file mode 100755 (executable)
index 0000000..4b90769
Binary files /dev/null and b/test/tools/llvm-readobj/Inputs/verdef.elf-x86-64 differ
diff --git a/test/tools/llvm-readobj/elf-versioninfo.test b/test/tools/llvm-readobj/elf-versioninfo.test
new file mode 100644 (file)
index 0000000..3c3d0ee
--- /dev/null
@@ -0,0 +1,7 @@
+// Test that llvm-readobj dumps version info tags correctly.
+
+RUN: llvm-readobj -dynamic-table %p/Inputs/verdef.elf-x86-64 | FileCheck %s
+
+CHECK: 0x000000006FFFFFF0 VERSYM               0x24C
+CHECK: 0x000000006FFFFFFC VERDEF               0x25C
+CHECK: 0x000000006FFFFFFD VERDEFNUM            3
index 2f07f47..5b4a78c 100644 (file)
@@ -1244,6 +1244,8 @@ static const char *getTypeString(uint64_t Type) {
   LLVM_READOBJ_TYPE_CASE(SYMENT);
   LLVM_READOBJ_TYPE_CASE(SYMTAB);
   LLVM_READOBJ_TYPE_CASE(TEXTREL);
+  LLVM_READOBJ_TYPE_CASE(VERDEF);
+  LLVM_READOBJ_TYPE_CASE(VERDEFNUM);
   LLVM_READOBJ_TYPE_CASE(VERNEED);
   LLVM_READOBJ_TYPE_CASE(VERNEEDNUM);
   LLVM_READOBJ_TYPE_CASE(VERSYM);
@@ -1378,6 +1380,7 @@ void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
   case DT_FINI_ARRAY:
   case DT_PREINIT_ARRAY:
   case DT_DEBUG:
+  case DT_VERDEF:
   case DT_VERNEED:
   case DT_VERSYM:
   case DT_GNU_HASH:
@@ -1391,6 +1394,7 @@ void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
     OS << format("0x%" PRIX64, Value);
     break;
   case DT_RELCOUNT:
+  case DT_VERDEFNUM:
   case DT_VERNEEDNUM:
   case DT_MIPS_RLD_VERSION:
   case DT_MIPS_LOCAL_GOTNO: