Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit eafe465

Browse files
author
Jim Grosbach
committed
MC: Clean up the naming for MCMachObjectWriter. NFC.
s/ExecutePostLayoutBinding/executePostLayoutBinding/ s/ComputeSymbolTable/computeSymbolTable/ s/BindIndirectSymbols/bindIndirectSymbols/ s/RecordTLVPRelocation/recordTLVPRelocation/ s/RecordScatteredRelocation/recordScatteredRelocation/ s/WriteLinkerOptionsLoadCommand/writeLinkerOptionsLoadCommand/ s/WriteLinkeditLoadCommand/writeLinkeditLoadCommand/ s/WriteNlist/writeNlist/ s/WriteDysymtabLoadCommand/writeDysymtabLoadCommand/ s/WriteSymtabLoadCommand/writeSymtabLoadCommand/ s/WriteSection/writeSection/ s/WriteSegmentLoadCommand/writeSegmentLoadCommand/ s/WriteHeader/writeHeader/ git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239119 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e2f8759 commit eafe465

File tree

9 files changed

+62
-62
lines changed

9 files changed

+62
-62
lines changed

include/llvm/MC/MCMachObjectWriter.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -159,37 +159,37 @@ class MachObjectWriter : public MCObjectWriter {
159159

160160
/// @}
161161

162-
void WriteHeader(unsigned NumLoadCommands, unsigned LoadCommandsSize,
162+
void writeHeader(unsigned NumLoadCommands, unsigned LoadCommandsSize,
163163
bool SubsectionsViaSymbols);
164164

165165
/// Write a segment load command.
166166
///
167167
/// \param NumSections The number of sections in this segment.
168168
/// \param SectionDataSize The total size of the sections.
169-
void WriteSegmentLoadCommand(unsigned NumSections, uint64_t VMSize,
169+
void writeSegmentLoadCommand(unsigned NumSections, uint64_t VMSize,
170170
uint64_t SectionDataStartOffset,
171171
uint64_t SectionDataSize);
172172

173-
void WriteSection(const MCAssembler &Asm, const MCAsmLayout &Layout,
173+
void writeSection(const MCAssembler &Asm, const MCAsmLayout &Layout,
174174
const MCSection &Sec, uint64_t FileOffset,
175175
uint64_t RelocationsStart, unsigned NumRelocations);
176176

177-
void WriteSymtabLoadCommand(uint32_t SymbolOffset, uint32_t NumSymbols,
177+
void writeSymtabLoadCommand(uint32_t SymbolOffset, uint32_t NumSymbols,
178178
uint32_t StringTableOffset,
179179
uint32_t StringTableSize);
180180

181-
void WriteDysymtabLoadCommand(
181+
void writeDysymtabLoadCommand(
182182
uint32_t FirstLocalSymbol, uint32_t NumLocalSymbols,
183183
uint32_t FirstExternalSymbol, uint32_t NumExternalSymbols,
184184
uint32_t FirstUndefinedSymbol, uint32_t NumUndefinedSymbols,
185185
uint32_t IndirectSymbolOffset, uint32_t NumIndirectSymbols);
186186

187-
void WriteNlist(MachSymbolData &MSD, const MCAsmLayout &Layout);
187+
void writeNlist(MachSymbolData &MSD, const MCAsmLayout &Layout);
188188

189-
void WriteLinkeditLoadCommand(uint32_t Type, uint32_t DataOffset,
189+
void writeLinkeditLoadCommand(uint32_t Type, uint32_t DataOffset,
190190
uint32_t DataSize);
191191

192-
void WriteLinkerOptionsLoadCommand(const std::vector<std::string> &Options);
192+
void writeLinkerOptionsLoadCommand(const std::vector<std::string> &Options);
193193

194194
// FIXME: We really need to improve the relocation validation. Basically, we
195195
// want to implement a separate computation which evaluates the relocation
@@ -216,13 +216,13 @@ class MachObjectWriter : public MCObjectWriter {
216216
Relocations[Sec].push_back(P);
217217
}
218218

219-
void RecordScatteredRelocation(const MCAssembler &Asm,
219+
void recordScatteredRelocation(const MCAssembler &Asm,
220220
const MCAsmLayout &Layout,
221221
const MCFragment *Fragment,
222222
const MCFixup &Fixup, MCValue Target,
223223
unsigned Log2Size, uint64_t &FixedValue);
224224

225-
void RecordTLVPRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,
225+
void recordTLVPRelocation(const MCAssembler &Asm, const MCAsmLayout &Layout,
226226
const MCFragment *Fragment, const MCFixup &Fixup,
227227
MCValue Target, uint64_t &FixedValue);
228228

@@ -231,18 +231,18 @@ class MachObjectWriter : public MCObjectWriter {
231231
MCValue Target, bool &IsPCRel,
232232
uint64_t &FixedValue) override;
233233

234-
void BindIndirectSymbols(MCAssembler &Asm);
234+
void bindIndirectSymbols(MCAssembler &Asm);
235235

236236
/// Compute the symbol table data.
237-
void ComputeSymbolTable(MCAssembler &Asm,
237+
void computeSymbolTable(MCAssembler &Asm,
238238
std::vector<MachSymbolData> &LocalSymbolData,
239239
std::vector<MachSymbolData> &ExternalSymbolData,
240240
std::vector<MachSymbolData> &UndefinedSymbolData);
241241

242242
void computeSectionAddresses(const MCAssembler &Asm,
243243
const MCAsmLayout &Layout);
244244

245-
void ExecutePostLayoutBinding(MCAssembler &Asm,
245+
void executePostLayoutBinding(MCAssembler &Asm,
246246
const MCAsmLayout &Layout) override;
247247

248248
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,

include/llvm/MC/MCObjectWriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class MCObjectWriter {
6767
///
6868
/// This routine is called by the assembler after layout and relaxation is
6969
/// complete.
70-
virtual void ExecutePostLayoutBinding(MCAssembler &Asm,
70+
virtual void executePostLayoutBinding(MCAssembler &Asm,
7171
const MCAsmLayout &Layout) = 0;
7272

7373
/// Record a relocation entry.

lib/MC/ELFObjectWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ class ELFObjectWriter : public MCObjectWriter {
199199

200200
const MCSectionELF *createStringTable(MCContext &Ctx);
201201

202-
void ExecutePostLayoutBinding(MCAssembler &Asm,
202+
void executePostLayoutBinding(MCAssembler &Asm,
203203
const MCAsmLayout &Layout) override;
204204

205205
void writeSectionHeader(const MCAsmLayout &Layout,
@@ -365,7 +365,7 @@ uint64_t ELFObjectWriter::SymbolValue(const MCSymbol &Sym,
365365
return Res;
366366
}
367367

368-
void ELFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
368+
void ELFObjectWriter::executePostLayoutBinding(MCAssembler &Asm,
369369
const MCAsmLayout &Layout) {
370370
// The presence of symbol versions causes undefined symbols and
371371
// versions declared with @@@ to be renamed.

lib/MC/MCAssembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ void MCAssembler::Finish() {
874874

875875
// Allow the object writer a chance to perform post-layout binding (for
876876
// example, to set the index fields in the symbol data).
877-
getWriter().ExecutePostLayoutBinding(*this, Layout);
877+
getWriter().executePostLayoutBinding(*this, Layout);
878878

879879
// Evaluate and apply the fixups, generating relocation entries as necessary.
880880
for (MCAssembler::iterator it = begin(), ie = end(); it != ie; ++it) {

lib/MC/MachObjectWriter.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ uint64_t MachObjectWriter::getPaddingSize(const MCSection *Sec,
118118
return OffsetToAlignment(EndAddr, NextSec.getAlignment());
119119
}
120120

121-
void MachObjectWriter::WriteHeader(unsigned NumLoadCommands,
121+
void MachObjectWriter::writeHeader(unsigned NumLoadCommands,
122122
unsigned LoadCommandsSize,
123123
bool SubsectionsViaSymbols) {
124124
uint32_t Flags = 0;
@@ -148,11 +148,11 @@ void MachObjectWriter::WriteHeader(unsigned NumLoadCommands,
148148
(is64Bit()?sizeof(MachO::mach_header_64): sizeof(MachO::mach_header)));
149149
}
150150

151-
/// WriteSegmentLoadCommand - Write a segment load command.
151+
/// writeSegmentLoadCommand - Write a segment load command.
152152
///
153153
/// \param NumSections The number of sections in this segment.
154154
/// \param SectionDataSize The total size of the sections.
155-
void MachObjectWriter::WriteSegmentLoadCommand(unsigned NumSections,
155+
void MachObjectWriter::writeSegmentLoadCommand(unsigned NumSections,
156156
uint64_t VMSize,
157157
uint64_t SectionDataStartOffset,
158158
uint64_t SectionDataSize) {
@@ -192,7 +192,7 @@ void MachObjectWriter::WriteSegmentLoadCommand(unsigned NumSections,
192192
assert(OS.tell() - Start == SegmentLoadCommandSize);
193193
}
194194

195-
void MachObjectWriter::WriteSection(const MCAssembler &Asm,
195+
void MachObjectWriter::writeSection(const MCAssembler &Asm,
196196
const MCAsmLayout &Layout,
197197
const MCSection &Sec, uint64_t FileOffset,
198198
uint64_t RelocationsStart,
@@ -241,7 +241,7 @@ void MachObjectWriter::WriteSection(const MCAssembler &Asm,
241241
sizeof(MachO::section)));
242242
}
243243

244-
void MachObjectWriter::WriteSymtabLoadCommand(uint32_t SymbolOffset,
244+
void MachObjectWriter::writeSymtabLoadCommand(uint32_t SymbolOffset,
245245
uint32_t NumSymbols,
246246
uint32_t StringTableOffset,
247247
uint32_t StringTableSize) {
@@ -260,7 +260,7 @@ void MachObjectWriter::WriteSymtabLoadCommand(uint32_t SymbolOffset,
260260
assert(OS.tell() - Start == sizeof(MachO::symtab_command));
261261
}
262262

263-
void MachObjectWriter::WriteDysymtabLoadCommand(uint32_t FirstLocalSymbol,
263+
void MachObjectWriter::writeDysymtabLoadCommand(uint32_t FirstLocalSymbol,
264264
uint32_t NumLocalSymbols,
265265
uint32_t FirstExternalSymbol,
266266
uint32_t NumExternalSymbols,
@@ -320,7 +320,7 @@ const MCSymbol &MachObjectWriter::findAliasedSymbol(const MCSymbol &Sym) const {
320320
return *S;
321321
}
322322

323-
void MachObjectWriter::WriteNlist(MachSymbolData &MSD,
323+
void MachObjectWriter::writeNlist(MachSymbolData &MSD,
324324
const MCAsmLayout &Layout) {
325325
const MCSymbol *Symbol = MSD.Symbol;
326326
const MCSymbol &Data = *Symbol;
@@ -403,7 +403,7 @@ void MachObjectWriter::WriteNlist(MachSymbolData &MSD,
403403
write32(Address);
404404
}
405405

406-
void MachObjectWriter::WriteLinkeditLoadCommand(uint32_t Type,
406+
void MachObjectWriter::writeLinkeditLoadCommand(uint32_t Type,
407407
uint32_t DataOffset,
408408
uint32_t DataSize) {
409409
uint64_t Start = OS.tell();
@@ -426,7 +426,7 @@ static unsigned ComputeLinkerOptionsLoadCommandSize(
426426
return RoundUpToAlignment(Size, is64Bit ? 8 : 4);
427427
}
428428

429-
void MachObjectWriter::WriteLinkerOptionsLoadCommand(
429+
void MachObjectWriter::writeLinkerOptionsLoadCommand(
430430
const std::vector<std::string> &Options)
431431
{
432432
unsigned Size = ComputeLinkerOptionsLoadCommandSize(Options, is64Bit());
@@ -458,7 +458,7 @@ void MachObjectWriter::recordRelocation(MCAssembler &Asm,
458458
Target, FixedValue);
459459
}
460460

461-
void MachObjectWriter::BindIndirectSymbols(MCAssembler &Asm) {
461+
void MachObjectWriter::bindIndirectSymbols(MCAssembler &Asm) {
462462
// This is the point where 'as' creates actual symbols for indirect symbols
463463
// (in the following two passes). It would be easier for us to do this sooner
464464
// when we see the attribute, but that makes getting the order in the symbol
@@ -519,8 +519,8 @@ void MachObjectWriter::BindIndirectSymbols(MCAssembler &Asm) {
519519
}
520520
}
521521

522-
/// ComputeSymbolTable - Compute the symbol table data
523-
void MachObjectWriter::ComputeSymbolTable(
522+
/// computeSymbolTable - Compute the symbol table data
523+
void MachObjectWriter::computeSymbolTable(
524524
MCAssembler &Asm, std::vector<MachSymbolData> &LocalSymbolData,
525525
std::vector<MachSymbolData> &ExternalSymbolData,
526526
std::vector<MachSymbolData> &UndefinedSymbolData) {
@@ -636,12 +636,12 @@ void MachObjectWriter::computeSectionAddresses(const MCAssembler &Asm,
636636
}
637637
}
638638

639-
void MachObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
639+
void MachObjectWriter::executePostLayoutBinding(MCAssembler &Asm,
640640
const MCAsmLayout &Layout) {
641641
computeSectionAddresses(Asm, Layout);
642642

643643
// Create symbol data for any indirect symbols.
644-
BindIndirectSymbols(Asm);
644+
bindIndirectSymbols(Asm);
645645
}
646646

647647
bool MachObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
@@ -714,7 +714,7 @@ bool MachObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
714714
void MachObjectWriter::writeObject(MCAssembler &Asm,
715715
const MCAsmLayout &Layout) {
716716
// Compute symbol table information and bind symbol indices.
717-
ComputeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData,
717+
computeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData,
718718
UndefinedSymbolData);
719719

720720
unsigned NumSections = Asm.size();
@@ -793,9 +793,9 @@ void MachObjectWriter::writeObject(MCAssembler &Asm,
793793
SectionDataFileSize += SectionDataPadding;
794794

795795
// Write the prolog, starting with the header and load command...
796-
WriteHeader(NumLoadCommands, LoadCommandsSize,
796+
writeHeader(NumLoadCommands, LoadCommandsSize,
797797
Asm.getSubsectionsViaSymbols());
798-
WriteSegmentLoadCommand(NumSections, VMSize,
798+
writeSegmentLoadCommand(NumSections, VMSize,
799799
SectionDataStart, SectionDataSize);
800800

801801
// ... and then the section headers.
@@ -804,7 +804,7 @@ void MachObjectWriter::writeObject(MCAssembler &Asm,
804804
std::vector<RelAndSymbol> &Relocs = Relocations[&Sec];
805805
unsigned NumRelocs = Relocs.size();
806806
uint64_t SectionStart = SectionDataStart + getSectionAddress(&Sec);
807-
WriteSection(Asm, Layout, Sec, SectionStart, RelocTableEnd, NumRelocs);
807+
writeSection(Asm, Layout, Sec, SectionStart, RelocTableEnd, NumRelocs);
808808
RelocTableEnd += NumRelocs * sizeof(MachO::any_relocation_info);
809809
}
810810

@@ -827,14 +827,14 @@ void MachObjectWriter::writeObject(MCAssembler &Asm,
827827
if (NumDataRegions) {
828828
uint64_t DataRegionsOffset = RelocTableEnd;
829829
uint64_t DataRegionsSize = NumDataRegions * 8;
830-
WriteLinkeditLoadCommand(MachO::LC_DATA_IN_CODE, DataRegionsOffset,
830+
writeLinkeditLoadCommand(MachO::LC_DATA_IN_CODE, DataRegionsOffset,
831831
DataRegionsSize);
832832
}
833833

834834
// Write the loh load command, if used.
835835
uint64_t LOHTableEnd = DataInCodeTableEnd + LOHSize;
836836
if (LOHSize)
837-
WriteLinkeditLoadCommand(MachO::LC_LINKER_OPTIMIZATION_HINT,
837+
writeLinkeditLoadCommand(MachO::LC_LINKER_OPTIMIZATION_HINT,
838838
DataInCodeTableEnd, LOHSize);
839839

840840
// Write the symbol table load command, if used.
@@ -863,18 +863,18 @@ void MachObjectWriter::writeObject(MCAssembler &Asm,
863863
SymbolTableOffset + NumSymTabSymbols * (is64Bit() ?
864864
sizeof(MachO::nlist_64) :
865865
sizeof(MachO::nlist));
866-
WriteSymtabLoadCommand(SymbolTableOffset, NumSymTabSymbols,
866+
writeSymtabLoadCommand(SymbolTableOffset, NumSymTabSymbols,
867867
StringTableOffset, StringTable.data().size());
868868

869-
WriteDysymtabLoadCommand(FirstLocalSymbol, NumLocalSymbols,
869+
writeDysymtabLoadCommand(FirstLocalSymbol, NumLocalSymbols,
870870
FirstExternalSymbol, NumExternalSymbols,
871871
FirstUndefinedSymbol, NumUndefinedSymbols,
872872
IndirectSymbolOffset, NumIndirectSymbols);
873873
}
874874

875875
// Write the linker options load commands.
876876
for (const auto &Option : Asm.getLinkerOptions())
877-
WriteLinkerOptionsLoadCommand(Option);
877+
writeLinkerOptionsLoadCommand(Option);
878878

879879
// Write the actual section data.
880880
for (const MCSection &Sec : Asm) {
@@ -956,7 +956,7 @@ void MachObjectWriter::writeObject(MCAssembler &Asm,
956956
for (auto *SymbolData :
957957
{&LocalSymbolData, &ExternalSymbolData, &UndefinedSymbolData})
958958
for (MachSymbolData &Entry : *SymbolData)
959-
WriteNlist(Entry, Layout);
959+
writeNlist(Entry, Layout);
960960

961961
// Write the string table.
962962
OS << StringTable.data();

lib/MC/WinCOFFObjectWriter.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ class WinCOFFObjectWriter : public MCObjectWriter {
169169
void WriteFileHeader(const COFF::header &Header);
170170
void WriteSymbol(const COFFSymbol &S);
171171
void WriteAuxiliarySymbols(const COFFSymbol::AuxiliarySymbols &S);
172-
void WriteSectionHeader(const COFF::section &S);
172+
void writeSectionHeader(const COFF::section &S);
173173
void WriteRelocation(const COFF::relocation &R);
174174

175175
// MCObjectWriter interface implementation.
176176

177-
void ExecutePostLayoutBinding(MCAssembler &Asm,
177+
void executePostLayoutBinding(MCAssembler &Asm,
178178
const MCAsmLayout &Layout) override;
179179

180180
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
@@ -634,7 +634,7 @@ void WinCOFFObjectWriter::WriteAuxiliarySymbols(
634634
}
635635
}
636636

637-
void WinCOFFObjectWriter::WriteSectionHeader(const COFF::section &S) {
637+
void WinCOFFObjectWriter::writeSectionHeader(const COFF::section &S) {
638638
writeBytes(StringRef(S.Name, COFF::NameSize));
639639

640640
writeLE32(S.VirtualSize);
@@ -657,7 +657,7 @@ void WinCOFFObjectWriter::WriteRelocation(const COFF::relocation &R) {
657657
////////////////////////////////////////////////////////////////////////////////
658658
// MCObjectWriter interface implementations
659659

660-
void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
660+
void WinCOFFObjectWriter::executePostLayoutBinding(MCAssembler &Asm,
661661
const MCAsmLayout &Layout) {
662662
// "Define" each section & symbol. This creates section & symbol
663663
// entries in the staging area.
@@ -715,9 +715,9 @@ void WinCOFFObjectWriter::recordRelocation(
715715

716716
// Mark this symbol as requiring an entry in the symbol table.
717717
assert(SectionMap.find(Section) != SectionMap.end() &&
718-
"Section must already have been defined in ExecutePostLayoutBinding!");
718+
"Section must already have been defined in executePostLayoutBinding!");
719719
assert(SymbolMap.find(&A) != SymbolMap.end() &&
720-
"Symbol must already have been defined in ExecutePostLayoutBinding!");
720+
"Symbol must already have been defined in executePostLayoutBinding!");
721721

722722
COFFSection *coff_section = SectionMap[Section];
723723
COFFSymbol *coff_symbol = SymbolMap[&A];
@@ -1027,7 +1027,7 @@ void WinCOFFObjectWriter::writeObject(MCAssembler &Asm,
10271027
if (Section->Number != -1) {
10281028
if (Section->Relocations.size() >= 0xffff)
10291029
Section->Header.Characteristics |= COFF::IMAGE_SCN_LNK_NRELOC_OVFL;
1030-
WriteSectionHeader(Section->Header);
1030+
writeSectionHeader(Section->Header);
10311031
}
10321032
}
10331033

lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ using namespace llvm;
2424

2525
namespace {
2626
class PPCMachObjectWriter : public MCMachObjectTargetWriter {
27-
bool RecordScatteredRelocation(MachObjectWriter *Writer,
27+
bool recordScatteredRelocation(MachObjectWriter *Writer,
2828
const MCAssembler &Asm,
2929
const MCAsmLayout &Layout,
3030
const MCFragment *Fragment,
@@ -186,9 +186,9 @@ static uint32_t getFixupOffset(const MCAsmLayout &Layout,
186186

187187
/// \return false if falling back to using non-scattered relocation,
188188
/// otherwise true for normal scattered relocation.
189-
/// based on X86MachObjectWriter::RecordScatteredRelocation
190-
/// and ARMMachObjectWriter::RecordScatteredRelocation
191-
bool PPCMachObjectWriter::RecordScatteredRelocation(
189+
/// based on X86MachObjectWriter::recordScatteredRelocation
190+
/// and ARMMachObjectWriter::recordScatteredRelocation
191+
bool PPCMachObjectWriter::recordScatteredRelocation(
192192
MachObjectWriter *Writer, const MCAssembler &Asm, const MCAsmLayout &Layout,
193193
const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target,
194194
unsigned Log2Size, uint64_t &FixedValue) {
@@ -314,7 +314,7 @@ void PPCMachObjectWriter::RecordPPCRelocation(
314314
// Q: are branch targets ever scattered?
315315
RelocType != MachO::PPC_RELOC_BR24 &&
316316
RelocType != MachO::PPC_RELOC_BR14) {
317-
RecordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
317+
recordScatteredRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
318318
Log2Size, FixedValue);
319319
return;
320320
}

0 commit comments

Comments
 (0)