summaryrefslogtreecommitdiffstats
path: root/lld/ELF/SymbolTable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/SymbolTable.cpp')
-rw-r--r--lld/ELF/SymbolTable.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index a017df35024..106a648d2c3 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -374,14 +374,24 @@ void SymbolTable<ELFT>::reportDuplicate(SymbolBody *Existing,
template <typename ELFT>
Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, const Elf_Sym &Sym,
InputSectionBase<ELFT> *Section) {
+ return addRegular(Name, Sym.st_other, Sym.getType(), Sym.st_value,
+ Sym.st_size, Sym.getBinding(), Section);
+}
+
+template <typename ELFT>
+Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t StOther,
+ uint8_t Type, uintX_t Value, uintX_t Size,
+ uint8_t Binding,
+ InputSectionBase<ELFT> *Section) {
Symbol *S;
bool WasInserted;
- std::tie(S, WasInserted) = insert(Name, Sym.getType(), Sym.getVisibility(),
+ std::tie(S, WasInserted) = insert(Name, Type, StOther & 3,
/*CanOmitFromDynSym*/ false,
Section ? Section->getFile() : nullptr);
- int Cmp = compareDefinedNonCommon(S, WasInserted, Sym.getBinding());
+ int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
if (Cmp > 0)
- replaceBody<DefinedRegular<ELFT>>(S, Name, Sym, Section);
+ replaceBody<DefinedRegular<ELFT>>(S, Name, StOther, Type, Value, Size,
+ Section);
else if (Cmp == 0)
reportDuplicate(S->body(), Section->getFile());
return S;
@@ -390,16 +400,7 @@ Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, const Elf_Sym &Sym,
template <typename ELFT>
Symbol *SymbolTable<ELFT>::addRegular(StringRef Name, uint8_t Binding,
uint8_t StOther) {
- Symbol *S;
- bool WasInserted;
- std::tie(S, WasInserted) = insert(Name, STT_NOTYPE, StOther & 3,
- /*CanOmitFromDynSym*/ false, nullptr);
- int Cmp = compareDefinedNonCommon(S, WasInserted, Binding);
- if (Cmp > 0)
- replaceBody<DefinedRegular<ELFT>>(S, Name, StOther);
- else if (Cmp == 0)
- reportDuplicate(S->body(), nullptr);
- return S;
+ return addRegular(Name, StOther, STT_NOTYPE, 0, 0, Binding, nullptr);
}
template <typename ELFT>
OpenPOWER on IntegriCloud