From: Rui Ueyama Date: Tue, 2 Aug 2016 01:35:13 +0000 (+0000) Subject: Remove DefinedCommon::Section. X-Git-Tag: llvmorg-4.0.0-rc1~13611 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07784904282c8b0793b0edfdc0220eadfadb205c;p=platform%2Fupstream%2Fllvm.git Remove DefinedCommon::Section. Since CommonInputSection is a singleton class, we don't need to store pointers to all DefinedCommon symbols. llvm-svn: 277410 --- diff --git a/lld/ELF/InputSection.cpp b/lld/ELF/InputSection.cpp index 28caacb..baa2e91 100644 --- a/lld/ELF/InputSection.cpp +++ b/lld/ELF/InputSection.cpp @@ -687,7 +687,6 @@ CommonInputSection::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 2b409ff..bf065d3 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1448,7 +1448,7 @@ SymbolTableSection::getOutputSection(SymbolBody *Sym) { break; } case SymbolBody::DefinedCommonKind: - return cast>(Sym)->Section->OutSec; + return CommonInputSection::X->OutSec; case SymbolBody::SharedKind: if (cast>(Sym)->needsCopy()) return Out::Bss; diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp index 6d7e797..b1056f8 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::TlsPhdr->p_vaddr; return VA; } - case SymbolBody::DefinedCommonKind: { - auto &D = cast>(Body); - return D.Section->OutSec->getVA() + D.Section->OutSecOff + D.Offset; - } + case SymbolBody::DefinedCommonKind: + return CommonInputSection::X->OutSec->getVA() + + CommonInputSection::X->OutSecOff + + cast>(Body).Offset; case SymbolBody::SharedKind: { auto &SS = cast>(Body); if (!SS.NeedsCopyOrPltAddr) diff --git a/lld/ELF/Symbols.h b/lld/ELF/Symbols.h index f8b5f46..a1170f4 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 *Section; }; // Regular defined symbols read from object file symbol tables.