Fix printing of 64 bit values and make test more strict.

llvm-svn: 249043
This commit is contained in:
Rafael Espindola 2015-10-01 17:57:31 +00:00
parent e835f56682
commit 154404108e
2 changed files with 30 additions and 17 deletions

View File

@ -300,18 +300,32 @@ ELF: Section: Absolute (0xFFF1)
ELF: }
ELF: ]
ELF: DynamicSection [ (9 entries)
ELF: Tag Type Name/Value
ELF: 00000001 NEEDED SharedLibrary (libc.so.6)
ELF: 00000001 NEEDED SharedLibrary (libm.so.6)
ELF: 0000000E SONAME LibrarySoname (libfoo.so)
ELF: 00000004 HASH {{[0-9a-f]+}}
ELF: 00000005 STRTAB {{[0-9a-f]+}}
ELF: 00000006 SYMTAB {{[0-9a-f]+}}
ELF: 0000000A STRSZ {{[0-9]+}} (bytes)
ELF: 0000000B SYMENT {{[0-9]+}} (bytes)
ELF: 00000000 NULL 0x0
ELF: ]
ELF32: DynamicSection [ (9 entries)
ELF32: Tag Type Name/Value
ELF32: 0x00000001 NEEDED SharedLibrary (libc.so.6)
ELF32: 0x00000001 NEEDED SharedLibrary (libm.so.6)
ELF32: 0x0000000E SONAME LibrarySoname (libfoo.so)
ELF32: 0x00000004 HASH {{[0-9a-f]+}}
ELF32: 0x00000005 STRTAB {{[0-9a-f]+}}
ELF32: 0x00000006 SYMTAB {{[0-9a-f]+}}
ELF32: 0x0000000A STRSZ {{[0-9]+}} (bytes)
ELF32: 0x0000000B SYMENT {{[0-9]+}} (bytes)
ELF32: 0x00000000 NULL 0x0
ELF32: ]
ELF64: DynamicSection [ (9 entries)
ELF64: Tag Type Name/Value
ELF64: 0x0000000000000001 NEEDED SharedLibrary (libc.so.6)
ELF64: 0x0000000000000001 NEEDED SharedLibrary (libm.so.6)
ELF64: 0x000000000000000E SONAME LibrarySoname (libfoo.so)
ELF64: 0x0000000000000004 HASH {{[0-9a-f]+}}
ELF64: 0x0000000000000005 STRTAB {{[0-9a-f]+}}
ELF64: 0x0000000000000006 SYMTAB {{[0-9a-f]+}}
ELF64: 0x000000000000000A STRSZ {{[0-9]+}} (bytes)
ELF64: 0x000000000000000B SYMENT {{[0-9]+}} (bytes)
ELF64: 0x0000000000000000 NULL 0x0
ELF64: ]
ELF: NeededLibraries [
ELF-NEXT: libc.so.6

View File

@ -1474,12 +1474,11 @@ void ELFDumper<ELFT>::printDynamicTable() {
<< " " << "Name/Value\n";
while (I != E) {
const Elf_Dyn &Entry = *I;
uintX_t Tag = Entry.getTag();
++I;
W.startLine()
<< " "
<< format(Is64 ? "0x%016" PRIX64 : "0x%08" PRIX64, Entry.getTag())
<< " " << format("%-21s", getTypeString(Entry.getTag()));
printValue(Entry.getTag(), Entry.getVal());
W.startLine() << " " << format_hex(Tag, Is64 ? 18 : 10, true) << " "
<< format("%-21s", getTypeString(Tag));
printValue(Tag, Entry.getVal());
OS << "\n";
}