diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-06 14:31:03 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-04-06 14:31:03 +0000 |
commit | 5e34568f79b2f10bc9207040fab4261b4097f908 (patch) | |
tree | 70c64268f9e9515d9f71182453d1563bd7b348e8 | |
parent | 4eaeacec6d4d7500218e8c09f2215cdca74d26b8 (diff) | |
download | bcm5719-llvm-5e34568f79b2f10bc9207040fab4261b4097f908.tar.gz bcm5719-llvm-5e34568f79b2f10bc9207040fab4261b4097f908.zip |
Use a bit in SymbolBody to store CanKeepUndefined.
UndefinedElf for 64 bits goes from 72 to 64 bytes.
llvm-svn: 265543
-rw-r--r-- | lld/ELF/Symbols.cpp | 15 | ||||
-rw-r--r-- | lld/ELF/Symbols.h | 3 |
2 files changed, 11 insertions, 7 deletions
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index add75461481..95f5b9b51c3 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -89,15 +89,14 @@ static typename ELFT::uint getSymVA(const SymbolBody &Body, SymbolBody::SymbolBody(Kind K, uint32_t NameOffset, uint8_t StOther, uint8_t Type) - : SymbolKind(K), MustBeInDynSym(false), NeedsCopyOrPltAddr(false), - Type(Type), Binding(STB_LOCAL), StOther(StOther), NameOffset(NameOffset) { + : SymbolKind(K), Type(Type), Binding(STB_LOCAL), StOther(StOther), + NameOffset(NameOffset) { init(); } SymbolBody::SymbolBody(Kind K, StringRef Name, uint8_t Binding, uint8_t StOther, uint8_t Type) - : SymbolKind(K), MustBeInDynSym(false), NeedsCopyOrPltAddr(false), - Type(Type), Binding(Binding), StOther(StOther), + : SymbolKind(K), Type(Type), Binding(Binding), StOther(StOther), Name({Name.data(), Name.size()}) { assert(!isLocal()); init(); @@ -107,6 +106,9 @@ void SymbolBody::init() { Kind K = kind(); IsUsedInRegularObj = K == DefinedRegularKind || K == DefinedCommonKind || K == DefinedSyntheticKind || K == UndefinedElfKind; + CanKeepUndefined = false; + MustBeInDynSym = false; + NeedsCopyOrPltAddr = false; } // Returns true if a symbol can be replaced at load-time by a symbol @@ -267,8 +269,9 @@ template <typename ELFT> UndefinedElf<ELFT>::UndefinedElf(StringRef Name, uint8_t Binding, uint8_t StOther, uint8_t Type, bool CanKeepUndefined) - : SymbolBody(SymbolBody::UndefinedElfKind, Name, Binding, StOther, Type), - CanKeepUndefined(CanKeepUndefined) {} + : SymbolBody(SymbolBody::UndefinedElfKind, Name, Binding, StOther, Type) { + this->CanKeepUndefined = CanKeepUndefined; +} template <typename ELFT> UndefinedElf<ELFT>::UndefinedElf(const Elf_Sym &Sym) diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index afd8743f6dd..35f146dec6b 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -147,6 +147,8 @@ public: // symbol or if the symbol should point to its plt entry. unsigned NeedsCopyOrPltAddr : 1; + unsigned CanKeepUndefined : 1; + // The following fields have the same meaning as the ELF symbol attributes. uint8_t Type; // symbol type uint8_t Binding; // symbol binding @@ -289,7 +291,6 @@ public: template <class ELFT> class UndefinedElf : public SymbolBody { typedef typename ELFT::uint uintX_t; typedef typename ELFT::Sym Elf_Sym; - bool CanKeepUndefined = false; public: UndefinedElf(StringRef N, const Elf_Sym &Sym); |