Mercurial > hg > CbC > CbC_llvm
diff lld/MachO/SymbolTable.h @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 0572611fdcc8 |
children | c4bab56944e8 |
line wrap: on
line diff
--- a/lld/MachO/SymbolTable.h Mon May 25 11:55:54 2020 +0900 +++ b/lld/MachO/SymbolTable.h Tue Jun 08 06:07:14 2021 +0900 @@ -9,6 +9,8 @@ #ifndef LLD_MACHO_SYMBOL_TABLE_H #define LLD_MACHO_SYMBOL_TABLE_H +#include "Symbols.h" + #include "lld/Common/LLVM.h" #include "llvm/ADT/CachedHashString.h" #include "llvm/ADT/DenseMap.h" @@ -19,29 +21,54 @@ class ArchiveFile; class DylibFile; +class InputFile; +class ObjFile; class InputSection; +class MachHeaderSection; class Symbol; +class Defined; +class Undefined; +/* + * Note that the SymbolTable handles name collisions by calling + * replaceSymbol(), which does an in-place update of the Symbol via `placement + * new`. Therefore, there is no need to update any relocations that hold + * pointers the "old" Symbol -- they will automatically point to the new one. + */ class SymbolTable { public: - Symbol *addDefined(StringRef name, InputSection *isec, uint32_t value); + Defined *addDefined(StringRef name, InputFile *, InputSection *, + uint64_t value, uint64_t size, bool isWeakDef, + bool isPrivateExtern, bool isThumb, + bool isReferencedDynamically, bool noDeadStrip); - Symbol *addUndefined(StringRef name); + Symbol *addUndefined(StringRef name, InputFile *, bool isWeakRef); - Symbol *addDylib(StringRef name, DylibFile *file); + Symbol *addCommon(StringRef name, InputFile *, uint64_t size, uint32_t align, + bool isPrivateExtern); + + Symbol *addDylib(StringRef name, DylibFile *file, bool isWeakDef, bool isTlv); + Symbol *addDynamicLookup(StringRef name); Symbol *addLazy(StringRef name, ArchiveFile *file, const llvm::object::Archive::Symbol &sym); + Defined *addSynthetic(StringRef name, InputSection *, uint64_t value, + bool isPrivateExtern, bool includeInSymtab, + bool referencedDynamically); + ArrayRef<Symbol *> getSymbols() const { return symVector; } - Symbol *find(StringRef name); + Symbol *find(llvm::CachedHashStringRef name); + Symbol *find(StringRef name) { return find(llvm::CachedHashStringRef(name)); } private: - std::pair<Symbol *, bool> insert(StringRef name); + std::pair<Symbol *, bool> insert(StringRef name, const InputFile *); llvm::DenseMap<llvm::CachedHashStringRef, int> symMap; std::vector<Symbol *> symVector; }; +void treatUndefinedSymbol(const Undefined &, StringRef source = ""); + extern SymbolTable *symtab; } // namespace macho