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 index 00000000000..4b907694e80 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 index 00000000000..3c3d0eefaad --- /dev/null +++ b/test/tools/llvm-readobj/elf-versioninfo.test @@ -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 diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp index 2f07f47919e..5b4a78cf52f 100644 --- a/tools/llvm-readobj/ELFDumper.cpp +++ b/tools/llvm-readobj/ELFDumper.cpp @@ -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::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::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: