[lld] r319108 - Consistent use of <internal> when displaying internal symbol names

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 27 14:49:16 PST 2017


Author: sbc
Date: Mon Nov 27 14:49:16 2017
New Revision: 319108

URL: http://llvm.org/viewvc/llvm-project?rev=319108&view=rev
Log:
Consistent use of <internal> when displaying internal symbol names

Differential Revision: https://reviews.llvm.org/D40510

Modified:
    lld/trunk/COFF/InputFiles.cpp
    lld/trunk/COFF/SymbolTable.cpp
    lld/trunk/ELF/InputFiles.h
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/test/ELF/duplicated-synthetic-sym.s
    lld/trunk/wasm/SymbolTable.cpp

Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=319108&r1=319107&r2=319108&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Mon Nov 27 14:49:16 2017
@@ -411,7 +411,7 @@ static StringRef getBasename(StringRef P
 // Returns a string in the format of "foo.obj" or "foo.obj(bar.lib)".
 std::string lld::toString(coff::InputFile *File) {
   if (!File)
-    return "(internal)";
+    return "<internal>";
   if (File->ParentName.empty())
     return File->getName().lower();
 

Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=319108&r1=319107&r2=319108&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Mon Nov 27 14:49:16 2017
@@ -200,8 +200,7 @@ void SymbolTable::addLazy(ArchiveFile *F
 
 void SymbolTable::reportDuplicate(Symbol *Existing, InputFile *NewFile) {
   error("duplicate symbol: " + toString(*Existing) + " in " +
-        toString(Existing->getFile()) + " and in " +
-        (NewFile ? toString(NewFile) : "(internal)"));
+        toString(Existing->getFile()) + " and in " + toString(NewFile));
 }
 
 Symbol *SymbolTable::addAbsolute(StringRef N, COFFSymbolRef Sym) {

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=319108&r1=319107&r2=319108&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Mon Nov 27 14:49:16 2017
@@ -42,7 +42,7 @@ namespace elf {
 class InputFile;
 }
 
-// Returns "(internal)", "foo.a(bar.o)" or "baz.o".
+// Returns "<internal>", "foo.a(bar.o)" or "baz.o".
 std::string toString(const elf::InputFile *F);
 
 namespace elf {

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=319108&r1=319107&r2=319108&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Mon Nov 27 14:49:16 2017
@@ -308,7 +308,7 @@ std::string InputSectionBase::getSrcMsg(
 std::string InputSectionBase::getObjMsg(uint64_t Off) {
   // Synthetic sections don't have input files.
   if (!File)
-    return ("(internal):(" + Name + "+0x" + utohexstr(Off) + ")").str();
+    return ("<internal>:(" + Name + "+0x" + utohexstr(Off) + ")").str();
   std::string Filename = File->getName();
 
   std::string Archive;

Modified: lld/trunk/test/ELF/duplicated-synthetic-sym.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/duplicated-synthetic-sym.s?rev=319108&r1=319107&r2=319108&view=diff
==============================================================================
--- lld/trunk/test/ELF/duplicated-synthetic-sym.s (original)
+++ lld/trunk/test/ELF/duplicated-synthetic-sym.s Mon Nov 27 14:49:16 2017
@@ -4,7 +4,7 @@
 // RUN: not ld.lld %t.o --format binary duplicated-synthetic-sym.s -o %t.elf 2>&1 | FileCheck %s
 
 // CHECK: duplicate symbol: _binary_duplicated_synthetic_sym_s_start
-// CHECK: defined at (internal):(.data+0x0)
+// CHECK: defined at <internal>:(.data+0x0)
 
     .globl  _binary_duplicated_synthetic_sym_s_start
 _binary_duplicated_synthetic_sym_s_start:

Modified: lld/trunk/wasm/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/SymbolTable.cpp?rev=319108&r1=319107&r2=319108&view=diff
==============================================================================
--- lld/trunk/wasm/SymbolTable.cpp (original)
+++ lld/trunk/wasm/SymbolTable.cpp Mon Nov 27 14:49:16 2017
@@ -73,7 +73,7 @@ std::pair<Symbol *, bool> SymbolTable::i
 void SymbolTable::reportDuplicate(Symbol *Existing, InputFile *NewFile) {
   error("duplicate symbol: " + toString(*Existing) + "\n>>> defined in " +
         toString(Existing->getFile()) + "\n>>> defined in " +
-        (NewFile ? toString(NewFile) : "<internal>"));
+        toString(NewFile));
 }
 
 static void checkSymbolTypes(Symbol *Existing, InputFile *F,
@@ -86,13 +86,10 @@ static void checkSymbolTypes(Symbol *Exi
   if (Existing->isFunction() == NewIsFunction)
     return;
 
-  std::string Filename = "<builtin>";
-  if (Existing->getFile())
-    Filename = toString(Existing->getFile());
   error("symbol type mismatch: " + New->Name + "\n>>> defined as " +
-        (Existing->isFunction() ? "Function" : "Global") + " in " + Filename +
-        "\n>>> defined as " + (NewIsFunction ? "Function" : "Global") + " in " +
-        F->getName());
+        (Existing->isFunction() ? "Function" : "Global") + " in " +
+        toString(Existing->getFile()) + "\n>>> defined as " +
+        (NewIsFunction ? "Function" : "Global") + " in " + F->getName());
 }
 
 Symbol *SymbolTable::addDefinedGlobal(StringRef Name) {




More information about the llvm-commits mailing list