diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 20:06:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-01-13 20:06:04 +0000 |
commit | b289257c7f3ed78b7d3971c596d7c60a9050c705 (patch) | |
tree | d6b57e29a5a86347a020d6f0cae76cc2d0f3bf8d /ELF/SymbolTable.h | |
parent | fba2c04f31e119eacf142fcbbaabd5a9e63a39ed (diff) | |
download | src-b289257c7f3ed78b7d3971c596d7c60a9050c705.tar.gz src-b289257c7f3ed78b7d3971c596d7c60a9050c705.zip |
Vendor import of lld trunk r257626:vendor/lld/lld-trunk-r257626
Notes
Notes:
svn path=/vendor/lld/dist/; revision=293846
svn path=/vendor/lld/lld-trunk-r257626/; revision=293847; tag=vendor/lld/lld-trunk-r257626
Diffstat (limited to 'ELF/SymbolTable.h')
-rw-r--r-- | ELF/SymbolTable.h | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/ELF/SymbolTable.h b/ELF/SymbolTable.h index 4f8f5afa420a..16ed821bf01a 100644 --- a/ELF/SymbolTable.h +++ b/ELF/SymbolTable.h @@ -31,9 +31,10 @@ class Undefined; // undefined, it'll read an archive member to read a real definition // to replace the lazy symbol. The logic is implemented in resolve(). template <class ELFT> class SymbolTable { -public: - SymbolTable(); + typedef typename llvm::object::ELFFile<ELFT>::Elf_Sym Elf_Sym; + typedef typename llvm::object::ELFFile<ELFT>::uintX_t uintX_t; +public: void addFile(std::unique_ptr<InputFile> File); const llvm::MapVector<StringRef, Symbol *> &getSymbols() const { @@ -50,13 +51,15 @@ public: SymbolBody *addUndefined(StringRef Name); SymbolBody *addUndefinedOpt(StringRef Name); - void addAbsolute(StringRef Name, - typename llvm::object::ELFFile<ELFT>::Elf_Sym &ESym); - void addSynthetic(StringRef Name, OutputSectionBase<ELFT> &Section, - typename llvm::object::ELFFile<ELFT>::uintX_t Value); + SymbolBody *addAbsolute(StringRef Name, Elf_Sym &ESym); + SymbolBody *addSynthetic(StringRef Name, OutputSectionBase<ELFT> &Section, + uintX_t Value); SymbolBody *addIgnored(StringRef Name); + SymbolBody *addIgnoredStrong(StringRef Name); + void scanShlibUndefined(); SymbolBody *find(StringRef Name); + void wrap(StringRef Name); ELFFileBase<ELFT> *findFile(SymbolBody *B); private: @@ -66,8 +69,6 @@ private: void resolve(SymbolBody *Body); std::string conflictMsg(SymbolBody *Old, SymbolBody *New); - std::vector<std::unique_ptr<ArchiveFile>> ArchiveFiles; - // The order the global symbols are in is not defined. We can use an arbitrary // order, but it has to be reproducible. That is true even when cross linking. // The default hashing of StringRef produces different results on 32 and 64 @@ -78,13 +79,18 @@ private: llvm::MapVector<StringRef, Symbol *> Symtab; llvm::BumpPtrAllocator Alloc; + // Comdat groups define "link once" sections. If two comdat groups have the + // same name, only one of them is linked, and the other is ignored. This set + // is used to uniquify them. llvm::DenseSet<StringRef> ComdatGroups; - // The writer needs to infer the machine type from the object files. + // The symbol table owns all file objects. + std::vector<std::unique_ptr<ArchiveFile>> ArchiveFiles; std::vector<std::unique_ptr<ObjectFile<ELFT>>> ObjectFiles; - std::vector<std::unique_ptr<SharedFile<ELFT>>> SharedFiles; - llvm::DenseSet<StringRef> IncludedSoNames; + + // Set of .so files to not link the same shared object file more than once. + llvm::DenseSet<StringRef> SoNames; }; } // namespace elf2 |