[PATCH] D42636: [ELF] - Do not forget file name when reporting duplicate symbol error for absolute symbols.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 29 04:31:51 PST 2018
grimar created this revision.
grimar added reviewers: ruiu, espindola.
Herald added a subscriber: emaste.
When there is a duplicate absolute symbol, LLD reports `<internal>`
instead of known object file name currently.
Patch fixes the issue.
https://reviews.llvm.org/D42636
Files:
ELF/SymbolTable.cpp
test/ELF/abs-conflict.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 <internal>
+// DUP-NEXT: >>> defined in {{.*}}2.o
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<Defined>(Sym);
if (!D->Section || !ErrSec) {
- reportDuplicate(Sym, ErrSec ? ErrSec->File : nullptr);
+ reportDuplicate(Sym, NewFile);
return;
}
@@ -467,7 +467,8 @@
replaceSymbol<Defined>(S, File, Name, Binding, StOther, Type, Value, Size,
Section);
else if (Cmp == 0)
- reportDuplicate(S, dyn_cast_or_null<InputSectionBase>(Section), Value);
+ reportDuplicate(S, File, dyn_cast_or_null<InputSectionBase>(Section),
+ Value);
return S;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42636.131765.patch
Type: text/x-patch
Size: 1379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180129/1b6b8b62/attachment.bin>
More information about the llvm-commits
mailing list