Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lld/ELF/SymbolTable.h
Show All 33 Lines | |||||
// add*() functions, which are called by input files as they are parsed. There | // add*() functions, which are called by input files as they are parsed. There | ||||
// is one add* function per symbol type. | // is one add* function per symbol type. | ||||
template <class ELFT> class SymbolTable { | template <class ELFT> class SymbolTable { | ||||
typedef typename ELFT::Sym Elf_Sym; | typedef typename ELFT::Sym Elf_Sym; | ||||
public: | public: | ||||
void addFile(InputFile *File); | void addFile(InputFile *File); | ||||
void addCombinedLTOObject(); | void addCombinedLTOObject(); | ||||
void addSymbolAlias(StringRef Alias, StringRef Name); | |||||
void addSymbolWrap(StringRef Name); | |||||
davide: Unsorted. | |||||
void applySymbolRenames(); | |||||
ArrayRef<Symbol *> getSymbols() const { return SymVector; } | ArrayRef<Symbol *> getSymbols() const { return SymVector; } | ||||
ArrayRef<ObjectFile<ELFT> *> getObjectFiles() const { return ObjectFiles; } | ArrayRef<ObjectFile<ELFT> *> getObjectFiles() const { return ObjectFiles; } | ||||
ArrayRef<BinaryFile *> getBinaryFiles() const { return BinaryFiles; } | ArrayRef<BinaryFile *> getBinaryFiles() const { return BinaryFiles; } | ||||
ArrayRef<SharedFile<ELFT> *> getSharedFiles() const { return SharedFiles; } | ArrayRef<SharedFile<ELFT> *> getSharedFiles() const { return SharedFiles; } | ||||
DefinedRegular *addAbsolute(StringRef Name, | DefinedRegular *addAbsolute(StringRef Name, | ||||
uint8_t Visibility = llvm::ELF::STV_HIDDEN, | uint8_t Visibility = llvm::ELF::STV_HIDDEN, | ||||
Show All 30 Lines | public: | ||||
void scanUndefinedFlags(); | void scanUndefinedFlags(); | ||||
void scanShlibUndefined(); | void scanShlibUndefined(); | ||||
void scanVersionScript(); | void scanVersionScript(); | ||||
SymbolBody *find(StringRef Name); | SymbolBody *find(StringRef Name); | ||||
SymbolBody *findInCurrentDSO(StringRef Name); | SymbolBody *findInCurrentDSO(StringRef Name); | ||||
void trace(StringRef Name); | void trace(StringRef Name); | ||||
void wrap(StringRef Name); | |||||
void alias(StringRef Alias, StringRef Name); | |||||
private: | private: | ||||
std::vector<SymbolBody *> findByVersion(SymbolVersion Ver); | std::vector<SymbolBody *> findByVersion(SymbolVersion Ver); | ||||
std::vector<SymbolBody *> findAllByVersion(SymbolVersion Ver); | std::vector<SymbolBody *> findAllByVersion(SymbolVersion Ver); | ||||
llvm::StringMap<std::vector<SymbolBody *>> &getDemangledSyms(); | llvm::StringMap<std::vector<SymbolBody *>> &getDemangledSyms(); | ||||
void handleAnonymousVersion(); | void handleAnonymousVersion(); | ||||
void assignExactVersion(SymbolVersion Ver, uint16_t VersionId, | void assignExactVersion(SymbolVersion Ver, uint16_t VersionId, | ||||
Show All 32 Lines | private: | ||||
// A map from demangled symbol names to their symbol objects. | // A map from demangled symbol names to their symbol objects. | ||||
// This mapping is 1:N because two symbols with different versions | // This mapping is 1:N because two symbols with different versions | ||||
// can have the same name. We use this map to handle "extern C++ {}" | // can have the same name. We use this map to handle "extern C++ {}" | ||||
// directive in version scripts. | // directive in version scripts. | ||||
llvm::Optional<llvm::StringMap<std::vector<SymbolBody *>>> DemangledSyms; | llvm::Optional<llvm::StringMap<std::vector<SymbolBody *>>> DemangledSyms; | ||||
// For LTO. | // For LTO. | ||||
std::unique_ptr<BitcodeCompiler> LTO; | std::unique_ptr<BitcodeCompiler> LTO; | ||||
}; | }; | ||||
Not Done ReplyInline ActionsA StringMap<bool> is a little silly. davide: A `StringMap<bool>` is a little silly.
If you really want a set container, you should use a… | |||||
Not Done ReplyInline ActionsIs a set container like SmallSet good enough in this case? What's the worst case for the number of -wrap functions? I picked a map because we have to do a lookup in this container for every symbol. dmikulin: Is a set container like SmallSet good enough in this case? What's the worst case for the number… | |||||
Not Done ReplyInline ActionsWhat I'm trying to say is that a map from something to bool is just a Set. davide: What I'm trying to say is that a map from something to bool is just a Set.
If you think your… | |||||
Not Done ReplyInline ActionsOK, thanks. Will fix. dmikulin: OK, thanks. Will fix. | |||||
I'd be more explicit here. e.g. "this is a map from Symbol name to binding" or something like that. davide: I'd be more explicit here. e.g. "this is a map from Symbol name to binding" or something like… | |||||
Not Done ReplyInline ActionsOK dmikulin: OK | |||||
template <class ELFT> struct Symtab { static SymbolTable<ELFT> *X; }; | template <class ELFT> struct Symtab { static SymbolTable<ELFT> *X; }; | ||||
template <class ELFT> SymbolTable<ELFT> *Symtab<ELFT>::X; | template <class ELFT> SymbolTable<ELFT> *Symtab<ELFT>::X; | ||||
} // namespace elf | } // namespace elf | ||||
} // namespace lld | } // namespace lld | ||||
#endif | #endif |
Unsorted.