llvm.org GIT mirror llvm / dd7918c
[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 Simon Atanasyan 5 years ago
1 changed file(s) with 6 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
155155 StringTableBuilder DotStrtab;
156156 /// \brief The section number of the ".strtab" section.
157157 unsigned DotStrtabSecNo;
158 /// \brief The accumulated contents of all sections so far.
159 ContiguousBlobAccumulator &SectionContentAccum;
160158 typedef typename object::ELFFile::Elf_Ehdr Elf_Ehdr;
161159
162160 SectionNameToIdxMap &SN2I;
163161
164162 public:
165 ELFState(ContiguousBlobAccumulator &Accum, unsigned DotStrtabSecNo_,
166 SectionNameToIdxMap &SN2I_)
167 : DotStrtab(), DotStrtabSecNo(DotStrtabSecNo_),
168 SectionContentAccum(Accum), SN2I(SN2I_) {}
163 ELFState(unsigned DotStrtabSecNo_, SectionNameToIdxMap &SN2I_)
164 : DotStrtab(), DotStrtabSecNo(DotStrtabSecNo_), SN2I(SN2I_) {}
169165
170166 unsigned getDotStrTabSecNo() const { return DotStrtabSecNo; }
171167 StringTableBuilder &getStringTable() { return DotStrtab; }
172 ContiguousBlobAccumulator &getSectionContentAccum() {
173 return SectionContentAccum;
174 }
175168 SectionNameToIdxMap &getSN2I() { return SN2I; }
176169 };
177170 } // end anonymous namespace
210203 static void
211204 handleSymtabSectionHeader(const ELFYAML::LocalGlobalWeakSymbols &Symbols,
212205 ELFState &State,
213 typename object::ELFFile::Elf_Shdr &SHeader) {
206 typename object::ELFFile::Elf_Shdr &SHeader,
207 ContiguousBlobAccumulator &CBA) {
214208
215209 typedef typename object::ELFFile::Elf_Sym Elf_Sym;
216210 SHeader.sh_type = ELF::SHT_SYMTAB;
230224 addSymbols(Symbols.Global, State, Syms, ELF::STB_GLOBAL);
231225 addSymbols(Symbols.Weak, State, Syms, ELF::STB_WEAK);
232226
233 ContiguousBlobAccumulator &CBA = State.getSectionContentAccum();
234227 writeArrayData(CBA.getOSAndAlignedOffset(SHeader.sh_offset),
235228 makeArrayRef(Syms));
236229 SHeader.sh_size = arrayDataSize(makeArrayRef(Syms));
298291 }
299292 }
300293
301 ELFState State(CBA, DotStrtabSecNo, SN2I);
294 ELFState State(DotStrtabSecNo, SN2I);
302295
303296 StringTableBuilder SHStrTab;
304297 std::vector SHeaders;
339332 Elf_Shdr SymtabSHeader;
340333 zero(SymtabSHeader);
341334 SymtabSHeader.sh_name = SHStrTab.addString(StringRef(".symtab"));
342 handleSymtabSectionHeader(Doc.Symbols, State, SymtabSHeader);
335 handleSymtabSectionHeader(Doc.Symbols, State, SymtabSHeader, CBA);
343336 SHeaders.push_back(SymtabSHeader);
344337
345338 // .strtab string table header.