mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[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 llvm-svn: 308033
This commit is contained in:
parent
220ad04ad1
commit
d3752565c9
@ -3,7 +3,7 @@ RUN: | FileCheck %s
|
|||||||
|
|
||||||
CHECK: DynamicSection [ (24 entries)
|
CHECK: DynamicSection [ (24 entries)
|
||||||
CHECK: Tag Type Name/Value
|
CHECK: Tag Type Name/Value
|
||||||
CHECK: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
|
CHECK: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
|
||||||
CHECK: 0x000000000000000C INIT 0x4B8
|
CHECK: 0x000000000000000C INIT 0x4B8
|
||||||
CHECK: 0x000000000000000D FINI 0x618
|
CHECK: 0x000000000000000D FINI 0x618
|
||||||
CHECK: 0x0000000000000019 INIT_ARRAY 0x2006C0
|
CHECK: 0x0000000000000019 INIT_ARRAY 0x2006C0
|
||||||
|
@ -302,9 +302,9 @@ ELF: ]
|
|||||||
|
|
||||||
ELF32: DynamicSection [ (9 entries)
|
ELF32: DynamicSection [ (9 entries)
|
||||||
ELF32: Tag Type Name/Value
|
ELF32: Tag Type Name/Value
|
||||||
ELF32: 0x00000001 NEEDED SharedLibrary (libc.so.6)
|
ELF32: 0x00000001 NEEDED Shared library: [libc.so.6]
|
||||||
ELF32: 0x00000001 NEEDED SharedLibrary (libm.so.6)
|
ELF32: 0x00000001 NEEDED Shared library: [libm.so.6]
|
||||||
ELF32: 0x0000000E SONAME LibrarySoname (libfoo.so)
|
ELF32: 0x0000000E SONAME Library soname: [libfoo.so]
|
||||||
ELF32: 0x00000004 HASH {{[0-9a-f]+}}
|
ELF32: 0x00000004 HASH {{[0-9a-f]+}}
|
||||||
ELF32: 0x00000005 STRTAB {{[0-9a-f]+}}
|
ELF32: 0x00000005 STRTAB {{[0-9a-f]+}}
|
||||||
ELF32: 0x00000006 SYMTAB {{[0-9a-f]+}}
|
ELF32: 0x00000006 SYMTAB {{[0-9a-f]+}}
|
||||||
@ -315,9 +315,9 @@ ELF32: ]
|
|||||||
|
|
||||||
ELF64: DynamicSection [ (9 entries)
|
ELF64: DynamicSection [ (9 entries)
|
||||||
ELF64: Tag Type Name/Value
|
ELF64: Tag Type Name/Value
|
||||||
ELF64: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
|
ELF64: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
|
||||||
ELF64: 0x0000000000000001 NEEDED SharedLibrary (libm.so.6)
|
ELF64: 0x0000000000000001 NEEDED Shared library: [libm.so.6]
|
||||||
ELF64: 0x000000000000000E SONAME LibrarySoname (libfoo.so)
|
ELF64: 0x000000000000000E SONAME Library soname: [libfoo.so]
|
||||||
ELF64: 0x0000000000000004 HASH {{[0-9a-f]+}}
|
ELF64: 0x0000000000000004 HASH {{[0-9a-f]+}}
|
||||||
ELF64: 0x0000000000000005 STRTAB {{[0-9a-f]+}}
|
ELF64: 0x0000000000000005 STRTAB {{[0-9a-f]+}}
|
||||||
ELF64: 0x0000000000000006 SYMTAB {{[0-9a-f]+}}
|
ELF64: 0x0000000000000006 SYMTAB {{[0-9a-f]+}}
|
||||||
|
Binary file not shown.
@ -1,10 +1,10 @@
|
|||||||
// clang -target x86_64-linux-gnu -shared -fPIC -lc dynamic-table.c \
|
// clang -target x86_64-linux-gnu -shared -fPIC -lc dynamic-table.c \
|
||||||
// -o dynamic-table-so.x86 -Wl,-f,aux_val
|
// -o dynamic-table-so.x86 -Wl,-f,aux.so -Wl,-F,filter.so
|
||||||
// clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \
|
// clang -target mipsel-linux-gnu -shared -fPIC -lc dynamic-table.c \
|
||||||
// -o dynamic-table-so.mips
|
// -o dynamic-table-so.mips
|
||||||
// clang -target mipsel-linux-gnu -lc dynamic-table.c \
|
// clang -target mipsel-linux-gnu -lc dynamic-table.c \
|
||||||
// -o dynamic-table-exe.mips
|
// -o dynamic-table-exe.mips
|
||||||
// clang -target aarch64-linux-gnu -fPIC -shared dynamic-table.c \
|
// clang -target aarch64-linux-gnu -fPIC -shared dynamic-table.c\
|
||||||
// -o dynamic-table-so.aarch64
|
// -o dynamic-table-so.aarch64
|
||||||
int puts(const char *);
|
int puts(const char *);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ ELF-MIPS: AddressSize: 32bit
|
|||||||
ELF-MIPS: LoadName:
|
ELF-MIPS: LoadName:
|
||||||
ELF-MIPS: DynamicSection [ (23 entries)
|
ELF-MIPS: DynamicSection [ (23 entries)
|
||||||
ELF-MIPS: Tag Type Name/Value
|
ELF-MIPS: Tag Type Name/Value
|
||||||
ELF-MIPS: 0x00000001 NEEDED SharedLibrary (libc.so.6)
|
ELF-MIPS: 0x00000001 NEEDED Shared library: [libc.so.6]
|
||||||
ELF-MIPS: 0x0000000C INIT 0x528
|
ELF-MIPS: 0x0000000C INIT 0x528
|
||||||
ELF-MIPS: 0x0000000D FINI 0x860
|
ELF-MIPS: 0x0000000D FINI 0x860
|
||||||
ELF-MIPS: 0x00000004 HASH 0x210
|
ELF-MIPS: 0x00000004 HASH 0x210
|
||||||
@ -43,7 +43,7 @@ ELF-MIPS-EXE: AddressSize: 32bit
|
|||||||
ELF-MIPS-EXE: LoadName:
|
ELF-MIPS-EXE: LoadName:
|
||||||
ELF-MIPS-EXE: DynamicSection [ (26 entries)
|
ELF-MIPS-EXE: DynamicSection [ (26 entries)
|
||||||
ELF-MIPS-EXE: Tag Type Name/Value
|
ELF-MIPS-EXE: Tag Type Name/Value
|
||||||
ELF-MIPS-EXE: 0x00000001 NEEDED SharedLibrary (libc.so.6)
|
ELF-MIPS-EXE: 0x00000001 NEEDED Shared library: [libc.so.6]
|
||||||
ELF-MIPS-EXE: 0x0000000C INIT 0x400418
|
ELF-MIPS-EXE: 0x0000000C INIT 0x400418
|
||||||
ELF-MIPS-EXE: 0x0000000D FINI 0x4007B0
|
ELF-MIPS-EXE: 0x0000000D FINI 0x4007B0
|
||||||
ELF-MIPS-EXE: 0x00000004 HASH 0x4002B8
|
ELF-MIPS-EXE: 0x00000004 HASH 0x4002B8
|
||||||
@ -80,9 +80,9 @@ ELF-X86-EXE: AddressSize: 32bit
|
|||||||
ELF-X86-EXE: LoadName:
|
ELF-X86-EXE: LoadName:
|
||||||
ELF-X86-EXE: DynamicSection [ (30 entries)
|
ELF-X86-EXE: DynamicSection [ (30 entries)
|
||||||
ELF-X86-EXE: Tag Type Name/Value
|
ELF-X86-EXE: Tag Type Name/Value
|
||||||
ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libstdc++.so.6)
|
ELF-X86-EXE: 0x00000001 NEEDED Shared library: [libstdc++.so.6]
|
||||||
ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libgcc_s.so.1)
|
ELF-X86-EXE: 0x00000001 NEEDED Shared library: [libgcc_s.so.1]
|
||||||
ELF-X86-EXE: 0x00000001 NEEDED SharedLibrary (libc.so.6)
|
ELF-X86-EXE: 0x00000001 NEEDED Shared library: [libc.so.6]
|
||||||
ELF-X86-EXE: 0x0000000C INIT 0x62C
|
ELF-X86-EXE: 0x0000000C INIT 0x62C
|
||||||
ELF-X86-EXE: 0x0000000D FINI 0x920
|
ELF-X86-EXE: 0x0000000D FINI 0x920
|
||||||
ELF-X86-EXE: 0x00000019 INIT_ARRAY 0x19FC
|
ELF-X86-EXE: 0x00000019 INIT_ARRAY 0x19FC
|
||||||
@ -119,32 +119,33 @@ ELF-X86-SO: Format: ELF64-x86-64
|
|||||||
ELF-X86-SO: Arch: x86_64
|
ELF-X86-SO: Arch: x86_64
|
||||||
ELF-X86-SO: AddressSize: 64bit
|
ELF-X86-SO: AddressSize: 64bit
|
||||||
ELF-X86-SO: LoadName:
|
ELF-X86-SO: LoadName:
|
||||||
ELF-X86-SO: DynamicSection [ (26 entries)
|
ELF-X86-SO: DynamicSection [ ({{[0-9]+}} entries)
|
||||||
ELF-X86-SO: Tag Type Name/Value
|
ELF-X86-SO: Tag Type Name/Value
|
||||||
ELF-X86-SO: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
|
ELF-X86-SO: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
|
||||||
ELF-X86-SO: 0x0000000000000001 NEEDED SharedLibrary (ld-linux-x86-64.so.2)
|
ELF-X86-SO: 0x0000000000000001 NEEDED Shared library: [ld-linux-x86-64.so.2]
|
||||||
ELF-X86-SO: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [aux_val]
|
ELF-X86-SO: 0x000000007FFFFFFF FILTER Filter library: [filter.so]
|
||||||
ELF-X86-SO: 0x000000000000000C INIT 0x610
|
ELF-X86-SO: 0x000000007FFFFFFD AUXILIARY Auxiliary library: [aux.so]
|
||||||
ELF-X86-SO: 0x000000000000000D FINI 0x7AC
|
ELF-X86-SO: 0x000000000000000C INIT 0x{{[0-9A-F]+}}
|
||||||
ELF-X86-SO: 0x0000000000000019 INIT_ARRAY 0x200DD0
|
ELF-X86-SO: 0x000000000000000D FINI 0x{{[0-9A-F]+}}
|
||||||
|
ELF-X86-SO: 0x0000000000000019 INIT_ARRAY 0x{{[0-9A-F]+}}
|
||||||
ELF-X86-SO: 0x000000000000001B INIT_ARRAYSZ 8 (bytes)
|
ELF-X86-SO: 0x000000000000001B INIT_ARRAYSZ 8 (bytes)
|
||||||
ELF-X86-SO: 0x000000000000001A FINI_ARRAY 0x200DD8
|
ELF-X86-SO: 0x000000000000001A FINI_ARRAY 0x{{[0-9A-F]+}}
|
||||||
ELF-X86-SO: 0x000000000000001C FINI_ARRAYSZ 8 (bytes)
|
ELF-X86-SO: 0x000000000000001C FINI_ARRAYSZ 8 (bytes)
|
||||||
ELF-X86-SO: 0x000000006FFFFEF5 GNU_HASH 0x1C8
|
ELF-X86-SO: 0x000000006FFFFEF5 GNU_HASH 0x1C8
|
||||||
ELF-X86-SO: 0x0000000000000005 STRTAB 0x3A0
|
ELF-X86-SO: 0x0000000000000005 STRTAB 0x3A0
|
||||||
ELF-X86-SO: 0x0000000000000006 SYMTAB 0x208
|
ELF-X86-SO: 0x0000000000000006 SYMTAB 0x208
|
||||||
ELF-X86-SO: 0x000000000000000A STRSZ 231 (bytes)
|
ELF-X86-SO: 0x000000000000000A STRSZ {{[0-9]+}} (bytes)
|
||||||
ELF-X86-SO: 0x000000000000000B SYMENT 24 (bytes)
|
ELF-X86-SO: 0x000000000000000B SYMENT 24 (bytes)
|
||||||
ELF-X86-SO: 0x0000000000000003 PLTGOT 0x201000
|
ELF-X86-SO: 0x0000000000000003 PLTGOT 0x201000
|
||||||
ELF-X86-SO: 0x0000000000000002 PLTRELSZ 48 (bytes)
|
ELF-X86-SO: 0x0000000000000002 PLTRELSZ 48 (bytes)
|
||||||
ELF-X86-SO: 0x0000000000000014 PLTREL RELA
|
ELF-X86-SO: 0x0000000000000014 PLTREL RELA
|
||||||
ELF-X86-SO: 0x0000000000000017 JMPREL 0x5E0
|
ELF-X86-SO: 0x0000000000000017 JMPREL 0x{{[0-9A-F]+}}
|
||||||
ELF-X86-SO: 0x0000000000000007 RELA 0x4F0
|
ELF-X86-SO: 0x0000000000000007 RELA 0x{{[0-9A-F]+}}
|
||||||
ELF-X86-SO: 0x0000000000000008 RELASZ 240 (bytes)
|
ELF-X86-SO: 0x0000000000000008 RELASZ 240 (bytes)
|
||||||
ELF-X86-SO: 0x0000000000000009 RELAENT 24 (bytes)
|
ELF-X86-SO: 0x0000000000000009 RELAENT 24 (bytes)
|
||||||
ELF-X86-SO: 0x000000006FFFFFFE VERNEED 0x4B0
|
ELF-X86-SO: 0x000000006FFFFFFE VERNEED 0x{{[0-9A-F]+}}
|
||||||
ELF-X86-SO: 0x000000006FFFFFFF VERNEEDNUM 2
|
ELF-X86-SO: 0x000000006FFFFFFF VERNEEDNUM 2
|
||||||
ELF-X86-SO: 0x000000006FFFFFF0 VERSYM 0x488
|
ELF-X86-SO: 0x000000006FFFFFF0 VERSYM 0x{{[0-9A-F]+}}
|
||||||
ELF-X86-SO: 0x000000006FFFFFF9 RELACOUNT 3
|
ELF-X86-SO: 0x000000006FFFFFF9 RELACOUNT 3
|
||||||
ELF-X86-SO: 0x0000000000000000 NULL 0x0
|
ELF-X86-SO: 0x0000000000000000 NULL 0x0
|
||||||
|
|
||||||
@ -157,7 +158,7 @@ ELF-AARCH64-SO: AddressSize: 64bit
|
|||||||
ELF-AARCH64-SO: LoadName:
|
ELF-AARCH64-SO: LoadName:
|
||||||
ELF-AARCH64-SO: DynamicSection [ (26 entries)
|
ELF-AARCH64-SO: DynamicSection [ (26 entries)
|
||||||
ELF-AARCH64-SO: Tag Type Name/Value
|
ELF-AARCH64-SO: Tag Type Name/Value
|
||||||
ELF-AARCH64-SO: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
|
ELF-AARCH64-SO: 0x0000000000000001 NEEDED Shared library: [libc.so.6]
|
||||||
ELF-AARCH64-SO: 0x000000000000000C INIT 0x660
|
ELF-AARCH64-SO: 0x000000000000000C INIT 0x660
|
||||||
ELF-AARCH64-SO: 0x000000000000000D FINI 0x83C
|
ELF-AARCH64-SO: 0x000000000000000D FINI 0x83C
|
||||||
ELF-AARCH64-SO: 0x0000000000000019 INIT_ARRAY 0x10DB8
|
ELF-AARCH64-SO: 0x0000000000000019 INIT_ARRAY 0x10DB8
|
||||||
|
@ -1532,6 +1532,7 @@ static const char *getTypeString(unsigned Arch, uint64_t Type) {
|
|||||||
LLVM_READOBJ_TYPE_CASE(TLSDESC_PLT);
|
LLVM_READOBJ_TYPE_CASE(TLSDESC_PLT);
|
||||||
LLVM_READOBJ_TYPE_CASE(TLSDESC_GOT);
|
LLVM_READOBJ_TYPE_CASE(TLSDESC_GOT);
|
||||||
LLVM_READOBJ_TYPE_CASE(AUXILIARY);
|
LLVM_READOBJ_TYPE_CASE(AUXILIARY);
|
||||||
|
LLVM_READOBJ_TYPE_CASE(FILTER);
|
||||||
default: return "unknown";
|
default: return "unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1624,6 +1625,10 @@ StringRef ELFDumper<ELFT>::getDynamicString(uint64_t Value) const {
|
|||||||
return StringRef(DynamicStringTable.data() + Value);
|
return StringRef(DynamicStringTable.data() + Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void printLibrary(raw_ostream &OS, const Twine &Tag, const Twine &Name) {
|
||||||
|
OS << Tag << ": [" << Name << "]";
|
||||||
|
}
|
||||||
|
|
||||||
template <class ELFT>
|
template <class ELFT>
|
||||||
void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
|
void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
|
||||||
raw_ostream &OS = W.getOStream();
|
raw_ostream &OS = W.getOStream();
|
||||||
@ -1687,13 +1692,16 @@ void ELFDumper<ELFT>::printValue(uint64_t Type, uint64_t Value) {
|
|||||||
OS << Value << " (bytes)";
|
OS << Value << " (bytes)";
|
||||||
break;
|
break;
|
||||||
case DT_NEEDED:
|
case DT_NEEDED:
|
||||||
OS << "SharedLibrary (" << getDynamicString(Value) << ")";
|
printLibrary(OS, "Shared library", getDynamicString(Value));
|
||||||
break;
|
break;
|
||||||
case DT_SONAME:
|
case DT_SONAME:
|
||||||
OS << "LibrarySoname (" << getDynamicString(Value) << ")";
|
printLibrary(OS, "Library soname", getDynamicString(Value));
|
||||||
break;
|
break;
|
||||||
case DT_AUXILIARY:
|
case DT_AUXILIARY:
|
||||||
OS << "Auxiliary library: [" << getDynamicString(Value) << "]";
|
printLibrary(OS, "Auxiliary library", getDynamicString(Value));
|
||||||
|
break;
|
||||||
|
case DT_FILTER:
|
||||||
|
printLibrary(OS, "Filter library", getDynamicString(Value));
|
||||||
break;
|
break;
|
||||||
case DT_RPATH:
|
case DT_RPATH:
|
||||||
case DT_RUNPATH:
|
case DT_RUNPATH:
|
||||||
|
Loading…
Reference in New Issue
Block a user