llvm.org GIT mirror llvm / 9cdd4dd
[llvm-readobj] - Teach readobj to print DT_FILTER dynamic tag in human readable form. Nothing special here, output format is similar to the format used by binutils readelf and ELF Tool Chain readelf. Differential revision: https://reviews.llvm.org/D35351 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@308033 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 2 years ago
6 changed file(s) with 40 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
22
33 CHECK: DynamicSection [ (24 entries)
44 CHECK: Tag Type Name/Value
5 CHECK: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
5 CHECK: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
66 CHECK: 0x000000000000000C INIT 0x4B8
77 CHECK: 0x000000000000000D FINI 0x618
88 CHECK: 0x0000000000000019 INIT_ARRAY 0x2006C0
301301
302302 ELF32: DynamicSection [ (9 entries)
303303 ELF32: Tag Type Name/Value
304 ELF32: 0x00000001 NEEDED SharedLibrary (libc.so.6)
305 ELF32: 0x00000001 NEEDED SharedLibrary (libm.so.6)
306 ELF32: 0x0000000E SONAME LibrarySoname (libfoo.so)
304 ELF32: 0x00000001 NEEDED Shared library: [libc.so.6]
305 ELF32: 0x00000001 NEEDED Shared library: [libm.so.6]
306 ELF32: 0x0000000E SONAME Library soname: [libfoo.so]
307307 ELF32: 0x00000004 HASH {{[0-9a-f]+}}
308308 ELF32: 0x00000005 STRTAB {{[0-9a-f]+}}
309309 ELF32: 0x00000006 SYMTAB {{[0-9a-f]+}}
314314
315315 ELF64: DynamicSection [ (9 entries)
316316 ELF64: Tag Type Name/Value
317 ELF64: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
318 ELF64: 0x0000000000000001 NEEDED SharedLibrary (libm.so.6)
319 ELF64: 0x000000000000000E SONAME LibrarySoname (libfoo.so)
317 ELF64: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
318 ELF64: 0x0000000000000001 NEEDED Shared library: [libm.so.6]
319 ELF64: 0x000000000000000E SONAME Library soname: [libfoo.so]
320320 ELF64: 0x0000000000000004 HASH {{[0-9a-f]+}}
321321 ELF64: 0x0000000000000005 STRTAB {{[0-9a-f]+}}
322322 ELF64: 0x0000000000000006 SYMTAB {{[0-9a-f]+}}
0 // clang -target x86_64-linux-gnu -shared -fPIC -lc dynamic-table.c \
1 // -o dynamic-table-so.x86 -Wl,-f,aux_val
1 // -o dynamic-table-so.x86 -Wl,-f,aux.so -Wl,-F,filter.so
22 // clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \
33 // -o dynamic-table-so.mips
44 // clang -target mipsel-linux-gnu -lc dynamic-table.c \
55 // -o dynamic-table-exe.mips
6 // clang -target aarch64-linux-gnu -fPIC -shared dynamic-table.c \
6 // clang -target aarch64-linux-gnu -fPIC -shared dynamic-table.c\
77 // -o dynamic-table-so.aarch64
88 int puts(const char *);
99
77 ELF-MIPS: LoadName:
88 ELF-MIPS: DynamicSection [ (23 entries)
99 ELF-MIPS: Tag Type Name/Value
10 ELF-MIPS: 0x00000001 NEEDED SharedLibrary (libc.so.6)
10 ELF-MIPS: 0x00000001 NEEDED Shared library: [libc.so.6]
1111 ELF-MIPS: 0x0000000C INIT 0x528
1212 ELF-MIPS: 0x0000000D FINI 0x860
1313 ELF-MIPS: 0x00000004 HASH 0x210
4242 ELF-MIPS-EXE: LoadName:
4343 ELF-MIPS-EXE: DynamicSection [ (26 entries)
4444 ELF-MIPS-EXE: Tag Type Name/Value
45 ELF-MIPS-EXE: 0x00000001 NEEDED SharedLibrary (libc.so.6)
45 ELF-MIPS-EXE: 0x00000001 NEEDED Shared library: [libc.so.6]
4646 ELF-MIPS-EXE: 0x0000000C INIT 0x400418
4747 ELF-MIPS-EXE: 0x0000000D FINI 0x4007B0
4848 ELF-MIPS-EXE: 0x00000004 HASH 0x4002B8
7979 ELF-X86-EXE: LoadName:
8080 ELF-X86-EXE: DynamicSection [ (30 entries)
8181 ELF-X86-EXE: Tag Type Name/Value
82 ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libstdc++.so.6)
83 ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libgcc_s.so.1)
84 ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libc.so.6)
82 ELF-X86-EXE: 0x00000001 NEEDED Shared library: [libstdc++.so.6]
83 ELF-X86-EXE: 0x00000001 NEEDED Shared library: [libgcc_s.so.1]
84 ELF-X86-EXE: 0x00000001 NEEDED Shared library: [libc.so.6]
8585 ELF-X86-EXE: 0x0000000C INIT 0x62C
8686 ELF-X86-EXE: 0x0000000D FINI 0x920
8787 ELF-X86-EXE: 0x00000019 INIT_ARRAY 0x19FC
118118 ELF-X86-SO: Arch: x86_64
119119 ELF-X86-SO: AddressSize: 64bit
120120 ELF-X86-SO: LoadName:
121 ELF-X86-SO: DynamicSection [ (26 entries)
121 ELF-X86-SO: DynamicSection [ ({{[0-9]+}} entries)
122122 ELF-X86-SO: Tag Type Name/Value
123 ELF-X86-SO: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
124 ELF-X86-SO: 0x0000000000000001 NEEDED SharedLibrary (ld-linux-x86-64.so.2)
125 ELF-X86-SO: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [aux_val]
126 ELF-X86-SO: 0x000000000000000C INIT 0x610
127 ELF-X86-SO: 0x000000000000000D FINI 0x7AC
128 ELF-X86-SO: 0x0000000000000019 INIT_ARRAY 0x200DD0
123 ELF-X86-SO: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
124 ELF-X86-SO: 0x0000000000000001 NEEDED Shared library: [ld-linux-x86-64.so.2]
125 ELF-X86-SO: 0x000000007FFFFFFF FILTER Filter library: [filter.so]
126 ELF-X86-SO: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [aux.so]
127 ELF-X86-SO: 0x000000000000000C INIT 0x{{[0-9A-F]+}}
128 ELF-X86-SO: 0x000000000000000D FINI 0x{{[0-9A-F]+}}
129 ELF-X86-SO: 0x0000000000000019 INIT_ARRAY 0x{{[0-9A-F]+}}
129130 ELF-X86-SO: 0x000000000000001B INIT_ARRAYSZ 8 (bytes)
130 ELF-X86-SO: 0x000000000000001A FINI_ARRAY 0x200DD8
131 ELF-X86-SO: 0x000000000000001A FINI_ARRAY 0x{{[0-9A-F]+}}
131132 ELF-X86-SO: 0x000000000000001C FINI_ARRAYSZ 8 (bytes)
132133 ELF-X86-SO: 0x000000006FFFFEF5 GNU_HASH 0x1C8
133134 ELF-X86-SO: 0x0000000000000005 STRTAB 0x3A0
134135 ELF-X86-SO: 0x0000000000000006 SYMTAB 0x208
135 ELF-X86-SO: 0x000000000000000A STRSZ 231 (bytes)
136 ELF-X86-SO: 0x000000000000000A STRSZ {{[0-9]+}} (bytes)
136137 ELF-X86-SO: 0x000000000000000B SYMENT 24 (bytes)
137138 ELF-X86-SO: 0x0000000000000003 PLTGOT 0x201000
138139 ELF-X86-SO: 0x0000000000000002 PLTRELSZ 48 (bytes)
139140 ELF-X86-SO: 0x0000000000000014 PLTREL RELA
140 ELF-X86-SO: 0x0000000000000017 JMPREL 0x5E0
141 ELF-X86-SO: 0x0000000000000007 RELA 0x4F0
141 ELF-X86-SO: 0x0000000000000017 JMPREL 0x{{[0-9A-F]+}}
142 ELF-X86-SO: 0x0000000000000007 RELA 0x{{[0-9A-F]+}}
142143 ELF-X86-SO: 0x0000000000000008 RELASZ 240 (bytes)
143144 ELF-X86-SO: 0x0000000000000009 RELAENT 24 (bytes)
144 ELF-X86-SO: 0x000000006FFFFFFE VERNEED 0x4B0
145 ELF-X86-SO: 0x000000006FFFFFFE VERNEED 0x{{[0-9A-F]+}}
145146 ELF-X86-SO: 0x000000006FFFFFFF VERNEEDNUM 2
146 ELF-X86-SO: 0x000000006FFFFFF0 VERSYM 0x488
147 ELF-X86-SO: 0x000000006FFFFFF0 VERSYM 0x{{[0-9A-F]+}}
147148 ELF-X86-SO: 0x000000006FFFFFF9 RELACOUNT 3
148149 ELF-X86-SO: 0x0000000000000000 NULL 0x0
149150
156157 ELF-AARCH64-SO: LoadName:
157158 ELF-AARCH64-SO: DynamicSection [ (26 entries)
158159 ELF-AARCH64-SO: Tag Type Name/Value
159 ELF-AARCH64-SO: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
160 ELF-AARCH64-SO: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
160161 ELF-AARCH64-SO: 0x000000000000000C INIT 0x660
161162 ELF-AARCH64-SO: 0x000000000000000D FINI 0x83C
162163 ELF-AARCH64-SO: 0x0000000000000019 INIT_ARRAY 0x10DB8
15311531 LLVM_READOBJ_TYPE_CASE(TLSDESC_PLT);
15321532 LLVM_READOBJ_TYPE_CASE(TLSDESC_GOT);
15331533 LLVM_READOBJ_TYPE_CASE(AUXILIARY);
1534 LLVM_READOBJ_TYPE_CASE(FILTER);
15341535 default: return "unknown";
15351536 }
15361537 }
16211622 if (Value >= DynamicStringTable.size())
16221623 reportError("Invalid dynamic string table reference");
16231624 return StringRef(DynamicStringTable.data() + Value);
1625 }
1626
1627 static void printLibrary(raw_ostream &OS, const Twine &Tag, const Twine &Name) {
1628 OS << Tag << ": [" << Name << "]";
16241629 }
16251630
16261631 template
16861691 OS << Value << " (bytes)";
16871692 break;
16881693 case DT_NEEDED:
1689 OS << "SharedLibrary (" << getDynamicString(Value) << ")";
1694 printLibrary(OS, "Shared library", getDynamicString(Value));
16901695 break;
16911696 case DT_SONAME:
1692 OS << "LibrarySoname (" << getDynamicString(Value) << ")";
1697 printLibrary(OS, "Library soname", getDynamicString(Value));
16931698 break;
16941699 case DT_AUXILIARY:
1695 OS << "Auxiliary library: [" << getDynamicString(Value) << "]";
1700 printLibrary(OS, "Auxiliary library", getDynamicString(Value));
1701 break;
1702 case DT_FILTER:
1703 printLibrary(OS, "Filter library", getDynamicString(Value));
16961704 break;
16971705 case DT_RPATH:
16981706 case DT_RUNPATH: