[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

llvm-svn: 324217
This commit is contained in:
George Rimar 2018-02-05 09:47:24 +00:00
parent 276b32bb14
commit f9dc10cd89
3 changed files with 5 additions and 5 deletions

View File

@ -1032,8 +1032,8 @@ static ELFKind getELFKind(MemoryBufferRef MB) {
void BinaryFile::parse() { void BinaryFile::parse() {
ArrayRef<uint8_t> Data = toArrayRef(MB.getBuffer()); ArrayRef<uint8_t> Data = toArrayRef(MB.getBuffer());
auto *Section = make<InputSection>(nullptr, SHF_ALLOC | SHF_WRITE, auto *Section = make<InputSection>(this, SHF_ALLOC | SHF_WRITE, SHT_PROGBITS,
SHT_PROGBITS, 8, Data, ".data"); 8, Data, ".data");
Sections.push_back(Section); Sections.push_back(Section);
// For each input file foo that is embedded to a result as a binary // For each input file foo that is embedded to a result as a binary

View File

@ -90,8 +90,8 @@ public:
// Returns object file symbols. It is a runtime error to call this // Returns object file symbols. It is a runtime error to call this
// function on files of other types. // function on files of other types.
ArrayRef<Symbol *> getSymbols() { ArrayRef<Symbol *> getSymbols() {
assert(FileKind == ObjKind || FileKind == BitcodeKind || assert(FileKind == BinaryKind || FileKind == ObjKind ||
FileKind == ArchiveKind); FileKind == BitcodeKind || FileKind == ArchiveKind);
return Symbols; return Symbols;
} }

View File

@ -9,7 +9,7 @@
// CHECK: duplicate symbol: _binary_file_bin_start // CHECK: duplicate symbol: _binary_file_bin_start
// CHECK-NEXT: defined at {{.*}}.o:(.text+0x0) // 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 .globl _binary_file_bin_start
_binary_file_bin_start: _binary_file_bin_start: