[lld] r324217 - [ELF] - Report valid binary filename when reporting error.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 01:47:24 PST 2018


Author: grimar
Date: Mon Feb  5 01:47:24 2018
New Revision: 324217

URL: http://llvm.org/viewvc/llvm-project?rev=324217&view=rev
Log:
[ELF] - Report valid binary filename when reporting error.

We did not report valid filename for duplicate symbol error when
symbol came from binary input file.
Patch fixes it.

Differential revision: https://reviews.llvm.org/D42635

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

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=324217&r1=324216&r2=324217&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Mon Feb  5 01:47:24 2018
@@ -1032,8 +1032,8 @@ static ELFKind getELFKind(MemoryBufferRe
 
 void BinaryFile::parse() {
   ArrayRef<uint8_t> Data = toArrayRef(MB.getBuffer());
-  auto *Section = make<InputSection>(nullptr, SHF_ALLOC | SHF_WRITE,
-                                     SHT_PROGBITS, 8, Data, ".data");
+  auto *Section = make<InputSection>(this, SHF_ALLOC | SHF_WRITE, SHT_PROGBITS,
+                                     8, Data, ".data");
   Sections.push_back(Section);
 
   // For each input file foo that is embedded to a result as a binary

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=324217&r1=324216&r2=324217&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Mon Feb  5 01:47:24 2018
@@ -90,8 +90,8 @@ public:
   // Returns object file symbols. It is a runtime error to call this
   // function on files of other types.
   ArrayRef<Symbol *> getSymbols() {
-    assert(FileKind == ObjKind || FileKind == BitcodeKind ||
-           FileKind == ArchiveKind);
+    assert(FileKind == BinaryKind || FileKind == ObjKind ||
+           FileKind == BitcodeKind || FileKind == ArchiveKind);
     return Symbols;
   }
 

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=324217&r1=324216&r2=324217&view=diff
==============================================================================
--- lld/trunk/test/ELF/duplicated-synthetic-sym.s (original)
+++ lld/trunk/test/ELF/duplicated-synthetic-sym.s Mon Feb  5 01:47:24 2018
@@ -9,7 +9,7 @@
 
 // CHECK:      duplicate symbol: _binary_file_bin_start
 // CHECK-NEXT: defined at {{.*}}.o:(.text+0x0)
-// CHECK-NEXT: defined at <internal>:(.data+0x0)
+// CHECK-NEXT: defined at file.bin:(.data+0x0)
 
 .globl  _binary_file_bin_start
 _binary_file_bin_start:




More information about the llvm-commits mailing list