OSDN Git Service

[llvm-readobj][mips] Align GOT columns headers properly in 64-bit case
authorSimon Atanasyan <simon@atanasyan.com>
Fri, 24 May 2019 10:26:48 +0000 (10:26 +0000)
committerSimon Atanasyan <simon@atanasyan.com>
Fri, 24 May 2019 10:26:48 +0000 (10:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361626 91177308-0d34-0410-b5e6-96231b3b80d8

test/tools/llvm-readobj/mips-got.test
tools/llvm-readobj/ELFDumper.cpp

index 021dcfb..b3424db 100644 (file)
@@ -14,15 +14,15 @@ RUN:   FileCheck %s -check-prefix GOT-STATIC
 RUN: not llvm-readelf --mips-plt-got %p/Inputs/relocs.obj.elf-mips 2>&1 | \
 RUN:   FileCheck %s -check-prefix GNU-GOT-OBJ
 RUN: llvm-readelf --mips-plt-got %p/Inputs/dynamic-table-exe.mips | \
-RUN:   FileCheck %s -check-prefix GNU-GOT-EXE
+RUN:   FileCheck %s --strict-whitespace -check-prefix GNU-GOT-EXE
 RUN: llvm-readelf --mips-plt-got %p/Inputs/dynamic-table-so.mips | \
-RUN:   FileCheck %s -check-prefix GNU-GOT-SO
+RUN:   FileCheck %s --strict-whitespace -check-prefix GNU-GOT-SO
 RUN: llvm-readelf --mips-plt-got %p/Inputs/got-tls.so.elf-mips64el | \
-RUN:   FileCheck %s -check-prefix GNU-GOT-TLS
+RUN:   FileCheck %s --strict-whitespace -check-prefix GNU-GOT-TLS
 RUN: llvm-readelf --mips-plt-got %p/Inputs/got-empty.exe.mipsel | \
-RUN:   FileCheck %s -check-prefix GNU-GOT-EMPTY
+RUN:   FileCheck %s --strict-whitespace -check-prefix GNU-GOT-EMPTY
 RUN: llvm-readelf --mips-plt-got %p/Inputs/got-static.exe.mips | \
-RUN:   FileCheck %s -check-prefix GNU-GOT-STATIC
+RUN:   FileCheck %s --strict-whitespace -check-prefix GNU-GOT-STATIC
 
 GOT-OBJ: error: Cannot find .got section
 
index 65abdbd..159e300 100644 (file)
@@ -4061,7 +4061,10 @@ void GNUStyle<ELFT>::printMipsGOT(const MipsGOTParser<ELFT> &Parser) {
      << format_hex_no_prefix(Parser.getGp(), 8 + Bias) << "\n\n";
 
   OS << " Reserved entries:\n";
-  OS << "   Address     Access  Initial Purpose\n";
+  if (ELFT::Is64Bits)
+    OS << "           Address     Access          Initial Purpose\n";
+  else
+    OS << "   Address     Access  Initial Purpose\n";
   PrintEntry(Parser.getGotLazyResolver(), "Lazy resolver");
   if (Parser.getGotModulePointer())
     PrintEntry(Parser.getGotModulePointer(), "Module pointer (GNU extension)");
@@ -4069,7 +4072,10 @@ void GNUStyle<ELFT>::printMipsGOT(const MipsGOTParser<ELFT> &Parser) {
   if (!Parser.getLocalEntries().empty()) {
     OS << "\n";
     OS << " Local entries:\n";
-    OS << "   Address     Access  Initial\n";
+    if (ELFT::Is64Bits)
+      OS << "           Address     Access          Initial\n";
+    else
+      OS << "   Address     Access  Initial\n";
     for (auto &E : Parser.getLocalEntries())
       PrintEntry(&E, "");
   }
@@ -4080,7 +4086,11 @@ void GNUStyle<ELFT>::printMipsGOT(const MipsGOTParser<ELFT> &Parser) {
   if (!Parser.getGlobalEntries().empty()) {
     OS << "\n";
     OS << " Global entries:\n";
-    OS << "   Address     Access  Initial Sym.Val. Type    Ndx Name\n";
+    if (ELFT::Is64Bits)
+      OS << "           Address     Access          Initial         Sym.Val."
+         << " Type    Ndx Name\n";
+    else
+      OS << "   Address     Access  Initial Sym.Val. Type    Ndx Name\n";
     for (auto &E : Parser.getGlobalEntries()) {
       const Elf_Sym *Sym = Parser.getGotSym(&E);
       std::string SymName = this->dumper()->getFullSymbolName(