[lld] r357982 - De-template SymbolTable::addShared.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 9 01:52:00 PDT 2019
Author: ruiu
Date: Tue Apr 9 01:52:00 2019
New Revision: 357982
URL: http://llvm.org/viewvc/llvm-project?rev=357982&view=rev
Log:
De-template SymbolTable::addShared.
Because of r357925, this member function doesn't have to be a
template of ELFT.
Modified:
lld/trunk/ELF/InputFiles.cpp
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/SymbolTable.h
Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=357982&r1=357981&r2=357982&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Apr 9 01:52:00 2019
@@ -1059,7 +1059,8 @@ template <class ELFT> void SharedFile::p
uint64_t Alignment = getAlignment<ELFT>(Sections, Sym);
if (!(Versyms[I] & VERSYM_HIDDEN))
- Symtab->addShared<ELFT>(Name, *this, Sym, Alignment, Idx);
+ Symtab->addShared(Name, Sym.getBinding(), Sym.st_other, Sym.getType(),
+ Sym.st_value, Sym.st_size, Alignment, Idx, this);
// Also add the symbol with the versioned name to handle undefined symbols
// with explicit versions.
@@ -1078,7 +1079,9 @@ template <class ELFT> void SharedFile::p
reinterpret_cast<const Elf_Verdef *>(Verdefs[Idx])->getAux()->vda_name;
VersionedNameBuffer.clear();
Name = (Name + "@" + VerName).toStringRef(VersionedNameBuffer);
- Symtab->addShared<ELFT>(Saver.save(Name), *this, Sym, Alignment, Idx);
+ Symtab->addShared(Saver.save(Name), Sym.getBinding(), Sym.st_other,
+ Sym.getType(), Sym.st_value, Sym.st_size, Alignment, Idx,
+ this);
}
}
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=357982&r1=357981&r2=357982&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Tue Apr 9 01:52:00 2019
@@ -467,31 +467,30 @@ Defined *SymbolTable::addDefined(StringR
return cast<Defined>(S);
}
-template <typename ELFT>
-void SymbolTable::addShared(StringRef Name, SharedFile &File,
- const typename ELFT::Sym &Sym, uint32_t Alignment,
- uint32_t VerdefIndex) {
+void SymbolTable::addShared(StringRef Name, uint8_t Binding, uint8_t StOther,
+ uint8_t Type, uint64_t Value, uint64_t Size,
+ uint32_t Alignment, uint32_t VerdefIndex,
+ InputFile *File) {
// DSO symbols do not affect visibility in the output, so we pass STV_DEFAULT
// as the visibility, which will leave the visibility in the symbol table
// unchanged.
Symbol *S;
bool WasInserted;
std::tie(S, WasInserted) = insert(Name, STV_DEFAULT,
- /*CanOmitFromDynSym*/ true, &File);
+ /*CanOmitFromDynSym*/ true, File);
// Make sure we preempt DSO symbols with default visibility.
- if (Sym.getVisibility() == STV_DEFAULT)
+ if (getVisibility(StOther) == STV_DEFAULT)
S->ExportDynamic = true;
// An undefined symbol with non default visibility must be satisfied
// in the same DSO.
auto Replace = [&](uint8_t Binding) {
- replaceSymbol<SharedSymbol>(S, File, Name, Binding, Sym.st_other,
- Sym.getType(), Sym.st_value, Sym.st_size,
- Alignment, VerdefIndex);
+ replaceSymbol<SharedSymbol>(S, *File, Name, Binding, StOther, Type, Value,
+ Size, Alignment, VerdefIndex);
};
if (WasInserted)
- Replace(Sym.getBinding());
+ Replace(Binding);
else if (S->Visibility == STV_DEFAULT && (S->isUndefined() || S->isLazy()))
Replace(S->Binding);
}
@@ -784,16 +783,3 @@ template void SymbolTable::fetchLazy<ELF
template void SymbolTable::fetchLazy<ELF32BE>(Symbol *);
template void SymbolTable::fetchLazy<ELF64LE>(Symbol *);
template void SymbolTable::fetchLazy<ELF64BE>(Symbol *);
-
-template void SymbolTable::addShared<ELF32LE>(StringRef, SharedFile &,
- const typename ELF32LE::Sym &,
- uint32_t Alignment, uint32_t);
-template void SymbolTable::addShared<ELF32BE>(StringRef, SharedFile &,
- const typename ELF32BE::Sym &,
- uint32_t Alignment, uint32_t);
-template void SymbolTable::addShared<ELF64LE>(StringRef, SharedFile &,
- const typename ELF64LE::Sym &,
- uint32_t Alignment, uint32_t);
-template void SymbolTable::addShared<ELF64BE>(StringRef, SharedFile &,
- const typename ELF64BE::Sym &,
- uint32_t Alignment, uint32_t);
Modified: lld/trunk/ELF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.h?rev=357982&r1=357981&r2=357982&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.h (original)
+++ lld/trunk/ELF/SymbolTable.h Tue Apr 9 01:52:00 2019
@@ -48,9 +48,9 @@ public:
uint64_t Value, uint64_t Size, uint8_t Binding,
SectionBase *Section, InputFile *File);
- template <class ELFT>
- void addShared(StringRef Name, SharedFile &F, const typename ELFT::Sym &Sym,
- uint32_t Alignment, uint32_t VerdefIndex);
+ void addShared(StringRef Name, uint8_t Binding, uint8_t StOther, uint8_t Type,
+ uint64_t Value, uint64_t Size, uint32_t Alignment,
+ uint32_t VerdefIndex, InputFile *File);
template <class ELFT>
void addLazyArchive(StringRef Name, ArchiveFile &F,
More information about the llvm-commits
mailing list