From dd7918c68836492ad3d49acc50f228efceb8119a Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Wed, 2 Apr 2014 16:34:34 +0000 Subject: [yaml2obj][ELF] Remove relationship between ELFState and ContiguousBlobAccumulator classes. Pass ContiguousBlobAccumulator to the handleSymtabSectionHeader function directly. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205431 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/yaml2obj/yaml2elf.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'tools') diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp index e79ddcd824..e02c12599f 100644 --- a/tools/yaml2obj/yaml2elf.cpp +++ b/tools/yaml2obj/yaml2elf.cpp @@ -156,23 +156,16 @@ class ELFState { StringTableBuilder DotStrtab; /// \brief The section number of the ".strtab" section. unsigned DotStrtabSecNo; - /// \brief The accumulated contents of all sections so far. - ContiguousBlobAccumulator &SectionContentAccum; typedef typename object::ELFFile::Elf_Ehdr Elf_Ehdr; SectionNameToIdxMap &SN2I; public: - ELFState(ContiguousBlobAccumulator &Accum, unsigned DotStrtabSecNo_, - SectionNameToIdxMap &SN2I_) - : DotStrtab(), DotStrtabSecNo(DotStrtabSecNo_), - SectionContentAccum(Accum), SN2I(SN2I_) {} + ELFState(unsigned DotStrtabSecNo_, SectionNameToIdxMap &SN2I_) + : DotStrtab(), DotStrtabSecNo(DotStrtabSecNo_), SN2I(SN2I_) {} unsigned getDotStrTabSecNo() const { return DotStrtabSecNo; } StringTableBuilder &getStringTable() { return DotStrtab; } - ContiguousBlobAccumulator &getSectionContentAccum() { - return SectionContentAccum; - } SectionNameToIdxMap &getSN2I() { return SN2I; } }; } // end anonymous namespace @@ -211,7 +204,8 @@ template static void handleSymtabSectionHeader(const ELFYAML::LocalGlobalWeakSymbols &Symbols, ELFState &State, - typename object::ELFFile::Elf_Shdr &SHeader) { + typename object::ELFFile::Elf_Shdr &SHeader, + ContiguousBlobAccumulator &CBA) { typedef typename object::ELFFile::Elf_Sym Elf_Sym; SHeader.sh_type = ELF::SHT_SYMTAB; @@ -231,7 +225,6 @@ handleSymtabSectionHeader(const ELFYAML::LocalGlobalWeakSymbols &Symbols, addSymbols(Symbols.Global, State, Syms, ELF::STB_GLOBAL); addSymbols(Symbols.Weak, State, Syms, ELF::STB_WEAK); - ContiguousBlobAccumulator &CBA = State.getSectionContentAccum(); writeArrayData(CBA.getOSAndAlignedOffset(SHeader.sh_offset), makeArrayRef(Syms)); SHeader.sh_size = arrayDataSize(makeArrayRef(Syms)); @@ -299,7 +292,7 @@ static int writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) { } } - ELFState State(CBA, DotStrtabSecNo, SN2I); + ELFState State(DotStrtabSecNo, SN2I); StringTableBuilder SHStrTab; std::vector SHeaders; @@ -340,7 +333,7 @@ static int writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) { Elf_Shdr SymtabSHeader; zero(SymtabSHeader); SymtabSHeader.sh_name = SHStrTab.addString(StringRef(".symtab")); - handleSymtabSectionHeader(Doc.Symbols, State, SymtabSHeader); + handleSymtabSectionHeader(Doc.Symbols, State, SymtabSHeader, CBA); SHeaders.push_back(SymtabSHeader); // .strtab string table header. -- cgit v1.2.3