From 677dd5b4043214b3c1bd07859fd6d82a7524f9b0 Mon Sep 17 00:00:00 2001 From: George Rimar Date: Fri, 2 Sep 2016 07:35:19 +0000 Subject: [PATCH] [llvm-readobj] - Teach readobj to print DT_AUXILIARY dynamic tag in human readable form. Previously DT_AUXILIARY was unknown, patch fixes that. Differential revision: https://reviews.llvm.org/D24138 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@280471 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../llvm-readobj/Inputs/dynamic-table-so.x86 | Bin 0 -> 8280 bytes .../tools/llvm-readobj/Inputs/dynamic-table.c | 2 + test/tools/llvm-readobj/dynamic.test | 36 ++++++++++++++++++ tools/llvm-readobj/ELFDumper.cpp | 4 ++ 4 files changed, 42 insertions(+) create mode 100644 test/tools/llvm-readobj/Inputs/dynamic-table-so.x86 diff --git a/test/tools/llvm-readobj/Inputs/dynamic-table-so.x86 b/test/tools/llvm-readobj/Inputs/dynamic-table-so.x86 new file mode 100644 index 0000000000000000000000000000000000000000..fb9d37881c983a9e60c81433dec62329f26fea47 GIT binary patch literal 8280 zcmeHMU2Ggz6+Y{=6DLmXP5Kj)6lD}O!bW&lJF(*uLe@X)Od=C_NnT)-=_NKGD zW_LE&QAHx9R5nqh3L!*!K#{7#OCCx^1XU%}lBfjKhZLw3sV^3&%37_!6#@mRcsb|J zIpf*c*{b5DFS*w2Ip;e+_s*R=cg{V&kQ^UtibOzK6utr^&2Ms%1S>i}!wixH48mso z{VeQKwk;c~I&QSpg@giV3ZOoyi`x$<5visap=X+0e2%I3kw|_O_N%a;&=tNFq1-)= z7oZuhM*X2mHL{^5^sDbVDdKNZfDrnq3xiPcdlLP43fbc0NsQGK++U+{#(6%3^6f$t z{kP&J^SbmqEdtGnZo+7)DE@Hroe!2uOKq?H?T63Y`OY^UJ$vD&&%Ao&!}j<8{Ev22 zH*8U8g;>bVL@}y7FL9=M&_wXjYsl~L$-@4q0Z#X!iII<54e-GR_ypp6eg4A!5}6q6 zgm_F7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XUqRB literal 0 HcmV?d00001 diff --git a/test/tools/llvm-readobj/Inputs/dynamic-table.c b/test/tools/llvm-readobj/Inputs/dynamic-table.c index 2804653794b..b5251f87ee5 100644 --- a/test/tools/llvm-readobj/Inputs/dynamic-table.c +++ b/test/tools/llvm-readobj/Inputs/dynamic-table.c @@ -1,3 +1,5 @@ +// clang -target x86_64-linux-gnu -shared -fPIC -lc dynamic-table.c \ +// -o dynamic-table-so.x86 -Wl,-f,aux_val // clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \ // -o dynamic-table-so.mips // clang -target mipsel-linux-gnu -lc dynamic-table.c \ diff --git a/test/tools/llvm-readobj/dynamic.test b/test/tools/llvm-readobj/dynamic.test index b905742e35f..5079d355695 100644 --- a/test/tools/llvm-readobj/dynamic.test +++ b/test/tools/llvm-readobj/dynamic.test @@ -112,6 +112,42 @@ ELF-X86-EXE: 0x6FFFFFFA RELCOUNT 6 ELF-X86-EXE: 0x00000000 NULL 0x0 ELF-X86-EXE: ] +RUN: llvm-readobj -dynamic-table %p/Inputs/dynamic-table-so.x86 \ +RUN: | FileCheck %s -check-prefix ELF-X86-SO + +ELF-X86-SO: Format: ELF64-x86-64 +ELF-X86-SO: Arch: x86_64 +ELF-X86-SO: AddressSize: 64bit +ELF-X86-SO: LoadName: +ELF-X86-SO: DynamicSection [ (26 entries) +ELF-X86-SO: Tag Type Name/Value +ELF-X86-SO: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6) +ELF-X86-SO: 0x0000000000000001 NEEDED SharedLibrary (ld-linux-x86-64.so.2) +ELF-X86-SO: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [aux_val] +ELF-X86-SO: 0x000000000000000C INIT 0x610 +ELF-X86-SO: 0x000000000000000D FINI 0x7AC +ELF-X86-SO: 0x0000000000000019 INIT_ARRAY 0x200DD0 +ELF-X86-SO: 0x000000000000001B INIT_ARRAYSZ 8 (bytes) +ELF-X86-SO: 0x000000000000001A FINI_ARRAY 0x200DD8 +ELF-X86-SO: 0x000000000000001C FINI_ARRAYSZ 8 (bytes) +ELF-X86-SO: 0x000000006FFFFEF5 GNU_HASH 0x1C8 +ELF-X86-SO: 0x0000000000000005 STRTAB 0x3A0 +ELF-X86-SO: 0x0000000000000006 SYMTAB 0x208 +ELF-X86-SO: 0x000000000000000A STRSZ 231 (bytes) +ELF-X86-SO: 0x000000000000000B SYMENT 24 (bytes) +ELF-X86-SO: 0x0000000000000003 PLTGOT 0x201000 +ELF-X86-SO: 0x0000000000000002 PLTRELSZ 48 (bytes) +ELF-X86-SO: 0x0000000000000014 PLTREL RELA +ELF-X86-SO: 0x0000000000000017 JMPREL 0x5E0 +ELF-X86-SO: 0x0000000000000007 RELA 0x4F0 +ELF-X86-SO: 0x0000000000000008 RELASZ 240 (bytes) +ELF-X86-SO: 0x0000000000000009 RELAENT 24 (bytes) +ELF-X86-SO: 0x000000006FFFFFFE VERNEED 0x4B0 +ELF-X86-SO: 0x000000006FFFFFFF VERNEEDNUM 2 +ELF-X86-SO: 0x000000006FFFFFF0 VERSYM 0x488 +ELF-X86-SO: 0x000000006FFFFFF9 RELACOUNT 3 +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 diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp index 9e65de8f471..1c1b69aa31b 100644 --- a/tools/llvm-readobj/ELFDumper.cpp +++ b/tools/llvm-readobj/ELFDumper.cpp @@ -1561,6 +1561,7 @@ static const char *getTypeString(uint64_t Type) { LLVM_READOBJ_TYPE_CASE(MIPS_RLD_MAP); LLVM_READOBJ_TYPE_CASE(MIPS_PLTGOT); LLVM_READOBJ_TYPE_CASE(MIPS_OPTIONS); + LLVM_READOBJ_TYPE_CASE(AUXILIARY); default: return "unknown"; } } @@ -1721,6 +1722,9 @@ void ELFDumper::printValue(uint64_t Type, uint64_t Value) { case DT_SONAME: OS << "LibrarySoname (" << getDynamicString(Value) << ")"; break; + case DT_AUXILIARY: + OS << "Auxiliary library: [" << getDynamicString(Value) << "]"; + break; case DT_RPATH: case DT_RUNPATH: OS << getDynamicString(Value);