Index: ELF/SymbolTable.cpp =================================================================== --- ELF/SymbolTable.cpp +++ ELF/SymbolTable.cpp @@ -423,11 +423,11 @@ toString(Sym->File) + "\n>>> defined in " + toString(NewFile)); } -static void reportDuplicate(Symbol *Sym, InputSectionBase *ErrSec, - uint64_t ErrOffset) { +static void reportDuplicate(Symbol *Sym, InputFile *NewFile, + InputSectionBase *ErrSec, uint64_t ErrOffset) { Defined *D = cast(Sym); if (!D->Section || !ErrSec) { - reportDuplicate(Sym, ErrSec ? ErrSec->File : nullptr); + reportDuplicate(Sym, NewFile); return; } @@ -467,7 +467,8 @@ replaceSymbol(S, File, Name, Binding, StOther, Type, Value, Size, Section); else if (Cmp == 0) - reportDuplicate(S, dyn_cast_or_null(Section), Value); + reportDuplicate(S, File, dyn_cast_or_null(Section), + Value); return S; } Index: test/ELF/abs-conflict.s =================================================================== --- test/ELF/abs-conflict.s +++ test/ELF/abs-conflict.s @@ -15,4 +15,4 @@ // DUP: duplicate symbol: foo // DUP-NEXT: >>> defined in {{.*}}.o -// DUP-NEXT: >>> defined in +// DUP-NEXT: >>> defined in {{.*}}2.o