diff options
Diffstat (limited to 'contrib/llvm/tools/lld/ELF/Symbols.h')
| -rw-r--r-- | contrib/llvm/tools/lld/ELF/Symbols.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/contrib/llvm/tools/lld/ELF/Symbols.h b/contrib/llvm/tools/lld/ELF/Symbols.h index f4bb245f955d..9b7207383345 100644 --- a/contrib/llvm/tools/lld/ELF/Symbols.h +++ b/contrib/llvm/tools/lld/ELF/Symbols.h @@ -102,7 +102,10 @@ public: // True is this is an undefined weak symbol. This only works once // all input files have been added. - bool isUndefWeak() const; + bool isUndefWeak() const { + // See comment on Lazy the details. + return isWeak() && (isUndefined() || isLazy()); + } StringRef getName() const { return Name; } uint8_t getVisibility() const { return StOther & 0x3; } @@ -208,14 +211,14 @@ class SharedSymbol : public Symbol { public: static bool classof(const Symbol *S) { return S->kind() == SharedKind; } - SharedSymbol(InputFile *File, StringRef Name, uint8_t Binding, + SharedSymbol(InputFile &File, StringRef Name, uint8_t Binding, uint8_t StOther, uint8_t Type, uint64_t Value, uint64_t Size, uint32_t Alignment, uint32_t VerdefIndex) - : Symbol(SharedKind, File, Name, Binding, StOther, Type), Value(Value), + : Symbol(SharedKind, &File, Name, Binding, StOther, Type), Value(Value), Size(Size), VerdefIndex(VerdefIndex), Alignment(Alignment) { // GNU ifunc is a mechanism to allow user-supplied functions to // resolve PLT slot values at load-time. This is contrary to the - // regualr symbol resolution scheme in which symbols are resolved just + // regular symbol resolution scheme in which symbols are resolved just // by name. Using this hook, you can program how symbols are solved // for you program. For example, you can make "memcpy" to be resolved // to a SSE-enabled version of memcpy only when a machine running the @@ -233,8 +236,8 @@ public: this->Type = llvm::ELF::STT_FUNC; } - template <class ELFT> SharedFile<ELFT> *getFile() const { - return cast<SharedFile<ELFT>>(File); + template <class ELFT> SharedFile<ELFT> &getFile() const { + return *cast<SharedFile<ELFT>>(File); } // If not null, there is a copy relocation to this section. @@ -267,8 +270,8 @@ public: InputFile *fetch(); protected: - Lazy(Kind K, InputFile *File, StringRef Name, uint8_t Type) - : Symbol(K, File, Name, llvm::ELF::STB_GLOBAL, llvm::ELF::STV_DEFAULT, + Lazy(Kind K, InputFile &File, StringRef Name, uint8_t Type) + : Symbol(K, &File, Name, llvm::ELF::STB_GLOBAL, llvm::ELF::STV_DEFAULT, Type) {} }; @@ -278,13 +281,13 @@ protected: // symbol. class LazyArchive : public Lazy { public: - LazyArchive(InputFile *File, const llvm::object::Archive::Symbol S, + LazyArchive(InputFile &File, const llvm::object::Archive::Symbol S, uint8_t Type) : Lazy(LazyArchiveKind, File, S.getName(), Type), Sym(S) {} static bool classof(const Symbol *S) { return S->kind() == LazyArchiveKind; } - ArchiveFile *getFile(); + ArchiveFile &getFile(); InputFile *fetch(); private: @@ -295,12 +298,12 @@ private: // --start-lib and --end-lib options. class LazyObject : public Lazy { public: - LazyObject(InputFile *File, StringRef Name, uint8_t Type) + LazyObject(InputFile &File, StringRef Name, uint8_t Type) : Lazy(LazyObjectKind, File, Name, Type) {} static bool classof(const Symbol *S) { return S->kind() == LazyObjectKind; } - LazyObjFile *getFile(); + LazyObjFile &getFile(); InputFile *fetch(); }; |
