Index: lld/trunk/ELF/InputSection.cpp =================================================================== --- lld/trunk/ELF/InputSection.cpp +++ lld/trunk/ELF/InputSection.cpp @@ -276,7 +276,9 @@ template std::string InputSectionBase::getObjMsg(uint64_t Off) { // Synthetic sections don't have input files. elf::ObjectFile *File = getFile(); - std::string Filename = File ? File->getName() : "(internal)"; + if (!File) + return ("(internal):(" + Name + "+0x" + utohexstr(Off) + ")").str(); + std::string Filename = File->getName(); std::string Archive; if (!File->ArchiveName.empty()) Index: lld/trunk/test/ELF/duplicated-synthetic-sym.s =================================================================== --- lld/trunk/test/ELF/duplicated-synthetic-sym.s +++ lld/trunk/test/ELF/duplicated-synthetic-sym.s @@ -0,0 +1,10 @@ +// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o +// RUN: cd %S +// 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) + + .globl _binary_duplicated_synthetic_sym_s_start +_binary_duplicated_synthetic_sym_s_start: + .long 0