diff options
author | Rui Ueyama <ruiu@google.com> | 2017-02-27 03:07:41 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-02-27 03:07:41 +0000 |
commit | 945055aabfb5decd9a9525ef04beee681f7b9815 (patch) | |
tree | aaa25f671f941405c00e8bc5787dce221dc6bfe3 | |
parent | 9320cb07199686cfa380a34a3e1af0b6763a7216 (diff) | |
download | bcm5719-llvm-945055aabfb5decd9a9525ef04beee681f7b9815.tar.gz bcm5719-llvm-945055aabfb5decd9a9525ef04beee681f7b9815.zip |
Rename SyntheticSection::finalize -> finalizeContents.
In LLD source code, too many functions are called "finalize", although
what they do are different. This patch gives it a better name.
llvm-svn: 296314
-rw-r--r-- | lld/ELF/SyntheticSections.cpp | 30 | ||||
-rw-r--r-- | lld/ELF/SyntheticSections.h | 34 | ||||
-rw-r--r-- | lld/ELF/Writer.cpp | 2 |
3 files changed, 33 insertions, 33 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp index 9f66c12193d..3e97f056767 100644 --- a/lld/ELF/SyntheticSections.cpp +++ b/lld/ELF/SyntheticSections.cpp @@ -526,7 +526,7 @@ static void writeCieFde(uint8_t *Buf, ArrayRef<uint8_t> D) { write32<E>(Buf, alignTo(D.size(), sizeof(typename ELFT::uint)) - 4); } -template <class ELFT> void EhFrameSection<ELFT>::finalize() { +template <class ELFT> void EhFrameSection<ELFT>::finalizeContents() { if (this->Size) return; // Already finalized. @@ -651,7 +651,7 @@ GotSection<ELFT>::getGlobalDynOffset(const SymbolBody &B) const { return B.GlobalDynIndex * sizeof(uintX_t); } -template <class ELFT> void GotSection<ELFT>::finalize() { +template <class ELFT> void GotSection<ELFT>::finalizeContents() { Size = NumEntries * sizeof(uintX_t); } @@ -831,7 +831,7 @@ unsigned MipsGotSection<ELFT>::getLocalEntriesNum() const { LocalEntries32.size(); } -template <class ELFT> void MipsGotSection<ELFT>::finalize() { +template <class ELFT> void MipsGotSection<ELFT>::finalizeContents() { PageEntriesNum = 0; for (std::pair<const OutputSection *, size_t> &P : PageIndexMap) { // For each output section referenced by GOT page relocations calculate @@ -1068,7 +1068,7 @@ template <class ELFT> void DynamicSection<ELFT>::addEntries() { } // Add remaining entries to complete .dynamic contents. -template <class ELFT> void DynamicSection<ELFT>::finalize() { +template <class ELFT> void DynamicSection<ELFT>::finalizeContents() { if (this->Size) return; // Already finalized. @@ -1258,7 +1258,7 @@ template <class ELFT> unsigned RelocationSection<ELFT>::getRelocOffset() { return this->Entsize * Relocs.size(); } -template <class ELFT> void RelocationSection<ELFT>::finalize() { +template <class ELFT> void RelocationSection<ELFT>::finalizeContents() { this->Link = In<ELFT>::DynSymTab ? In<ELFT>::DynSymTab->OutSec->SectionIndex : In<ELFT>::SymTab->OutSec->SectionIndex; @@ -1293,7 +1293,7 @@ static bool sortMipsSymbols(const SymbolBody *L, const SymbolBody *R) { return L->GotIndex < R->GotIndex; } -template <class ELFT> void SymbolTableSection<ELFT>::finalize() { +template <class ELFT> void SymbolTableSection<ELFT>::finalizeContents() { this->OutSec->Link = this->Link = StrTabSec.OutSec->SectionIndex; this->OutSec->Entsize = this->Entsize; @@ -1512,7 +1512,7 @@ unsigned GnuHashTableSection<ELFT>::calcMaskWords(unsigned NumHashed) { return NextPowerOf2((NumHashed - 1) / sizeof(Elf_Off)); } -template <class ELFT> void GnuHashTableSection<ELFT>::finalize() { +template <class ELFT> void GnuHashTableSection<ELFT>::finalizeContents() { unsigned NumHashed = Symbols.size(); NBuckets = calcNBuckets(NumHashed); MaskWords = calcMaskWords(NumHashed); @@ -1625,7 +1625,7 @@ HashTableSection<ELFT>::HashTableSection() this->Entsize = sizeof(Elf_Word); } -template <class ELFT> void HashTableSection<ELFT>::finalize() { +template <class ELFT> void HashTableSection<ELFT>::finalizeContents() { this->OutSec->Link = this->Link = In<ELFT>::DynSymTab->OutSec->SectionIndex; this->OutSec->Entsize = this->Entsize; @@ -1770,7 +1770,7 @@ template <class ELFT> void GdbIndexSection<ELFT>::readDwarf(InputSection *I) { } } -template <class ELFT> void GdbIndexSection<ELFT>::finalize() { +template <class ELFT> void GdbIndexSection<ELFT>::finalizeContents() { if (Finalized) return; Finalized = true; @@ -1795,7 +1795,7 @@ template <class ELFT> void GdbIndexSection<ELFT>::finalize() { } template <class ELFT> size_t GdbIndexSection<ELFT>::getSize() const { - const_cast<GdbIndexSection<ELFT> *>(this)->finalize(); + const_cast<GdbIndexSection<ELFT> *>(this)->finalizeContents(); return StringPoolOffset + StringPool.getSize(); } @@ -1918,7 +1918,7 @@ static StringRef getFileDefName() { return Config->OutputFile; } -template <class ELFT> void VersionDefinitionSection<ELFT>::finalize() { +template <class ELFT> void VersionDefinitionSection<ELFT>::finalizeContents() { FileDefNameOff = In<ELFT>::DynStrTab->addString(getFileDefName()); for (VersionDefinition &V : Config->VersionDefinitions) V.NameOff = In<ELFT>::DynStrTab->addString(V.Name); @@ -1971,7 +1971,7 @@ VersionTableSection<ELFT>::VersionTableSection() : SyntheticSection(SHF_ALLOC, SHT_GNU_versym, sizeof(uint16_t), ".gnu.version") {} -template <class ELFT> void VersionTableSection<ELFT>::finalize() { +template <class ELFT> void VersionTableSection<ELFT>::finalizeContents() { this->OutSec->Entsize = this->Entsize = sizeof(Elf_Versym); // At the moment of june 2016 GNU docs does not mention that sh_link field // should be set, but Sun docs do. Also readelf relies on this field. @@ -2066,7 +2066,7 @@ template <class ELFT> void VersionNeedSection<ELFT>::writeTo(uint8_t *Buf) { Verneed[-1].vn_next = 0; } -template <class ELFT> void VersionNeedSection<ELFT>::finalize() { +template <class ELFT> void VersionNeedSection<ELFT>::finalizeContents() { this->OutSec->Link = this->Link = In<ELFT>::DynStrTab->OutSec->SectionIndex; this->OutSec->Info = this->Info = Needed.size(); } @@ -2138,7 +2138,7 @@ template <class ELFT> void MergeSyntheticSection<ELFT>::finalizeNoTailMerge() { Builder.finalizeInOrder(); } -template <class ELFT> void MergeSyntheticSection<ELFT>::finalize() { +template <class ELFT> void MergeSyntheticSection<ELFT>::finalizeContents() { if (Finalized) return; Finalized = true; @@ -2150,7 +2150,7 @@ template <class ELFT> void MergeSyntheticSection<ELFT>::finalize() { template <class ELFT> size_t MergeSyntheticSection<ELFT>::getSize() const { // We should finalize string builder to know the size. - const_cast<MergeSyntheticSection<ELFT> *>(this)->finalize(); + const_cast<MergeSyntheticSection<ELFT> *>(this)->finalizeContents(); return Builder.getSize(); } diff --git a/lld/ELF/SyntheticSections.h b/lld/ELF/SyntheticSections.h index 513a70f3a40..69f5cc81494 100644 --- a/lld/ELF/SyntheticSections.h +++ b/lld/ELF/SyntheticSections.h @@ -42,7 +42,7 @@ public: virtual ~SyntheticSection() = default; virtual void writeTo(uint8_t *Buf) = 0; virtual size_t getSize() const = 0; - virtual void finalize() {} + virtual void finalizeContents() {} virtual bool empty() const { return false; } uint64_t getVA() const; @@ -71,7 +71,7 @@ template <class ELFT> class EhFrameSection final : public SyntheticSection { public: EhFrameSection(); void writeTo(uint8_t *Buf) override; - void finalize() override; + void finalizeContents() override; bool empty() const override { return Sections.empty(); } size_t getSize() const override { return Size; } @@ -106,7 +106,7 @@ public: GotSection(); void writeTo(uint8_t *Buf) override; size_t getSize() const override { return Size; } - void finalize() override; + void finalizeContents() override; bool empty() const override; void addEntry(SymbolBody &Sym); @@ -166,7 +166,7 @@ public: MipsGotSection(); void writeTo(uint8_t *Buf) override; size_t getSize() const override { return Size; } - void finalize() override; + void finalizeContents() override; bool empty() const override; void addEntry(SymbolBody &Sym, int64_t Addend, RelExpr Expr); bool addDynTlsEntry(SymbolBody &Sym); @@ -363,14 +363,14 @@ template <class ELFT> class DynamicSection final : public SyntheticSection { : Tag(Tag), Sym(Sym), Kind(SymAddr) {} }; - // finalize() fills this vector with the section contents. finalize() - // cannot directly create final section contents because when the - // function is called, symbol or section addresses are not fixed yet. + // finalizeContents() fills this vector with the section contents. + // finalizeContents()cannot directly create final section contents because + // when the function is called, symbol or section addresses are not fixed yet. std::vector<Entry> Entries; public: DynamicSection(); - void finalize() override; + void finalizeContents() override; void writeTo(uint8_t *Buf) override; size_t getSize() const override { return Size; } @@ -389,7 +389,7 @@ public: RelocationSection(StringRef Name, bool Sort); void addReloc(const DynamicReloc<ELFT> &Reloc); unsigned getRelocOffset(); - void finalize() override; + void finalizeContents() override; void writeTo(uint8_t *Buf) override; bool empty() const override { return Relocs.empty(); } size_t getSize() const override { return Relocs.size() * this->Entsize; } @@ -414,7 +414,7 @@ public: typedef typename ELFT::uint uintX_t; SymbolTableSection(StringTableSection<ELFT> &StrTabSec); - void finalize() override; + void finalizeContents() override; void writeTo(uint8_t *Buf) override; size_t getSize() const override { return getNumSymbols() * sizeof(Elf_Sym); } void addGlobal(SymbolBody *Body); @@ -449,7 +449,7 @@ class GnuHashTableSection final : public SyntheticSection { public: GnuHashTableSection(); - void finalize() override; + void finalizeContents() override; void writeTo(uint8_t *Buf) override; size_t getSize() const override { return this->Size; } @@ -484,7 +484,7 @@ template <class ELFT> class HashTableSection final : public SyntheticSection { public: HashTableSection(); - void finalize() override; + void finalizeContents() override; void writeTo(uint8_t *Buf) override; size_t getSize() const override { return this->Size; } @@ -525,7 +525,7 @@ template <class ELFT> class GdbIndexSection final : public SyntheticSection { public: GdbIndexSection(); - void finalize() override; + void finalizeContents() override; void writeTo(uint8_t *Buf) override; size_t getSize() const override; bool empty() const override; @@ -600,7 +600,7 @@ class VersionDefinitionSection final : public SyntheticSection { public: VersionDefinitionSection(); - void finalize() override; + void finalizeContents() override; size_t getSize() const override; void writeTo(uint8_t *Buf) override; @@ -622,7 +622,7 @@ class VersionTableSection final : public SyntheticSection { public: VersionTableSection(); - void finalize() override; + void finalizeContents() override; size_t getSize() const override; void writeTo(uint8_t *Buf) override; bool empty() const override; @@ -647,7 +647,7 @@ template <class ELFT> class VersionNeedSection final : public SyntheticSection { public: VersionNeedSection(); void addSymbol(SharedSymbol *SS); - void finalize() override; + void finalizeContents() override; void writeTo(uint8_t *Buf) override; size_t getSize() const override; size_t getNeedNum() const { return Needed.size(); } @@ -667,7 +667,7 @@ public: uintX_t Alignment); void addSection(MergeInputSection<ELFT> *MS); void writeTo(uint8_t *Buf) override; - void finalize() override; + void finalizeContents() override; bool shouldTailMerge() const; size_t getSize() const override; diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp index 3db4f4fa74b..127bfdc249f 100644 --- a/lld/ELF/Writer.cpp +++ b/lld/ELF/Writer.cpp @@ -1025,7 +1025,7 @@ template <class ELFT> static void finalizeSynthetic(const std::vector<SyntheticSection *> &Sections) { for (SyntheticSection *SS : Sections) if (SS && SS->OutSec && !SS->empty()) { - SS->finalize(); + SS->finalizeContents(); SS->OutSec->Size = 0; SS->OutSec->template assignOffsets<ELFT>(); } |