diff options
-rw-r--r-- | lld/ELF/InputSection.cpp | 1 | ||||
-rw-r--r-- | lld/ELF/OutputSections.cpp | 2 | ||||
-rw-r--r-- | lld/ELF/Symbols.cpp | 8 | ||||
-rw-r--r-- | lld/ELF/Symbols.h | 3 |
4 files changed, 5 insertions, 9 deletions
diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 28caacbff82..baa2e918619 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -687,7 +687,6 @@ CommonInputSection<ELFT>::CommonInputSection( // Compute symbol offset relative to beginning of input section. Sym->Offset = Hdr.sh_size; - Sym->Section = this; Hdr.sh_size += Sym->Size; } } diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 2b409ff4fc2..bf065d3197e 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1448,7 +1448,7 @@ SymbolTableSection<ELFT>::getOutputSection(SymbolBody *Sym) { break; } case SymbolBody::DefinedCommonKind: - return cast<DefinedCommon<ELFT>>(Sym)->Section->OutSec; + return CommonInputSection<ELFT>::X->OutSec; case SymbolBody::SharedKind: if (cast<SharedSymbol<ELFT>>(Sym)->needsCopy()) return Out<ELFT>::Bss; diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 6d7e7978c71..b1056f8d508 100644 --- a/lld/ELF/Symbols.cpp +++ b/lld/ELF/Symbols.cpp @@ -63,10 +63,10 @@ static typename ELFT::uint getSymVA(const SymbolBody &Body, return VA - Out<ELFT>::TlsPhdr->p_vaddr; return VA; } - case SymbolBody::DefinedCommonKind: { - auto &D = cast<DefinedCommon<ELFT>>(Body); - return D.Section->OutSec->getVA() + D.Section->OutSecOff + D.Offset; - } + case SymbolBody::DefinedCommonKind: + return CommonInputSection<ELFT>::X->OutSec->getVA() + + CommonInputSection<ELFT>::X->OutSecOff + + cast<DefinedCommon<ELFT>>(Body).Offset; case SymbolBody::SharedKind: { auto &SS = cast<SharedSymbol<ELFT>>(Body); if (!SS.NeedsCopyOrPltAddr) diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index f8b5f463ba2..a1170f4febc 100644 --- a/lld/ELF/Symbols.h +++ b/lld/ELF/Symbols.h @@ -184,9 +184,6 @@ public: uint64_t Alignment; uint64_t Size; - - // Virtual input section for common symbols. - CommonInputSection<ELFT> *Section; }; // Regular defined symbols read from object file symbol tables. |