[llvm] r249043 - Fix printing of 64 bit values and make test more strict.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 1 10:57:31 PDT 2015


Author: rafael
Date: Thu Oct  1 12:57:31 2015
New Revision: 249043

URL: http://llvm.org/viewvc/llvm-project?rev=249043&view=rev
Log:
Fix printing of 64 bit values and make test more strict.

Modified:
    llvm/trunk/test/Object/readobj-shared-object.test
    llvm/trunk/tools/llvm-readobj/ELFDumper.cpp

Modified: llvm/trunk/test/Object/readobj-shared-object.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/readobj-shared-object.test?rev=249043&r1=249042&r2=249043&view=diff
==============================================================================
--- llvm/trunk/test/Object/readobj-shared-object.test (original)
+++ llvm/trunk/test/Object/readobj-shared-object.test Thu Oct  1 12:57:31 2015
@@ -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

Modified: llvm/trunk/tools/llvm-readobj/ELFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/ELFDumper.cpp?rev=249043&r1=249042&r2=249043&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/ELFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/ELFDumper.cpp Thu Oct  1 12:57:31 2015
@@ -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";
   }
 




More information about the llvm-commits mailing list