@@ -167,7 +167,7 @@ struct ELFWriter {
167167 : llvm::endianness::big),
168168 Mode (Mode) {}
169169
170- void WriteWord (uint64_t Word) {
170+ void writeWord (uint64_t Word) {
171171 if (is64Bit ())
172172 W.write <uint64_t >(Word);
173173 else
@@ -197,20 +197,20 @@ struct ELFWriter {
197197 MCSectionELF *createRelocationSection (MCContext &Ctx,
198198 const MCSectionELF &Sec);
199199
200- void writeSectionHeader (const MCAssembler &Asm);
200+ void writeSectionHeaders (const MCAssembler &Asm);
201201
202202 void writeSectionData (const MCAssembler &Asm, MCSection &Sec);
203203
204- void WriteSecHdrEntry (uint32_t Name, uint32_t Type, uint64_t Flags,
205- uint64_t Address, uint64_t Offset, uint64_t Size,
206- uint32_t Link, uint32_t Info, MaybeAlign Alignment ,
207- uint64_t EntrySize);
204+ void writeSectionHeaderEntry (uint32_t Name, uint32_t Type, uint64_t Flags,
205+ uint64_t Address, uint64_t Offset, uint64_t Size,
206+ uint32_t Link, uint32_t Info,
207+ MaybeAlign Alignment, uint64_t EntrySize);
208208
209209 void writeRelocations (const MCAssembler &Asm, const MCSectionELF &Sec);
210210
211211 uint64_t writeObject (MCAssembler &Asm);
212- void writeSection (uint32_t GroupSymbolIndex, uint64_t Offset, uint64_t Size ,
213- const MCSectionELF &Section);
212+ void writeSectionHeader (uint32_t GroupSymbolIndex, uint64_t Offset,
213+ uint64_t Size, const MCSectionELF &Section);
214214};
215215} // end anonymous namespace
216216
@@ -317,9 +317,9 @@ void ELFWriter::writeHeader(const MCAssembler &Asm) {
317317 W.write <uint16_t >(OWriter.TargetObjectWriter ->getEMachine ()); // e_machine = target
318318
319319 W.write <uint32_t >(ELF::EV_CURRENT); // e_version
320- WriteWord (0 ); // e_entry, no entry point in .o file
321- WriteWord (0 ); // e_phoff, no program header for .o
322- WriteWord (0 ); // e_shoff = sec hdr table off in bytes
320+ writeWord (0 ); // e_entry, no entry point in .o file
321+ writeWord (0 ); // e_phoff, no program header for .o
322+ writeWord (0 ); // e_shoff = sec hdr table off in bytes
323323
324324 // e_flags = whatever the target wants
325325 W.write <uint32_t >(OWriter.getELFHeaderEFlags ());
@@ -791,20 +791,22 @@ void ELFWriter::writeSectionData(const MCAssembler &Asm, MCSection &Sec) {
791791 W.OS << toStringRef (Compressed);
792792}
793793
794- void ELFWriter::WriteSecHdrEntry (uint32_t Name, uint32_t Type, uint64_t Flags,
795- uint64_t Address, uint64_t Offset,
796- uint64_t Size, uint32_t Link, uint32_t Info,
797- MaybeAlign Alignment, uint64_t EntrySize) {
794+ void ELFWriter::writeSectionHeaderEntry (uint32_t Name, uint32_t Type,
795+ uint64_t Flags, uint64_t Address,
796+ uint64_t Offset, uint64_t Size,
797+ uint32_t Link, uint32_t Info,
798+ MaybeAlign Alignment,
799+ uint64_t EntrySize) {
798800 W.write <uint32_t >(Name); // sh_name: index into string table
799801 W.write <uint32_t >(Type); // sh_type
800- WriteWord (Flags); // sh_flags
801- WriteWord (Address); // sh_addr
802- WriteWord (Offset); // sh_offset
803- WriteWord (Size); // sh_size
802+ writeWord (Flags); // sh_flags
803+ writeWord (Address); // sh_addr
804+ writeWord (Offset); // sh_offset
805+ writeWord (Size); // sh_size
804806 W.write <uint32_t >(Link); // sh_link
805807 W.write <uint32_t >(Info); // sh_info
806- WriteWord (Alignment ? Alignment->value () : 0 ); // sh_addralign
807- WriteWord (EntrySize); // sh_entsize
808+ writeWord (Alignment ? Alignment->value () : 0 ); // sh_addralign
809+ writeWord (EntrySize); // sh_entsize
808810}
809811
810812template <bool Is64>
@@ -888,8 +890,8 @@ void ELFWriter::writeRelocations(const MCAssembler &Asm,
888890 }
889891}
890892
891- void ELFWriter::writeSection (uint32_t GroupSymbolIndex, uint64_t Offset,
892- uint64_t Size, const MCSectionELF &Section) {
893+ void ELFWriter::writeSectionHeader (uint32_t GroupSymbolIndex, uint64_t Offset,
894+ uint64_t Size, const MCSectionELF &Section) {
893895 uint64_t sh_link = 0 ;
894896 uint64_t sh_info = 0 ;
895897
@@ -936,19 +938,20 @@ void ELFWriter::writeSection(uint32_t GroupSymbolIndex, uint64_t Offset,
936938 sh_link = Sym->getSection ().getOrdinal ();
937939 }
938940
939- WriteSecHdrEntry (StrTabBuilder.getOffset (Section.getName ()),
940- Section.getType (), Section.getFlags (), 0 , Offset, Size ,
941- sh_link, sh_info, Section.getAlign (),
942- Section.getEntrySize ());
941+ writeSectionHeaderEntry (StrTabBuilder.getOffset (Section.getName ()),
942+ Section.getType (), Section.getFlags (), 0 , Offset,
943+ Size, sh_link, sh_info, Section.getAlign (),
944+ Section.getEntrySize ());
943945}
944946
945- void ELFWriter::writeSectionHeader (const MCAssembler &Asm) {
947+ void ELFWriter::writeSectionHeaders (const MCAssembler &Asm) {
946948 const unsigned NumSections = SectionTable.size ();
947949
948950 // Null section first.
949951 uint64_t FirstSectionSize =
950952 (NumSections + 1 ) >= ELF::SHN_LORESERVE ? NumSections + 1 : 0 ;
951- WriteSecHdrEntry (0 , 0 , 0 , 0 , 0 , FirstSectionSize, 0 , 0 , std::nullopt , 0 );
953+ writeSectionHeaderEntry (0 , 0 , 0 , 0 , 0 , FirstSectionSize, 0 , 0 , std::nullopt ,
954+ 0 );
952955
953956 for (const MCSectionELF *Section : SectionTable) {
954957 uint32_t GroupSymbolIndex;
@@ -1003,7 +1006,7 @@ void ELFWriter::writeSectionHeader(const MCAssembler &Asm) {
10031006 }
10041007 }
10051008
1006- writeSection (GroupSymbolIndex, Offsets.first , Size, *Section);
1009+ writeSectionHeader (GroupSymbolIndex, Offsets.first , Size, *Section);
10071010 }
10081011}
10091012
@@ -1126,7 +1129,7 @@ uint64_t ELFWriter::writeObject(MCAssembler &Asm) {
11261129 const uint64_t SectionHeaderOffset = align (is64Bit () ? Align (8 ) : Align (4 ));
11271130
11281131 // ... then the section header table ...
1129- writeSectionHeader (Asm);
1132+ writeSectionHeaders (Asm);
11301133
11311134 uint16_t NumSections = support::endian::byte_swap<uint16_t >(
11321135 (SectionTable.size () + 1 >= ELF::SHN_LORESERVE) ? (uint16_t )ELF::SHN_UNDEF
0 commit comments