summaryrefslogtreecommitdiff
path: root/lld/ELF/SymbolTable.h
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2017-07-26 18:42:48 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2017-07-26 18:42:48 +0000
commit7b134959151d21a5054ede9d87dac8bb57810ce5 (patch)
treec3606ea910d3f7707d695852363623fae27711e8 /lld/ELF/SymbolTable.h
parent8a36335716b31f3ab3a5d1f726e413498110f78b (diff)
Detemplate SymbolTable.
NFC, just makes it easier to access from non templated code.
Diffstat (limited to 'lld/ELF/SymbolTable.h')
-rw-r--r--lld/ELF/SymbolTable.h43
1 files changed, 19 insertions, 24 deletions
diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h
index 4ba101fa5d5..d339f0c7703 100644
--- a/lld/ELF/SymbolTable.h
+++ b/lld/ELF/SymbolTable.h
@@ -33,41 +33,43 @@ struct Symbol;
// to replace the lazy symbol. The logic is implemented in the
// add*() functions, which are called by input files as they are parsed. There
// is one add* function per symbol type.
-template <class ELFT> class SymbolTable {
- typedef typename ELFT::Sym Elf_Sym;
-
+class SymbolTable {
public:
- void addFile(InputFile *File);
- void addCombinedLTOObject();
- void addSymbolAlias(StringRef Alias, StringRef Name);
- void addSymbolWrap(StringRef Name);
+ template <class ELFT> void addFile(InputFile *File);
+ template <class ELFT> void addCombinedLTOObject();
+ template <class ELFT> void addSymbolAlias(StringRef Alias, StringRef Name);
+ template <class ELFT> void addSymbolWrap(StringRef Name);
void applySymbolRenames();
ArrayRef<Symbol *> getSymbols() const { return SymVector; }
- ArrayRef<ObjectFile<ELFT> *> getObjectFiles() const { return ObjectFiles; }
- ArrayRef<BinaryFile *> getBinaryFiles() const { return BinaryFiles; }
- ArrayRef<SharedFile<ELFT> *> getSharedFiles() const { return SharedFiles; }
+ template <class ELFT>
DefinedRegular *addAbsolute(StringRef Name,
uint8_t Visibility = llvm::ELF::STV_HIDDEN,
uint8_t Binding = llvm::ELF::STB_GLOBAL);
+ template <class ELFT>
DefinedRegular *addIgnored(StringRef Name,
uint8_t Visibility = llvm::ELF::STV_HIDDEN);
- Symbol *addUndefined(StringRef Name);
+ template <class ELFT> Symbol *addUndefined(StringRef Name);
+ template <class ELFT>
Symbol *addUndefined(StringRef Name, bool IsLocal, uint8_t Binding,
uint8_t StOther, uint8_t Type, bool CanOmitFromDynSym,
InputFile *File);
-
+ template <class ELFT>
Symbol *addRegular(StringRef Name, uint8_t StOther, uint8_t Type,
uint64_t Value, uint64_t Size, uint8_t Binding,
SectionBase *Section, InputFile *File);
- void addShared(SharedFile<ELFT> *F, StringRef Name, const Elf_Sym &Sym,
+ template <class ELFT>
+ void addShared(SharedFile<ELFT> *F, StringRef Name,
+ const typename ELFT::Sym &Sym,
const typename ELFT::Verdef *Verdef);
+ template <class ELFT>
Symbol *addLazyArchive(ArchiveFile *F, const llvm::object::Archive::Symbol S);
- void addLazyObject(StringRef Name, LazyObjectFile &Obj);
+ template <class ELFT> void addLazyObject(StringRef Name, LazyObjectFile &Obj);
+
Symbol *addBitcode(StringRef Name, uint8_t Binding, uint8_t StOther,
uint8_t Type, bool CanOmitFromDynSym, BitcodeFile *File);
@@ -80,8 +82,8 @@ public:
uint8_t Visibility, bool CanOmitFromDynSym,
InputFile *File);
- void scanUndefinedFlags();
- void scanShlibUndefined();
+ template <class ELFT> void scanUndefinedFlags();
+ template <class ELFT> void scanShlibUndefined();
void scanVersionScript();
SymbolBody *find(StringRef Name);
@@ -120,11 +122,6 @@ private:
// is used to uniquify them.
llvm::DenseSet<llvm::CachedHashStringRef> ComdatGroups;
- std::vector<ObjectFile<ELFT> *> ObjectFiles;
- std::vector<SharedFile<ELFT> *> SharedFiles;
- std::vector<BitcodeFile *> BitcodeFiles;
- std::vector<BinaryFile *> BinaryFiles;
-
// Set of .so files to not link the same shared object file more than once.
llvm::DenseSet<StringRef> SoNames;
@@ -138,9 +135,7 @@ private:
std::unique_ptr<BitcodeCompiler> LTO;
};
-template <class ELFT> struct Symtab { static SymbolTable<ELFT> *X; };
-template <class ELFT> SymbolTable<ELFT> *Symtab<ELFT>::X;
-
+extern SymbolTable *Symtab;
} // namespace elf
} // namespace lld