diff options
-rw-r--r-- | lld/ELF/Symbols.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index d3e6e5a7f1e..0b64cc8673b 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -77,7 +77,7 @@ public: // Returns the symbol name. StringRef getName() const { assert(!isLocal()); - return Name; + return StringRef(Name.S, Name.Len); } uint32_t getNameOffset() const { assert(isLocal()); @@ -127,7 +127,8 @@ protected: SymbolBody(Kind K, StringRef Name, uint8_t Binding, uint8_t Other, uint8_t Type) : SymbolKind(K), MustBeInDynSym(false), NeedsCopyOrPltAddr(false), - Type(Type), Binding(Binding), Other(Other), Name(Name) { + Type(Type), Binding(Binding), Other(Other), + Name({Name.data(), Name.size()}) { assert(!isLocal()); IsUsedInRegularObj = K != SharedKind && K != LazyKind && K != DefinedBitcodeKind; @@ -163,8 +164,12 @@ public: void setVisibility(uint8_t V) { Other = (Other & ~0x3) | V; } protected: + struct Str { + const char *S; + size_t Len; + }; union { - StringRef Name; + Str Name; uint32_t NameOffset; }; Symbol *Backref = nullptr; |