<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 23, 2016 at 5:37 PM, Rui Ueyama via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I wonder if it is doable to print out not only line number but actual line contents, and if it's doable, how much useful it will be.<div><br></div><div>Our current error output is something like this.</div><div><br></div><div><div><font face="monospace, monospace">  error: foo.c:1: duplicate symbol 'mul(double, double)'<br></font></div></div><div><div><font face="monospace, monospace">  error: bar.c:3: previous definition is here<br></font></div><div><font face="monospace, monospace"><br></font></div><font face="monospace, monospace"></font></div><div>Do you think we can print out something like this instead?</div><div><br></div><div><font face="monospace, monospace">  error: foo.c:1: duplicate symbol 'mul(double, double)'</font></div><div><font face="monospace, monospace">  double mul(double x, double y) {</font></div><div><font face="monospace, monospace">         ^</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">  error: bar.c:3: prevoius definition is here</font></div><div><font face="monospace, monospace">  double mul(double x, double y) {</font></div><div><font face="monospace, monospace">         ^</font></div></div></blockquote><div><br></div><div>This is a really nice idea.</div><div><br></div><div>One other thing is that we should make sure that we always indicate which object file the symbol is in as well, so that the error is unambiguous (maybe we could include this as a "note:"). For example:</div><div><br></div><div><div><font face="monospace, monospace">  error: foo.c:1: duplicate symbol 'mul(double, double)'</font></div><div><font face="monospace, monospace">  double mul(double x, double y) {</font></div><div><font face="monospace, monospace">         ^</font></div><div><font face="monospace, monospace">  note: this definition was found in baz.a(foo.o)</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">  error: bar.c:3: prevoius definition is here</font></div><div><font face="monospace, monospace">  from: baz.a(bar.o)</font></div><div><font face="monospace, monospace">  double mul(double x, double y) {</font></div><div><font face="monospace, monospace">         ^</font></div></div><div><span style="font-family:monospace,monospace">  note: this definition was found in baz.a(bar.o)</span><br></div><div><br></div><div><br></div><div><div>One place where this will be essential is that the same C/C++ source text file may have been compiled twice in different place or something (e.g. a definition may be expanded from a .def file in multiple places or a file is compiled multiple times with different -D options). We don't want:</div><div><br></div><div><div><font face="monospace, monospace">  error: foo.c:1: duplicate symbol 'mul(double, double)'</font></div><div><font face="monospace, monospace">  double mul(double x, double y) {</font></div><div><font face="monospace, monospace">         ^</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">  error: foo.c:1: prevoius definition is here</font></div><div><font face="monospace, monospace">  double mul(double x, double y) {</font></div></div><div><span style="font-family:monospace,monospace">         ^</span><br></div><div><br></div><div>Since that is not a helpful error message (I have actually had to deal with error messages like this from Clang when working on C++ modules and they are *very* frustrating!).</div></div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 26, 2016 at 4:07 AM, Eugene Leviant via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Author: evgeny777<br>
Date: Wed Oct 26 06:07:09 2016<br>
New Revision: 285186<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=285186&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=285186&view=rev</a><br>
Log:<br>
[ELF] Better error reporting for undefined symbols<br>
<br>
This patch make lld show following details for undefined symbol errors:<br>
- file (line)<br>
- file (function name)<br>
- file (section name + offset)<br>
<br>
Differential revision: <a href="https://reviews.llvm.org/D25826" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2582<wbr>6</a><br>
<br>
Added:<br>
    lld/trunk/test/ELF/Inputs/unde<wbr>f-debug.s<br>
Modified:<br>
    lld/trunk/ELF/InputFiles.cpp<br>
    lld/trunk/ELF/InputFiles.h<br>
    lld/trunk/ELF/Relocations.cpp<br>
    lld/trunk/test/ELF/libsearch.s<br>
    lld/trunk/test/ELF/linkerscrip<wbr>t/edata-etext.s<br>
    lld/trunk/test/ELF/linkerscrip<wbr>t/ehdr_start.s<br>
    lld/trunk/test/ELF/lto/combine<wbr>d-lto-object-name.ll<br>
    lld/trunk/test/ELF/sysroot.s<br>
    lld/trunk/test/ELF/tls-static.<wbr>s<br>
    lld/trunk/test/ELF/undef-share<wbr>d.s<br>
    lld/trunk/test/ELF/undef.s<br>
    lld/trunk/test/ELF/unresolved-<wbr>symbols.s<br>
    lld/trunk/test/ELF/verneed-loc<wbr>al.s<br>
    lld/trunk/test/ELF/zdefs.s<br>
<br>
Modified: lld/trunk/ELF/InputFiles.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/InputFiles<wbr>.cpp?rev=285186&r1=285185&r2=2<wbr>85186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputFiles.cpp (original)<br>
+++ lld/trunk/ELF/InputFiles.cpp Wed Oct 26 06:07:09 2016<br>
@@ -18,6 +18,7 @@<br>
 #include "llvm/ADT/STLExtras.h"<br>
 #include "llvm/Bitcode/ReaderWriter.h"<br>
 #include "llvm/CodeGen/Analysis.h"<br>
+#include "llvm/DebugInfo/DWARF/DWARFCon<wbr>text.h"<br>
 #include "llvm/IR/LLVMContext.h"<br>
 #include "llvm/IR/Module.h"<br>
 #include "llvm/LTO/LTO.h"<br>
@@ -35,6 +36,39 @@ using namespace lld::elf;<br>
<br>
 std::vector<InputFile *> InputFile::Pool;<br>
<br>
+template <class ELFT> DIHelper<ELFT>::DIHelper(elf::<wbr>InputFile *F) {<br>
+  Expected<std::unique_ptr<objec<wbr>t::ObjectFile>> Obj =<br>
+      object::ObjectFile::createObje<wbr>ctFile(F->MB);<br>
+  if (!Obj)<br>
+    return;<br>
+<br>
+  DWARFContextInMemory Dwarf(*Obj.get());<br>
+  DwarfLine.reset(new DWARFDebugLine(&Dwarf.getLineS<wbr>ection().Relocs));<br>
+  DataExtractor LineData(Dwarf.getLineSection(<wbr>).Data,<br>
+                         ELFT::TargetEndianness == support::little,<br>
+                         ELFT::Is64Bits ? 8 : 4);<br>
+  // The second parameter is offset in .debug_line section<br>
+  // for compilation unit (CU) of interest. We have only one<br>
+  // CU (object file), so offset is always 0.<br>
+  DwarfLine->getOrParseLineTable<wbr>(LineData, 0);<br>
+}<br>
+<br>
+template <class ELFT> std::string DIHelper<ELFT>::getLineInfo(ui<wbr>ntX_t Offset) {<br>
+  if (!DwarfLine)<br>
+    return "";<br>
+<br>
+  DILineInfo LineInfo;<br>
+  DILineInfoSpecifier Spec;<br>
+  // The offset to CU is 0 (see DIHelper constructor).<br>
+  const DWARFDebugLine::LineTable *LineTbl = DwarfLine->getLineTable(0);<br>
+  if (!LineTbl)<br>
+    return "";<br>
+  LineTbl->getFileLineInfoForAdd<wbr>ress(Offset, nullptr, Spec.FLIKind, LineInfo);<br>
+  return LineInfo.Line != 0<br>
+             ? LineInfo.FileName + " (" + std::to_string(LineInfo.Line) + ")"<br>
+             : "";<br>
+}<br>
+<br>
 // Deletes all InputFile instances created so far.<br>
 void InputFile::freePool() {<br>
   // Files are freed in reverse order so that files created<br>
@@ -132,6 +166,13 @@ ArrayRef<SymbolBody *> elf::ObjectFile<E<br>
   return makeArrayRef(this->SymbolBodie<wbr>s).slice(1);<br>
 }<br>
<br>
+template <class ELFT> DIHelper<ELFT> *elf::ObjectFile<ELFT>::getDIH<wbr>elper() {<br>
+  if (!DIH)<br>
+    DIH.reset(new DIHelper<ELFT>(this));<br>
+<br>
+  return DIH.get();<br>
+}<br>
+<br>
 template <class ELFT> uint32_t elf::ObjectFile<ELFT>::getMips<wbr>Gp0() const {<br>
   if (ELFT::Is64Bits && MipsOptions && MipsOptions->Reginfo)<br>
     return MipsOptions->Reginfo->ri_gp_va<wbr>lue;<br>
@@ -432,6 +473,8 @@ SymbolBody *elf::ObjectFile<ELFT>::creat<br>
   int Binding = Sym->getBinding();<br>
   InputSectionBase<ELFT> *Sec = getSection(*Sym);<br>
   if (Binding == STB_LOCAL) {<br>
+    if (Sym->getType() == STT_FILE)<br>
+      SourceFile = check(Sym->getName(this->Strin<wbr>gTable));<br>
     if (Sym->st_shndx == SHN_UNDEF)<br>
       return new (this->Alloc)<br>
           Undefined(Sym->st_name, Sym->st_other, Sym->getType(), this);<br>
@@ -897,3 +940,8 @@ template InputFile *BinaryFile::createEL<br>
 template InputFile *BinaryFile::createELF<ELF32BE<wbr>>();<br>
 template InputFile *BinaryFile::createELF<ELF64LE<wbr>>();<br>
 template InputFile *BinaryFile::createELF<ELF64BE<wbr>>();<br>
+<br>
+template class elf::DIHelper<ELF32LE>;<br>
+template class elf::DIHelper<ELF32BE>;<br>
+template class elf::DIHelper<ELF64LE>;<br>
+template class elf::DIHelper<ELF64BE>;<br>
<br>
Modified: lld/trunk/ELF/InputFiles.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/InputFiles<wbr>.h?rev=285186&r1=285185&r2=285<wbr>186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputFiles.h (original)<br>
+++ lld/trunk/ELF/InputFiles.h Wed Oct 26 06:07:09 2016<br>
@@ -29,6 +29,7 @@<br>
 #include <map><br>
<br>
 namespace llvm {<br>
+class DWARFDebugLine;<br>
 namespace lto {<br>
 class InputFile;<br>
 }<br>
@@ -43,6 +44,21 @@ class InputFile;<br>
 class Lazy;<br>
 class SymbolBody;<br>
<br>
+// Debugging information helper class. The main purpose is to<br>
+// retrieve source file and line for error reporting. Linker may<br>
+// find reasonable number of errors in a single object file, so<br>
+// we cache debugging information in order to parse it only once<br>
+// for each object file we link.<br>
+template <class ELFT> class DIHelper {<br>
+public:<br>
+  typedef typename ELFT::uint uintX_t;<br>
+<br>
+  DIHelper(InputFile *F);<br>
+  std::string getLineInfo(uintX_t Offset);<br>
+private:<br>
+  std::unique_ptr<llvm::DWARFDeb<wbr>ugLine> DwarfLine;<br>
+};<br>
+<br>
 // The root class of input files.<br>
 class InputFile {<br>
 public:<br>
@@ -171,6 +187,10 @@ public:<br>
<br>
   const Elf_Shdr *getSymbolTable() const { return this->Symtab; };<br>
<br>
+  // DI helper allows manipilating debugging information for this<br>
+  // object file. Used for error reporting.<br>
+  DIHelper<ELFT> *getDIHelper();<br>
+<br>
   // Get MIPS GP0 value defined by this file. This value represents the gp value<br>
   // used to create the relocatable object and required to support<br>
   // R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations.<br>
@@ -184,6 +204,11 @@ public:<br>
   // using this buffer.<br>
   llvm::BumpPtrAllocator Alloc;<br>
<br>
+  // Name of source file obtained from STT_FILE symbol value,<br>
+  // or empty string if there is no such symbol in object file<br>
+  // symbol table.<br>
+  StringRef SourceFile;<br>
+<br>
 private:<br>
   void<br>
   initializeSections(llvm::Dens<wbr>eSet<llvm::CachedHashStringRef<wbr>> &ComdatGroups);<br>
@@ -211,6 +236,7 @@ private:<br>
   llvm::SpecificBumpPtrAllocato<wbr>r<InputSection<ELFT>> IAlloc;<br>
   llvm::SpecificBumpPtrAllocato<wbr>r<MergeInputSection<ELFT>> MAlloc;<br>
   llvm::SpecificBumpPtrAllocato<wbr>r<EhInputSection<ELFT>> EHAlloc;<br>
+  std::unique_ptr<DIHelper<ELFT><wbr>> DIH;<br>
 };<br>
<br>
 // LazyObjectFile is analogous to ArchiveFile in the sense that<br>
<br>
Modified: lld/trunk/ELF/Relocations.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Relocations.cpp?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/Relocation<wbr>s.cpp?rev=285186&r1=285185&r2=<wbr>285186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Relocations.cpp (original)<br>
+++ lld/trunk/ELF/Relocations.cpp Wed Oct 26 06:07:09 2016<br>
@@ -522,7 +522,48 @@ static typename ELFT::uint computeAddend<br>
   return Addend;<br>
 }<br>
<br>
-static void reportUndefined(SymbolBody &Sym) {<br>
+// Find symbol that encloses given offset. Used for error reporting.<br>
+template <class ELFT><br>
+static DefinedRegular<ELFT> *getSymbolAt(InputSectionBase<<wbr>ELFT> *S,<br>
+                                         typename ELFT::uint Offset) {<br>
+  for (SymbolBody *B : S->getFile()->getSymbols())<br>
+    if (auto *D = dyn_cast<DefinedRegular<ELFT>><wbr>(B))<br>
+      if (D->Value <= Offset && D->Value + D->Size > Offset && D->Section == S)<br>
+        return D;<br>
+<br>
+  return nullptr;<br>
+}<br>
+<br>
+template <class ELFT><br>
+static std::string getLocation(SymbolBody &Sym, InputSectionBase<ELFT> &S,<br>
+                               typename ELFT::uint Offset) {<br>
+  ObjectFile<ELFT> *File = S.getFile();<br>
+<br>
+  // First check if we can get desired values from debugging information.<br>
+  std::string LineInfo = File->getDIHelper()->getLineIn<wbr>fo(Offset);<br>
+  if (!LineInfo.empty())<br>
+    return LineInfo;<br>
+<br>
+  // If don't have STT_FILE typed symbol in object file then<br>
+  // use object file name.<br>
+  std::string SrcFile = File->SourceFile;<br>
+  if (SrcFile.empty())<br>
+    SrcFile = Sym.File ? getFilename(Sym.File) : getFilename(File);<br>
+<br>
+  DefinedRegular<ELFT> *Encl = getSymbolAt(&S, Offset);<br>
+  if (Encl && Encl->Type == STT_FUNC) {<br>
+    StringRef Func = getSymbolName(*File, *Encl);<br>
+    return SrcFile + " (function " +<br>
+           (Config->Demangle ? demangle(Func) : Func.str()) + ")";<br>
+  }<br>
+<br>
+  return (SrcFile + " (" + S.Name + "+0x" + Twine::utohexstr(Offset) + ")")<br>
+      .str();<br>
+}<br>
+<br>
+template <class ELFT><br>
+static void reportUndefined(SymbolBody &Sym, InputSectionBase<ELFT> &S,<br>
+                            typename ELFT::uint Offset) {<br>
   if (Config->UnresolvedSymbols == UnresolvedPolicy::Ignore)<br>
     return;<br>
<br>
@@ -530,11 +571,10 @@ static void reportUndefined(SymbolBody &<br>
       Config->UnresolvedSymbols != UnresolvedPolicy::NoUndef)<br>
     return;<br>
<br>
-  std::string Msg = "undefined symbol: ";<br>
-  Msg += Config->Demangle ? demangle(Sym.getName()) : Sym.getName().str();<br>
+  std::string Msg =<br>
+      getLocation(Sym, S, Offset) + ": undefined symbol '" +<br>
+      (Config->Demangle ? demangle(Sym.getName()) : Sym.getName().str()) + "'";<br>
<br>
-  if (Sym.File)<br>
-    Msg += " in " + getFilename(Sym.File);<br>
   if (Config->UnresolvedSymbols == UnresolvedPolicy::Warn)<br>
     warn(Msg);<br>
   else<br>
@@ -583,7 +623,7 @@ static void scanRelocs(InputSectionBase<<br>
     // We only report undefined symbols if they are referenced somewhere in the<br>
     // code.<br>
     if (!Body.isLocal() && Body.isUndefined() && !Body.symbol()->isWeak())<br>
-      reportUndefined(Body);<br>
+      reportUndefined(Body, C, RI.r_offset);<br>
<br>
     RelExpr Expr = Target->getRelExpr(Type, Body);<br>
     bool Preemptible = isPreemptible(Body, Type);<br>
<br>
Added: lld/trunk/test/ELF/Inputs/unde<wbr>f-debug.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/undef-debug.s?rev=285186&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/Input<wbr>s/undef-debug.s?rev=285186&vie<wbr>w=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/Inputs/unde<wbr>f-debug.s (added)<br>
+++ lld/trunk/test/ELF/Inputs/unde<wbr>f-debug.s Wed Oct 26 06:07:09 2016<br>
@@ -0,0 +1,3 @@<br>
+.file 1 "undef-debug.s"<br>
+.loc 1 3<br>
+        .quad zed3<br>
<br>
Modified: lld/trunk/test/ELF/libsearch.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/libsearch.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/libse<wbr>arch.s?rev=285186&r1=285185&r2<wbr>=285186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/libsearch.s (original)<br>
+++ lld/trunk/test/ELF/libsearch.s Wed Oct 26 06:07:09 2016<br>
@@ -22,7 +22,7 @@<br>
 // Should not link because of undefined symbol _bar<br>
 // RUN: not ld.lld -o %t3 %t.o %tbar.o 2>&1 \<br>
 // RUN:   | FileCheck --check-prefix=UNDEFINED %s<br>
-// UNDEFINED: undefined symbol: _bar<br>
+// UNDEFINED: error: {{.*}} (.bar+0x0): undefined symbol '_bar'<br>
<br>
 // Should fail if cannot find specified library (without -L switch)<br>
 // RUN: not ld.lld -o %t3 %t.o -lls 2>&1 \<br>
<br>
Modified: lld/trunk/test/ELF/linkerscrip<wbr>t/edata-etext.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/edata-etext.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/linke<wbr>rscript/edata-etext.s?rev=2851<wbr>86&r1=285185&r2=285186&view=di<wbr>ff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/linkerscrip<wbr>t/edata-etext.s (original)<br>
+++ lld/trunk/test/ELF/linkerscrip<wbr>t/edata-etext.s Wed Oct 26 06:07:09 2016<br>
@@ -2,9 +2,9 @@<br>
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o<br>
 # RUN: echo "SECTIONS { }" > %t.script<br>
 # RUN: not ld.lld %t.o -script %t.script -o %t 2>&1 | FileCheck %s<br>
-# CHECK: undefined symbol: _edata<br>
-# CHECK: undefined symbol: _etext<br>
-# CHECK: undefined symbol: _end<br>
+# CHECK: error: {{.*}} (.text+0x0): undefined symbol '_edata'<br>
+# CHECK: error: {{.*}} (.text+0x8): undefined symbol '_etext'<br>
+# CHECK: error: {{.*}} (.text+0x10): undefined symbol '_end'<br>
<br>
 .global _start,_end,_etext,_edata<br>
 .text<br>
<br>
Modified: lld/trunk/test/ELF/linkerscrip<wbr>t/ehdr_start.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/ehdr_start.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/linke<wbr>rscript/ehdr_start.s?rev=28518<wbr>6&r1=285185&r2=285186&view=dif<wbr>f</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/linkerscrip<wbr>t/ehdr_start.s (original)<br>
+++ lld/trunk/test/ELF/linkerscrip<wbr>t/ehdr_start.s Wed Oct 26 06:07:09 2016<br>
@@ -3,7 +3,7 @@<br>
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o<br>
 # RUN: echo "SECTIONS { }" > %t.script<br>
 # RUN: not ld.lld %t.o -script %t.script -o %t 2>&1 | FileCheck %s<br>
-# CHECK: undefined symbol: __ehdr_start<br>
+# CHECK: error: {{.*}} (.text+0x0): undefined symbol '__ehdr_start'<br>
<br>
 .text<br>
 .global _start, __ehdr_start<br>
<br>
Modified: lld/trunk/test/ELF/lto/combine<wbr>d-lto-object-name.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/lto/combined-lto-object-name.ll?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/lto/c<wbr>ombined-lto-object-name.ll?rev<wbr>=285186&r1=285185&r2=285186&vi<wbr>ew=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/lto/combine<wbr>d-lto-object-name.ll (original)<br>
+++ lld/trunk/test/ELF/lto/combine<wbr>d-lto-object-name.ll Wed Oct 26 06:07:09 2016<br>
@@ -11,4 +11,4 @@ define void @_start() {<br>
   ret void<br>
 }<br>
<br>
-; CHECK: undefined symbol: foo in {{.*}}combined-lto-object-name<wbr>.ll.tmp.o<br>
+; CHECK: error: ld-temp.o (function _start): undefined symbol 'foo'<br>
<br>
Modified: lld/trunk/test/ELF/sysroot.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/sysroot.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/sysro<wbr>ot.s?rev=285186&r1=285185&r2=2<wbr>85186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/sysroot.s (original)<br>
+++ lld/trunk/test/ELF/sysroot.s Wed Oct 26 06:07:09 2016<br>
@@ -9,7 +9,7 @@<br>
 // Should not link because of undefined symbol _bar<br>
 // RUN: not ld.lld -o %t/r %t/m.o 2>&1 \<br>
 // RUN:     | FileCheck --check-prefix=UNDEFINED %s<br>
-// UNDEFINED: undefined symbol: _bar<br>
+// UNDEFINED: error: {{.*}} (.text+0x1): undefined symbol '_bar'<br>
<br>
 // We need to be sure that there is no suitable library in the /lib directory<br>
 // RUN: not ld.lld -o %t/r %t/m.o -L/lib -l:libls.a 2>&1 \<br>
<br>
Modified: lld/trunk/test/ELF/tls-static.<wbr>s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/tls-static.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/tls-s<wbr>tatic.s?rev=285186&r1=285185&r<wbr>2=285186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/tls-static.<wbr>s (original)<br>
+++ lld/trunk/test/ELF/tls-static.<wbr>s Wed Oct 26 06:07:09 2016<br>
@@ -10,4 +10,4 @@<br>
 _start:<br>
   call __tls_get_addr<br>
<br>
-// CHECK: undefined symbol: __tls_get_addr<br>
+// CHECK: error: {{.*}} (.text+0x1): undefined symbol '__tls_get_addr'<br>
<br>
Modified: lld/trunk/test/ELF/undef-share<wbr>d.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/undef-shared.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/undef<wbr>-shared.s?rev=285186&r1=285185<wbr>&r2=285186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/undef-share<wbr>d.s (original)<br>
+++ lld/trunk/test/ELF/undef-share<wbr>d.s Wed Oct 26 06:07:09 2016<br>
@@ -1,15 +1,15 @@<br>
 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o<br>
 # RUN: not ld.lld %t.o -o %t.so -shared 2>&1 | FileCheck %s<br>
<br>
-# CHECK: undefined symbol: hidden in {{.*}}<br>
+# CHECK: error: {{.*}} (.data+0x0): undefined symbol 'hidden'<br>
 .global hidden<br>
 .hidden hidden<br>
<br>
-# CHECK: undefined symbol: internal in {{.*}}<br>
+# CHECK: error: {{.*}} (.data+0x8): undefined symbol 'internal'<br>
 .global internal<br>
 .internal internal<br>
<br>
-# CHECK: undefined symbol: protected in {{.*}}<br>
+# CHECK: error: {{.*}} (.data+0x10): undefined symbol 'protected'<br>
 .global protected<br>
 .protected protected<br>
<br>
<br>
Modified: lld/trunk/test/ELF/undef.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/undef.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/undef<wbr>.s?rev=285186&r1=285185&r2=285<wbr>186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/undef.s (original)<br>
+++ lld/trunk/test/ELF/undef.s Wed Oct 26 06:07:09 2016<br>
@@ -1,17 +1,21 @@<br>
 # REQUIRES: x86<br>
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o<br>
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef.s -o %t2.o<br>
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %p/Inputs/undef-debug.s -o %t3.o<br>
 # RUN: llvm-ar rc %t2.a %t2.o<br>
-# RUN: not ld.lld %t.o %t2.a -o %t.exe 2>&1 | FileCheck %s<br>
-# RUN: not ld.lld -pie %t.o %t2.a -o %t.exe 2>&1 | FileCheck %s<br>
-# CHECK: undefined symbol: foo in<br>
-# CHECK: undefined symbol: bar in<br>
-# CHECK: undefined symbol: foo(int) in<br>
-# CHECK: undefined symbol: zed2 in {{.*}}2.a({{.*}}.o)<br>
+# RUN: not ld.lld %t.o %t2.a %t3.o -o %t.exe 2>&1 | FileCheck %s<br>
+# RUN: not ld.lld -pie %t.o %t2.a %t3.o -o %t.exe 2>&1 | FileCheck %s<br>
+# CHECK: error: undef.s (.text+0x1): undefined symbol 'foo'<br>
+# CHECK: error: undef.s (.text+0x6): undefined symbol 'bar'<br>
+# CHECK: error: undef.s (.text+0x10): undefined symbol 'foo(int)'<br>
+# CHECK: error: {{.*}}2.a({{.*}}.o) (.text+0x0): undefined symbol 'zed2'<br>
+# CHECK: error: undef-debug.s (3): undefined symbol 'zed3'<br>
<br>
 # RUN: not ld.lld %t.o %t2.a -o %t.exe -no-demangle 2>&1 | \<br>
 # RUN:   FileCheck -check-prefix=NO-DEMANGLE %s<br>
-# NO-DEMANGLE: undefined symbol: _Z3fooi in<br>
+# NO-DEMANGLE: error: undef.s (.text+0x10): undefined symbol '_Z3fooi'<br>
+<br>
+.file "undef.s"<br>
<br>
   .globl _start<br>
 _start:<br>
<br>
Modified: lld/trunk/test/ELF/unresolved-<wbr>symbols.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/unresolved-symbols.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/unres<wbr>olved-symbols.s?rev=285186&r1=<wbr>285185&r2=285186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/unresolved-<wbr>symbols.s (original)<br>
+++ lld/trunk/test/ELF/unresolved-<wbr>symbols.s Wed Oct 26 06:07:09 2016<br>
@@ -6,7 +6,7 @@<br>
 ## Check that %t2.o contains undefined symbol undef.<br>
 # RUN: not ld.lld %t1.o %t2.o -o %t 2>&1 | \<br>
 # RUN:   FileCheck -check-prefix=UNDCHECK %s<br>
-# UNDCHECK: undefined symbol: undef in {{.*}}2.o<br>
+# UNDCHECK: error: {{.*}}2.o (.text+0x1): undefined symbol 'undef'<br>
<br>
 ## Error out if unknown option value was set.<br>
 # RUN: not ld.lld %t1.o %t2.o -o %t --unresolved-symbols=xxx 2>&1 | \<br>
@@ -19,7 +19,7 @@<br>
 # RUN: llvm-readobj %t1_1 > /dev/null 2>&1<br>
 # RUN: not ld.lld %t2.o -o %t1_2 --unresolved-symbols=ignore-al<wbr>l --no-undefined 2>&1 | \<br>
 # RUN:   FileCheck -check-prefix=ERRUND %s<br>
-# ERRUND: undefined symbol: undef<br>
+# ERRUND: error: {{.*}} (.text+0x1): undefined symbol 'undef'<br>
 ## Also ignore all should not produce error for symbols from DSOs.<br>
 # RUN: ld.lld %t1.o %t.so -o %t1_3 --unresolved-symbols=ignore-al<wbr>l<br>
 # RUN: llvm-readobj %t1_3 > /dev/null 2>&1<br>
<br>
Modified: lld/trunk/test/ELF/verneed-loc<wbr>al.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/verneed-local.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/verne<wbr>ed-local.s?rev=285186&r1=28518<wbr>5&r2=285186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/verneed-loc<wbr>al.s (original)<br>
+++ lld/trunk/test/ELF/verneed-loc<wbr>al.s Wed Oct 26 06:07:09 2016<br>
@@ -2,7 +2,7 @@<br>
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o<br>
 # RUN: not ld.lld %t.o %S/Inputs/verneed1.so -o %t 2>&1 | FileCheck %s<br>
<br>
-# CHECK: undefined symbol: f3 in<br>
+# CHECK: error: {{.*}} (.text+0x1): undefined symbol 'f3'<br>
 .globl _start<br>
 _start:<br>
 call f3<br>
<br>
Modified: lld/trunk/test/ELF/zdefs.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/zdefs.s?rev=285186&r1=285185&r2=285186&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/zdefs<wbr>.s?rev=285186&r1=285185&r2=285<wbr>186&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/zdefs.s (original)<br>
+++ lld/trunk/test/ELF/zdefs.s Wed Oct 26 06:07:09 2016<br>
@@ -2,6 +2,6 @@<br>
 # RUN: ld.lld -shared %t.o -o %t1.so<br>
<br>
 # RUN: not ld.lld -z defs -shared %t.o -o %t1.so 2>&1 | FileCheck -check-prefix=ERR %s<br>
-# ERR: undefined symbol: foo<br>
+# ERR: error: {{.*}} (.text+0x1): undefined symbol 'foo'<br>
<br>
 callq foo@PLT<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div></div></div>
<br>______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>