diff options
| author | Rui Ueyama <ruiu@google.com> | 2019-04-09 08:52:00 +0000 |
|---|---|---|
| committer | Rui Ueyama <ruiu@google.com> | 2019-04-09 08:52:00 +0000 |
| commit | f432fa6eee847dc401c2a356e969b68f751d4674 (patch) | |
| tree | d4acc3d767df148434d570f7091a3e2fdbb644d7 | |
| parent | 30d3c58b811caffb26e49296be77022417aaf088 (diff) | |
| download | bcm5719-llvm-f432fa6eee847dc401c2a356e969b68f751d4674.tar.gz bcm5719-llvm-f432fa6eee847dc401c2a356e969b68f751d4674.zip | |
De-template SymbolTable::addShared.
Because of r357925, this member function doesn't have to be a
template of ELFT.
llvm-svn: 357982
| -rw-r--r-- | lld/ELF/InputFiles.cpp | 7 | ||||
| -rw-r--r-- | lld/ELF/SymbolTable.cpp | 32 | ||||
| -rw-r--r-- | lld/ELF/SymbolTable.h | 6 |
3 files changed, 17 insertions, 28 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index a8ad1921a85..e5a2f0c0def 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -1059,7 +1059,8 @@ template <class ELFT> void SharedFile::parse() { 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::parse() { 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); } } diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index c2a9d6dfb70..2a511a26674 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -467,31 +467,30 @@ Defined *SymbolTable::addDefined(StringRef Name, uint8_t StOther, uint8_t Type, 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<ELF32LE>(Symbol *); 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); diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index 9f21c85f750..d6fb00fba47 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -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, |

