summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2018-01-31 08:32:35 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2018-01-31 08:32:35 +0000
commitfd5a33d6234323faf8058cbd301bc8f8fb9a522d (patch)
treebbfa244b6e88ee2ce4beb30119f41e48d518d6c8
parent7f9c5184239eb61e900ca1b34286bf90acf1fe4d (diff)
downloadbcm5719-llvm-fd5a33d6234323faf8058cbd301bc8f8fb9a522d.tar.gz
bcm5719-llvm-fd5a33d6234323faf8058cbd301bc8f8fb9a522d.zip
[ELF] - Do not forget file name when reporting duplicate symbol error for absolute symbols.
When there is a duplicate absolute symbol, LLD reports <internal> instead of known object file name currently. Patch fixes the issue. Differential revision: https://reviews.llvm.org/D42636 llvm-svn: 323849
-rw-r--r--lld/ELF/SymbolTable.cpp9
-rw-r--r--lld/test/ELF/abs-conflict.s2
2 files changed, 6 insertions, 5 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index baf9e205394..c72186c0b81 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -423,11 +423,11 @@ static void reportDuplicate(Symbol *Sym, InputFile *NewFile) {
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 @@ Symbol *SymbolTable::addRegular(StringRef Name, uint8_t StOther, uint8_t Type,
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;
}
diff --git a/lld/test/ELF/abs-conflict.s b/lld/test/ELF/abs-conflict.s
index 4662c48a4e4..ea435cc956c 100644
--- a/lld/test/ELF/abs-conflict.s
+++ b/lld/test/ELF/abs-conflict.s
@@ -15,4 +15,4 @@ foo = 0x123
// DUP: duplicate symbol: foo
// DUP-NEXT: >>> defined in {{.*}}.o
-// DUP-NEXT: >>> defined in <internal>
+// DUP-NEXT: >>> defined in {{.*}}2.o
OpenPOWER on IntegriCloud