MC: Clean up naming in MCObjectWriter. NFC.

s/WriteObject/writeObject/
s/RecordRelocation/recordRelocation/
s/IsSymbolRefDifferenceFullyResolved/isSymbolRefDifferenceFullyResolved/
s/Write8/write8/
s/WriteLE16/writeLE16/
s/WriteLE32/writeLE32/
s/WriteLE64/writeLE64/
s/WriteBE16/writeBE16/
s/WriteBE32/writeBE32/
s/WriteBE64/writeBE64/
s/Write16/write16/
s/Write32/write32/
s/Write64/write64/
s/WriteZeroes/writeZeroes/
s/WriteBytes/writeBytes/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239108 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jim Grosbach 2015-06-04 22:24:41 +00:00
parent cc68225e0c
commit bc81286cac
20 changed files with 262 additions and 262 deletions

View File

@ -62,7 +62,7 @@ public:
/// \name API
/// @{
virtual void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
virtual void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout,
const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
@ -234,7 +234,7 @@ public:
const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue);
void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup,
MCValue Target, bool &IsPCRel,
uint64_t &FixedValue) override;
@ -254,12 +254,12 @@ public:
void ExecutePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) override;
bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
const MCSymbol &SymA,
const MCFragment &FB, bool InSet,
bool IsPCRel) const override;
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
};

View File

@ -32,7 +32,7 @@ class MCValue;
/// the object writer to modify the assembler data structures at appropriate
/// points. Once assembly is complete, the object writer is given the
/// MCAssembler instance, which contains all the symbol and section data which
/// should be emitted as part of WriteObject().
/// should be emitted as part of writeObject().
///
/// The object writer also contains a number of helper methods for writing
/// binary data to the output stream.
@ -75,8 +75,8 @@ public:
/// This routine is called by the assembler after layout and relaxation, and
/// post layout binding. The implementation is responsible for storing
/// information about the relocation so that it can be emitted during
/// WriteObject().
virtual void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
/// writeObject().
virtual void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
bool &IsPCRel, uint64_t &FixedValue) = 0;
@ -86,12 +86,12 @@ public:
///
/// Clients are not required to answer precisely and may conservatively return
/// false, even when a difference is fully resolved.
bool IsSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
bool isSymbolRefDifferenceFullyResolved(const MCAssembler &Asm,
const MCSymbolRefExpr *A,
const MCSymbolRefExpr *B,
bool InSet) const;
virtual bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
virtual bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
const MCSymbol &SymA,
const MCFragment &FB,
bool InSet,
@ -107,57 +107,57 @@ public:
/// This routine is called by the assembler after layout and relaxation is
/// complete, fixups have been evaluated and applied, and relocations
/// generated.
virtual void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) = 0;
virtual void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) = 0;
/// @}
/// \name Binary Output
/// @{
void Write8(uint8_t Value) { OS << char(Value); }
void write8(uint8_t Value) { OS << char(Value); }
void WriteLE16(uint16_t Value) {
void writeLE16(uint16_t Value) {
support::endian::Writer<support::little>(OS).write(Value);
}
void WriteLE32(uint32_t Value) {
void writeLE32(uint32_t Value) {
support::endian::Writer<support::little>(OS).write(Value);
}
void WriteLE64(uint64_t Value) {
void writeLE64(uint64_t Value) {
support::endian::Writer<support::little>(OS).write(Value);
}
void WriteBE16(uint16_t Value) {
void writeBE16(uint16_t Value) {
support::endian::Writer<support::big>(OS).write(Value);
}
void WriteBE32(uint32_t Value) {
void writeBE32(uint32_t Value) {
support::endian::Writer<support::big>(OS).write(Value);
}
void WriteBE64(uint64_t Value) {
void writeBE64(uint64_t Value) {
support::endian::Writer<support::big>(OS).write(Value);
}
void Write16(uint16_t Value) {
void write16(uint16_t Value) {
if (IsLittleEndian)
WriteLE16(Value);
writeLE16(Value);
else
WriteBE16(Value);
writeBE16(Value);
}
void Write32(uint32_t Value) {
void write32(uint32_t Value) {
if (IsLittleEndian)
WriteLE32(Value);
writeLE32(Value);
else
WriteBE32(Value);
writeBE32(Value);
}
void Write64(uint64_t Value) {
void write64(uint64_t Value) {
if (IsLittleEndian)
WriteLE64(Value);
writeLE64(Value);
else
WriteBE64(Value);
writeBE64(Value);
}
void WriteZeros(unsigned N) {
@ -169,12 +169,12 @@ public:
OS << StringRef(Zeros, N % 16);
}
void WriteBytes(const SmallVectorImpl<char> &ByteVec,
void writeBytes(const SmallVectorImpl<char> &ByteVec,
unsigned ZeroFillSize = 0) {
WriteBytes(StringRef(ByteVec.data(), ByteVec.size()), ZeroFillSize);
writeBytes(StringRef(ByteVec.data(), ByteVec.size()), ZeroFillSize);
}
void WriteBytes(StringRef Str, unsigned ZeroFillSize = 0) {
void writeBytes(StringRef Str, unsigned ZeroFillSize = 0) {
// TODO: this version may need to go away once all fragment contents are
// converted to SmallVector<char, N>
assert(

View File

@ -150,9 +150,9 @@ class ELFObjectWriter : public MCObjectWriter {
void WriteWord(uint64_t W) {
if (is64Bit())
Write64(W);
write64(W);
else
Write32(W);
write32(W);
}
template <typename T> void write(T Val) {
@ -176,7 +176,7 @@ class ELFObjectWriter : public MCObjectWriter {
const MCSymbol *Sym, uint64_t C,
unsigned Type) const;
void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup,
MCValue Target, bool &IsPCRel,
uint64_t &FixedValue) override;
@ -216,7 +216,7 @@ class ELFObjectWriter : public MCObjectWriter {
void writeRelocations(const MCAssembler &Asm, const MCSectionELF &Sec);
bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
const MCSymbol &SymA,
const MCFragment &FB,
bool InSet,
@ -224,7 +224,7 @@ class ELFObjectWriter : public MCObjectWriter {
bool isWeak(const MCSymbol &Sym) const override;
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
void writeSection(const SectionIndexMapTy &SectionIndexMap,
uint32_t GroupSymbolIndex, uint64_t Offset, uint64_t Size,
const MCSectionELF &Section);
@ -307,47 +307,47 @@ void ELFObjectWriter::writeHeader(const MCAssembler &Asm) {
// emitWord method behaves differently for ELF32 and ELF64, writing
// 4 bytes in the former and 8 in the latter.
WriteBytes(ELF::ElfMagic); // e_ident[EI_MAG0] to e_ident[EI_MAG3]
writeBytes(ELF::ElfMagic); // e_ident[EI_MAG0] to e_ident[EI_MAG3]
Write8(is64Bit() ? ELF::ELFCLASS64 : ELF::ELFCLASS32); // e_ident[EI_CLASS]
write8(is64Bit() ? ELF::ELFCLASS64 : ELF::ELFCLASS32); // e_ident[EI_CLASS]
// e_ident[EI_DATA]
Write8(isLittleEndian() ? ELF::ELFDATA2LSB : ELF::ELFDATA2MSB);
write8(isLittleEndian() ? ELF::ELFDATA2LSB : ELF::ELFDATA2MSB);
Write8(ELF::EV_CURRENT); // e_ident[EI_VERSION]
write8(ELF::EV_CURRENT); // e_ident[EI_VERSION]
// e_ident[EI_OSABI]
Write8(TargetObjectWriter->getOSABI());
Write8(0); // e_ident[EI_ABIVERSION]
write8(TargetObjectWriter->getOSABI());
write8(0); // e_ident[EI_ABIVERSION]
WriteZeros(ELF::EI_NIDENT - ELF::EI_PAD);
Write16(ELF::ET_REL); // e_type
write16(ELF::ET_REL); // e_type
Write16(TargetObjectWriter->getEMachine()); // e_machine = target
write16(TargetObjectWriter->getEMachine()); // e_machine = target
Write32(ELF::EV_CURRENT); // e_version
write32(ELF::EV_CURRENT); // e_version
WriteWord(0); // e_entry, no entry point in .o file
WriteWord(0); // e_phoff, no program header for .o
WriteWord(0); // e_shoff = sec hdr table off in bytes
// e_flags = whatever the target wants
Write32(Asm.getELFHeaderEFlags());
write32(Asm.getELFHeaderEFlags());
// e_ehsize = ELF header size
Write16(is64Bit() ? sizeof(ELF::Elf64_Ehdr) : sizeof(ELF::Elf32_Ehdr));
write16(is64Bit() ? sizeof(ELF::Elf64_Ehdr) : sizeof(ELF::Elf32_Ehdr));
Write16(0); // e_phentsize = prog header entry size
Write16(0); // e_phnum = # prog header entries = 0
write16(0); // e_phentsize = prog header entry size
write16(0); // e_phnum = # prog header entries = 0
// e_shentsize = Section header entry size
Write16(is64Bit() ? sizeof(ELF::Elf64_Shdr) : sizeof(ELF::Elf32_Shdr));
write16(is64Bit() ? sizeof(ELF::Elf64_Shdr) : sizeof(ELF::Elf32_Shdr));
// e_shnum = # of section header ents
Write16(0);
write16(0);
// e_shstrndx = Section # of '.shstrtab'
assert(StringTableIndex < ELF::SHN_LORESERVE);
Write16(StringTableIndex);
write16(StringTableIndex);
}
uint64_t ELFObjectWriter::SymbolValue(const MCSymbol &Sym,
@ -605,7 +605,7 @@ static bool isWeak(const MCSymbolELF &Sym) {
}
}
void ELFObjectWriter::RecordRelocation(MCAssembler &Asm,
void ELFObjectWriter::recordRelocation(MCAssembler &Asm,
const MCAsmLayout &Layout,
const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
@ -1035,14 +1035,14 @@ void ELFObjectWriter::WriteSecHdrEntry(uint32_t Name, uint32_t Type,
uint32_t Link, uint32_t Info,
uint64_t Alignment,
uint64_t EntrySize) {
Write32(Name); // sh_name: index into string table
Write32(Type); // sh_type
write32(Name); // sh_name: index into string table
write32(Type); // sh_type
WriteWord(Flags); // sh_flags
WriteWord(Address); // sh_addr
WriteWord(Offset); // sh_offset
WriteWord(Size); // sh_size
Write32(Link); // sh_link
Write32(Info); // sh_info
write32(Link); // sh_link
write32(Info); // sh_info
WriteWord(Alignment); // sh_addralign
WriteWord(EntrySize); // sh_entsize
}
@ -1174,7 +1174,7 @@ void ELFObjectWriter::writeSectionHeader(
}
}
void ELFObjectWriter::WriteObject(MCAssembler &Asm,
void ELFObjectWriter::writeObject(MCAssembler &Asm,
const MCAsmLayout &Layout) {
MCContext &Ctx = Asm.getContext();
MCSectionELF *StrtabSection =
@ -1308,7 +1308,7 @@ void ELFObjectWriter::WriteObject(MCAssembler &Asm,
NumSectionsOffset);
}
bool ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
bool ELFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm, const MCSymbol &SA, const MCFragment &FB,
bool InSet, bool IsPCRel) const {
const auto &SymA = cast<MCSymbolELF>(SA);
@ -1317,7 +1317,7 @@ bool ELFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
if (::isWeak(SymA))
return false;
}
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
return MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
InSet, IsPCRel);
}

View File

@ -394,7 +394,7 @@ bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
MCValue &Target, uint64_t &Value) const {
++stats::evaluateFixup;
// FIXME: This code has some duplication with RecordRelocation. We should
// FIXME: This code has some duplication with recordRelocation. We should
// probably merge the two into a single callback that tries to evaluate a
// fixup and records a relocation if one is needed.
const MCExpr *Expr = Fixup.getValue();
@ -416,7 +416,7 @@ bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
if (A->getKind() != MCSymbolRefExpr::VK_None || SA.isUndefined()) {
IsResolved = false;
} else {
IsResolved = getWriter().IsSymbolRefDifferenceFullyResolvedImpl(
IsResolved = getWriter().isSymbolRefDifferenceFullyResolvedImpl(
*this, SA, *DF, false, true);
}
}
@ -576,7 +576,7 @@ void MCAsmLayout::layoutFragment(MCFragment *F) {
/// a MCEncodedFragment.
static void writeFragmentContents(const MCFragment &F, MCObjectWriter *OW) {
const MCEncodedFragment &EF = cast<MCEncodedFragment>(F);
OW->WriteBytes(EF.getContents());
OW->writeBytes(EF.getContents());
}
void MCAssembler::registerSymbol(const MCSymbol &Symbol, bool *Created) {
@ -670,10 +670,10 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout,
for (uint64_t i = 0; i != Count; ++i) {
switch (AF.getValueSize()) {
default: llvm_unreachable("Invalid size!");
case 1: OW->Write8 (uint8_t (AF.getValue())); break;
case 2: OW->Write16(uint16_t(AF.getValue())); break;
case 4: OW->Write32(uint32_t(AF.getValue())); break;
case 8: OW->Write64(uint64_t(AF.getValue())); break;
case 1: OW->write8 (uint8_t (AF.getValue())); break;
case 2: OW->write16(uint16_t(AF.getValue())); break;
case 4: OW->write32(uint32_t(AF.getValue())); break;
case 8: OW->write64(uint64_t(AF.getValue())); break;
}
}
break;
@ -703,10 +703,10 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout,
for (uint64_t i = 0, e = FF.getSize() / FF.getValueSize(); i != e; ++i) {
switch (FF.getValueSize()) {
default: llvm_unreachable("Invalid size!");
case 1: OW->Write8 (uint8_t (FF.getValue())); break;
case 2: OW->Write16(uint16_t(FF.getValue())); break;
case 4: OW->Write32(uint32_t(FF.getValue())); break;
case 8: OW->Write64(uint64_t(FF.getValue())); break;
case 1: OW->write8 (uint8_t (FF.getValue())); break;
case 2: OW->write16(uint16_t(FF.getValue())); break;
case 4: OW->write32(uint32_t(FF.getValue())); break;
case 8: OW->write64(uint64_t(FF.getValue())); break;
}
}
break;
@ -714,13 +714,13 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout,
case MCFragment::FT_LEB: {
const MCLEBFragment &LF = cast<MCLEBFragment>(F);
OW->WriteBytes(LF.getContents());
OW->writeBytes(LF.getContents());
break;
}
case MCFragment::FT_SafeSEH: {
const MCSafeSEHFragment &SF = cast<MCSafeSEHFragment>(F);
OW->Write32(SF.getSymbol()->getIndex());
OW->write32(SF.getSymbol()->getIndex());
break;
}
@ -729,19 +729,19 @@ static void writeFragment(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCOrgFragment &OF = cast<MCOrgFragment>(F);
for (uint64_t i = 0, e = FragmentSize; i != e; ++i)
OW->Write8(uint8_t(OF.getValue()));
OW->write8(uint8_t(OF.getValue()));
break;
}
case MCFragment::FT_Dwarf: {
const MCDwarfLineAddrFragment &OF = cast<MCDwarfLineAddrFragment>(F);
OW->WriteBytes(OF.getContents());
OW->writeBytes(OF.getContents());
break;
}
case MCFragment::FT_DwarfFrame: {
const MCDwarfCallFrameFragment &CF = cast<MCDwarfCallFrameFragment>(F);
OW->WriteBytes(CF.getContents());
OW->writeBytes(CF.getContents());
break;
}
}
@ -819,7 +819,7 @@ std::pair<uint64_t, bool> MCAssembler::handleFixup(const MCAsmLayout &Layout,
// The fixup was unresolved, we need a relocation. Inform the object
// writer of the relocation, and give it an opportunity to adjust the
// fixup value if need be.
getWriter().RecordRelocation(*this, Layout, &F, Fixup, Target, IsPCRel,
getWriter().recordRelocation(*this, Layout, &F, Fixup, Target, IsPCRel,
FixedValue);
}
return std::make_pair(FixedValue, IsPCRel);
@ -897,7 +897,7 @@ void MCAssembler::Finish() {
}
// Write the object file.
getWriter().WriteObject(*this, Layout);
getWriter().writeObject(*this, Layout);
stats::ObjectBytes += OS.tell() - StartOffset;
}

View File

@ -468,7 +468,7 @@ static void AttemptToFoldSymbolOffsetDifference(
if (SA.isUndefined() || SB.isUndefined())
return;
if (!Asm->getWriter().IsSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
if (!Asm->getWriter().isSymbolRefDifferenceFullyResolved(*Asm, A, B, InSet))
return;
if (SA.getFragment() == SB.getFragment()) {

View File

@ -17,7 +17,7 @@ using namespace llvm;
MCObjectWriter::~MCObjectWriter() {
}
bool MCObjectWriter::IsSymbolRefDifferenceFullyResolved(
bool MCObjectWriter::isSymbolRefDifferenceFullyResolved(
const MCAssembler &Asm, const MCSymbolRefExpr *A, const MCSymbolRefExpr *B,
bool InSet) const {
// Modified symbol references cannot be resolved.
@ -33,11 +33,11 @@ bool MCObjectWriter::IsSymbolRefDifferenceFullyResolved(
if (!SA.getFragment() || !SB.getFragment())
return false;
return IsSymbolRefDifferenceFullyResolvedImpl(Asm, SA, *SB.getFragment(),
return isSymbolRefDifferenceFullyResolvedImpl(Asm, SA, *SB.getFragment(),
InSet, false);
}
bool MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
bool MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB,
bool InSet, bool IsPCRel) const {
const MCSection &SecA = SymA.getSection();

View File

@ -132,17 +132,17 @@ void MachObjectWriter::WriteHeader(unsigned NumLoadCommands,
uint64_t Start = OS.tell();
(void) Start;
Write32(is64Bit() ? MachO::MH_MAGIC_64 : MachO::MH_MAGIC);
write32(is64Bit() ? MachO::MH_MAGIC_64 : MachO::MH_MAGIC);
Write32(TargetObjectWriter->getCPUType());
Write32(TargetObjectWriter->getCPUSubtype());
write32(TargetObjectWriter->getCPUType());
write32(TargetObjectWriter->getCPUSubtype());
Write32(MachO::MH_OBJECT);
Write32(NumLoadCommands);
Write32(LoadCommandsSize);
Write32(Flags);
write32(MachO::MH_OBJECT);
write32(NumLoadCommands);
write32(LoadCommandsSize);
write32(Flags);
if (is64Bit())
Write32(0); // reserved
write32(0); // reserved
assert(OS.tell() - Start ==
(is64Bit()?sizeof(MachO::mach_header_64): sizeof(MachO::mach_header)));
@ -165,29 +165,29 @@ void MachObjectWriter::WriteSegmentLoadCommand(unsigned NumSections,
unsigned SegmentLoadCommandSize =
is64Bit() ? sizeof(MachO::segment_command_64):
sizeof(MachO::segment_command);
Write32(is64Bit() ? MachO::LC_SEGMENT_64 : MachO::LC_SEGMENT);
Write32(SegmentLoadCommandSize +
write32(is64Bit() ? MachO::LC_SEGMENT_64 : MachO::LC_SEGMENT);
write32(SegmentLoadCommandSize +
NumSections * (is64Bit() ? sizeof(MachO::section_64) :
sizeof(MachO::section)));
WriteBytes("", 16);
writeBytes("", 16);
if (is64Bit()) {
Write64(0); // vmaddr
Write64(VMSize); // vmsize
Write64(SectionDataStartOffset); // file offset
Write64(SectionDataSize); // file size
write64(0); // vmaddr
write64(VMSize); // vmsize
write64(SectionDataStartOffset); // file offset
write64(SectionDataSize); // file size
} else {
Write32(0); // vmaddr
Write32(VMSize); // vmsize
Write32(SectionDataStartOffset); // file offset
Write32(SectionDataSize); // file size
write32(0); // vmaddr
write32(VMSize); // vmsize
write32(SectionDataStartOffset); // file offset
write32(SectionDataSize); // file size
}
// maxprot
Write32(MachO::VM_PROT_READ | MachO::VM_PROT_WRITE | MachO::VM_PROT_EXECUTE);
write32(MachO::VM_PROT_READ | MachO::VM_PROT_WRITE | MachO::VM_PROT_EXECUTE);
// initprot
Write32(MachO::VM_PROT_READ | MachO::VM_PROT_WRITE | MachO::VM_PROT_EXECUTE);
Write32(NumSections);
Write32(0); // flags
write32(MachO::VM_PROT_READ | MachO::VM_PROT_WRITE | MachO::VM_PROT_EXECUTE);
write32(NumSections);
write32(0); // flags
assert(OS.tell() - Start == SegmentLoadCommandSize);
}
@ -212,30 +212,30 @@ void MachObjectWriter::WriteSection(const MCAssembler &Asm,
uint64_t Start = OS.tell();
(void) Start;
WriteBytes(Section.getSectionName(), 16);
WriteBytes(Section.getSegmentName(), 16);
writeBytes(Section.getSectionName(), 16);
writeBytes(Section.getSegmentName(), 16);
if (is64Bit()) {
Write64(getSectionAddress(&Sec)); // address
Write64(SectionSize); // size
write64(getSectionAddress(&Sec)); // address
write64(SectionSize); // size
} else {
Write32(getSectionAddress(&Sec)); // address
Write32(SectionSize); // size
write32(getSectionAddress(&Sec)); // address
write32(SectionSize); // size
}
Write32(FileOffset);
write32(FileOffset);
unsigned Flags = Section.getTypeAndAttributes();
if (Section.hasInstructions())
Flags |= MachO::S_ATTR_SOME_INSTRUCTIONS;
assert(isPowerOf2_32(Section.getAlignment()) && "Invalid alignment!");
Write32(Log2_32(Section.getAlignment()));
Write32(NumRelocations ? RelocationsStart : 0);
Write32(NumRelocations);
Write32(Flags);
Write32(IndirectSymBase.lookup(&Sec)); // reserved1
Write32(Section.getStubSize()); // reserved2
write32(Log2_32(Section.getAlignment()));
write32(NumRelocations ? RelocationsStart : 0);
write32(NumRelocations);
write32(Flags);
write32(IndirectSymBase.lookup(&Sec)); // reserved1
write32(Section.getStubSize()); // reserved2
if (is64Bit())
Write32(0); // reserved3
write32(0); // reserved3
assert(OS.tell() - Start == (is64Bit() ? sizeof(MachO::section_64) :
sizeof(MachO::section)));
@ -250,12 +250,12 @@ void MachObjectWriter::WriteSymtabLoadCommand(uint32_t SymbolOffset,
uint64_t Start = OS.tell();
(void) Start;
Write32(MachO::LC_SYMTAB);
Write32(sizeof(MachO::symtab_command));
Write32(SymbolOffset);
Write32(NumSymbols);
Write32(StringTableOffset);
Write32(StringTableSize);
write32(MachO::LC_SYMTAB);
write32(sizeof(MachO::symtab_command));
write32(SymbolOffset);
write32(NumSymbols);
write32(StringTableOffset);
write32(StringTableSize);
assert(OS.tell() - Start == sizeof(MachO::symtab_command));
}
@ -273,26 +273,26 @@ void MachObjectWriter::WriteDysymtabLoadCommand(uint32_t FirstLocalSymbol,
uint64_t Start = OS.tell();
(void) Start;
Write32(MachO::LC_DYSYMTAB);
Write32(sizeof(MachO::dysymtab_command));
Write32(FirstLocalSymbol);
Write32(NumLocalSymbols);
Write32(FirstExternalSymbol);
Write32(NumExternalSymbols);
Write32(FirstUndefinedSymbol);
Write32(NumUndefinedSymbols);
Write32(0); // tocoff
Write32(0); // ntoc
Write32(0); // modtaboff
Write32(0); // nmodtab
Write32(0); // extrefsymoff
Write32(0); // nextrefsyms
Write32(IndirectSymbolOffset);
Write32(NumIndirectSymbols);
Write32(0); // extreloff
Write32(0); // nextrel
Write32(0); // locreloff
Write32(0); // nlocrel
write32(MachO::LC_DYSYMTAB);
write32(sizeof(MachO::dysymtab_command));
write32(FirstLocalSymbol);
write32(NumLocalSymbols);
write32(FirstExternalSymbol);
write32(NumExternalSymbols);
write32(FirstUndefinedSymbol);
write32(NumUndefinedSymbols);
write32(0); // tocoff
write32(0); // ntoc
write32(0); // modtaboff
write32(0); // nmodtab
write32(0); // extrefsymoff
write32(0); // nextrefsyms
write32(IndirectSymbolOffset);
write32(NumIndirectSymbols);
write32(0); // extreloff
write32(0); // nextrel
write32(0); // locreloff
write32(0); // nlocrel
assert(OS.tell() - Start == sizeof(MachO::dysymtab_command));
}
@ -390,17 +390,17 @@ void MachObjectWriter::WriteNlist(MachSymbolData &MSD,
// struct nlist (12 bytes)
Write32(MSD.StringIndex);
Write8(Type);
Write8(SectionIndex);
write32(MSD.StringIndex);
write8(Type);
write8(SectionIndex);
// The Mach-O streamer uses the lowest 16-bits of the flags for the 'desc'
// value.
Write16(Flags);
write16(Flags);
if (is64Bit())
Write64(Address);
write64(Address);
else
Write32(Address);
write32(Address);
}
void MachObjectWriter::WriteLinkeditLoadCommand(uint32_t Type,
@ -409,10 +409,10 @@ void MachObjectWriter::WriteLinkeditLoadCommand(uint32_t Type,
uint64_t Start = OS.tell();
(void) Start;
Write32(Type);
Write32(sizeof(MachO::linkedit_data_command));
Write32(DataOffset);
Write32(DataSize);
write32(Type);
write32(sizeof(MachO::linkedit_data_command));
write32(DataOffset);
write32(DataSize);
assert(OS.tell() - Start == sizeof(MachO::linkedit_data_command));
}
@ -433,28 +433,28 @@ void MachObjectWriter::WriteLinkerOptionsLoadCommand(
uint64_t Start = OS.tell();
(void) Start;
Write32(MachO::LC_LINKER_OPTION);
Write32(Size);
Write32(Options.size());
write32(MachO::LC_LINKER_OPTION);
write32(Size);
write32(Options.size());
uint64_t BytesWritten = sizeof(MachO::linker_option_command);
for (const std::string &Option : Options) {
// Write each string, including the null byte.
WriteBytes(Option.c_str(), Option.size() + 1);
writeBytes(Option.c_str(), Option.size() + 1);
BytesWritten += Option.size() + 1;
}
// Pad to a multiple of the pointer size.
WriteBytes("", OffsetToAlignment(BytesWritten, is64Bit() ? 8 : 4));
writeBytes("", OffsetToAlignment(BytesWritten, is64Bit() ? 8 : 4));
assert(OS.tell() - Start == Size);
}
void MachObjectWriter::RecordRelocation(MCAssembler &Asm,
void MachObjectWriter::recordRelocation(MCAssembler &Asm,
const MCAsmLayout &Layout,
const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
bool &IsPCRel, uint64_t &FixedValue) {
TargetObjectWriter->RecordRelocation(this, Asm, Layout, Fragment, Fixup,
TargetObjectWriter->recordRelocation(this, Asm, Layout, Fragment, Fixup,
Target, FixedValue);
}
@ -644,7 +644,7 @@ void MachObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
BindIndirectSymbols(Asm);
}
bool MachObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
bool MachObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB,
bool InSet, bool IsPCRel) const {
if (InSet)
@ -711,7 +711,7 @@ bool MachObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
return false;
}
void MachObjectWriter::WriteObject(MCAssembler &Asm,
void MachObjectWriter::writeObject(MCAssembler &Asm,
const MCAsmLayout &Layout) {
// Compute symbol table information and bind symbol indices.
ComputeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData,
@ -815,11 +815,11 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
assert(VersionInfo.Major < 65536 && "unencodable major target version");
uint32_t EncodedVersion = VersionInfo.Update | (VersionInfo.Minor << 8) |
(VersionInfo.Major << 16);
Write32(VersionInfo.Kind == MCVM_OSXVersionMin ? MachO::LC_VERSION_MIN_MACOSX :
write32(VersionInfo.Kind == MCVM_OSXVersionMin ? MachO::LC_VERSION_MIN_MACOSX :
MachO::LC_VERSION_MIN_IPHONEOS);
Write32(sizeof(MachO::version_min_command));
Write32(EncodedVersion);
Write32(0); // reserved.
write32(sizeof(MachO::version_min_command));
write32(EncodedVersion);
write32(0); // reserved.
}
// Write the data-in-code load command, if used.
@ -893,8 +893,8 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
// (approximately, the exact algorithm is more complicated than this).
std::vector<RelAndSymbol> &Relocs = Relocations[&Sec];
for (const RelAndSymbol &Rel : make_range(Relocs.rbegin(), Relocs.rend())) {
Write32(Rel.MRE.r_word0);
Write32(Rel.MRE.r_word1);
write32(Rel.MRE.r_word0);
write32(Rel.MRE.r_word1);
}
}
@ -910,9 +910,9 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
<< " end: " << End << "(" << Data->End->getName() << ")"
<< " size: " << End - Start
<< "\n");
Write32(Start);
Write16(End - Start);
Write16(Data->Kind);
write32(Start);
write16(End - Start);
write16(Data->Kind);
}
// Write out the loh commands, if there is one.
@ -922,7 +922,7 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
#endif
Asm.getLOHContainer().emit(*this, Layout);
// Pad to a multiple of the pointer size.
WriteBytes("", OffsetToAlignment(LOHRawSize, is64Bit() ? 8 : 4));
writeBytes("", OffsetToAlignment(LOHRawSize, is64Bit() ? 8 : 4));
assert(OS.tell() - Start == LOHSize);
}
@ -942,12 +942,12 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
uint32_t Flags = MachO::INDIRECT_SYMBOL_LOCAL;
if (it->Symbol->isAbsolute())
Flags |= MachO::INDIRECT_SYMBOL_ABS;
Write32(Flags);
write32(Flags);
continue;
}
}
Write32(it->Symbol->getIndex());
write32(it->Symbol->getIndex());
}
// FIXME: Check that offsets match computed ones.

View File

@ -177,19 +177,19 @@ public:
void ExecutePostLayoutBinding(MCAssembler &Asm,
const MCAsmLayout &Layout) override;
bool IsSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm,
const MCSymbol &SymA,
const MCFragment &FB, bool InSet,
bool IsPCRel) const override;
bool isWeak(const MCSymbol &Sym) const override;
void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup,
MCValue Target, bool &IsPCRel,
uint64_t &FixedValue) override;
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
};
}
@ -546,40 +546,40 @@ bool WinCOFFObjectWriter::IsPhysicalSection(COFFSection *S) {
void WinCOFFObjectWriter::WriteFileHeader(const COFF::header &Header) {
if (UseBigObj) {
WriteLE16(COFF::IMAGE_FILE_MACHINE_UNKNOWN);
WriteLE16(0xFFFF);
WriteLE16(COFF::BigObjHeader::MinBigObjectVersion);
WriteLE16(Header.Machine);
WriteLE32(Header.TimeDateStamp);
WriteBytes(StringRef(COFF::BigObjMagic, sizeof(COFF::BigObjMagic)));
WriteLE32(0);
WriteLE32(0);
WriteLE32(0);
WriteLE32(0);
WriteLE32(Header.NumberOfSections);
WriteLE32(Header.PointerToSymbolTable);
WriteLE32(Header.NumberOfSymbols);
writeLE16(COFF::IMAGE_FILE_MACHINE_UNKNOWN);
writeLE16(0xFFFF);
writeLE16(COFF::BigObjHeader::MinBigObjectVersion);
writeLE16(Header.Machine);
writeLE32(Header.TimeDateStamp);
writeBytes(StringRef(COFF::BigObjMagic, sizeof(COFF::BigObjMagic)));
writeLE32(0);
writeLE32(0);
writeLE32(0);
writeLE32(0);
writeLE32(Header.NumberOfSections);
writeLE32(Header.PointerToSymbolTable);
writeLE32(Header.NumberOfSymbols);
} else {
WriteLE16(Header.Machine);
WriteLE16(static_cast<int16_t>(Header.NumberOfSections));
WriteLE32(Header.TimeDateStamp);
WriteLE32(Header.PointerToSymbolTable);
WriteLE32(Header.NumberOfSymbols);
WriteLE16(Header.SizeOfOptionalHeader);
WriteLE16(Header.Characteristics);
writeLE16(Header.Machine);
writeLE16(static_cast<int16_t>(Header.NumberOfSections));
writeLE32(Header.TimeDateStamp);
writeLE32(Header.PointerToSymbolTable);
writeLE32(Header.NumberOfSymbols);
writeLE16(Header.SizeOfOptionalHeader);
writeLE16(Header.Characteristics);
}
}
void WinCOFFObjectWriter::WriteSymbol(const COFFSymbol &S) {
WriteBytes(StringRef(S.Data.Name, COFF::NameSize));
WriteLE32(S.Data.Value);
writeBytes(StringRef(S.Data.Name, COFF::NameSize));
writeLE32(S.Data.Value);
if (UseBigObj)
WriteLE32(S.Data.SectionNumber);
writeLE32(S.Data.SectionNumber);
else
WriteLE16(static_cast<int16_t>(S.Data.SectionNumber));
WriteLE16(S.Data.Type);
Write8(S.Data.StorageClass);
Write8(S.Data.NumberOfAuxSymbols);
writeLE16(static_cast<int16_t>(S.Data.SectionNumber));
writeLE16(S.Data.Type);
write8(S.Data.StorageClass);
write8(S.Data.NumberOfAuxSymbols);
WriteAuxiliarySymbols(S.Aux);
}
@ -589,44 +589,44 @@ void WinCOFFObjectWriter::WriteAuxiliarySymbols(
i != e; ++i) {
switch (i->AuxType) {
case ATFunctionDefinition:
WriteLE32(i->Aux.FunctionDefinition.TagIndex);
WriteLE32(i->Aux.FunctionDefinition.TotalSize);
WriteLE32(i->Aux.FunctionDefinition.PointerToLinenumber);
WriteLE32(i->Aux.FunctionDefinition.PointerToNextFunction);
writeLE32(i->Aux.FunctionDefinition.TagIndex);
writeLE32(i->Aux.FunctionDefinition.TotalSize);
writeLE32(i->Aux.FunctionDefinition.PointerToLinenumber);
writeLE32(i->Aux.FunctionDefinition.PointerToNextFunction);
WriteZeros(sizeof(i->Aux.FunctionDefinition.unused));
if (UseBigObj)
WriteZeros(COFF::Symbol32Size - COFF::Symbol16Size);
break;
case ATbfAndefSymbol:
WriteZeros(sizeof(i->Aux.bfAndefSymbol.unused1));
WriteLE16(i->Aux.bfAndefSymbol.Linenumber);
writeLE16(i->Aux.bfAndefSymbol.Linenumber);
WriteZeros(sizeof(i->Aux.bfAndefSymbol.unused2));
WriteLE32(i->Aux.bfAndefSymbol.PointerToNextFunction);
writeLE32(i->Aux.bfAndefSymbol.PointerToNextFunction);
WriteZeros(sizeof(i->Aux.bfAndefSymbol.unused3));
if (UseBigObj)
WriteZeros(COFF::Symbol32Size - COFF::Symbol16Size);
break;
case ATWeakExternal:
WriteLE32(i->Aux.WeakExternal.TagIndex);
WriteLE32(i->Aux.WeakExternal.Characteristics);
writeLE32(i->Aux.WeakExternal.TagIndex);
writeLE32(i->Aux.WeakExternal.Characteristics);
WriteZeros(sizeof(i->Aux.WeakExternal.unused));
if (UseBigObj)
WriteZeros(COFF::Symbol32Size - COFF::Symbol16Size);
break;
case ATFile:
WriteBytes(
writeBytes(
StringRef(reinterpret_cast<const char *>(&i->Aux),
UseBigObj ? COFF::Symbol32Size : COFF::Symbol16Size));
break;
case ATSectionDefinition:
WriteLE32(i->Aux.SectionDefinition.Length);
WriteLE16(i->Aux.SectionDefinition.NumberOfRelocations);
WriteLE16(i->Aux.SectionDefinition.NumberOfLinenumbers);
WriteLE32(i->Aux.SectionDefinition.CheckSum);
WriteLE16(static_cast<int16_t>(i->Aux.SectionDefinition.Number));
Write8(i->Aux.SectionDefinition.Selection);
writeLE32(i->Aux.SectionDefinition.Length);
writeLE16(i->Aux.SectionDefinition.NumberOfRelocations);
writeLE16(i->Aux.SectionDefinition.NumberOfLinenumbers);
writeLE32(i->Aux.SectionDefinition.CheckSum);
writeLE16(static_cast<int16_t>(i->Aux.SectionDefinition.Number));
write8(i->Aux.SectionDefinition.Selection);
WriteZeros(sizeof(i->Aux.SectionDefinition.unused));
WriteLE16(static_cast<int16_t>(i->Aux.SectionDefinition.Number >> 16));
writeLE16(static_cast<int16_t>(i->Aux.SectionDefinition.Number >> 16));
if (UseBigObj)
WriteZeros(COFF::Symbol32Size - COFF::Symbol16Size);
break;
@ -635,23 +635,23 @@ void WinCOFFObjectWriter::WriteAuxiliarySymbols(
}
void WinCOFFObjectWriter::WriteSectionHeader(const COFF::section &S) {
WriteBytes(StringRef(S.Name, COFF::NameSize));
writeBytes(StringRef(S.Name, COFF::NameSize));
WriteLE32(S.VirtualSize);
WriteLE32(S.VirtualAddress);
WriteLE32(S.SizeOfRawData);
WriteLE32(S.PointerToRawData);
WriteLE32(S.PointerToRelocations);
WriteLE32(S.PointerToLineNumbers);
WriteLE16(S.NumberOfRelocations);
WriteLE16(S.NumberOfLineNumbers);
WriteLE32(S.Characteristics);
writeLE32(S.VirtualSize);
writeLE32(S.VirtualAddress);
writeLE32(S.SizeOfRawData);
writeLE32(S.PointerToRawData);
writeLE32(S.PointerToRelocations);
writeLE32(S.PointerToLineNumbers);
writeLE16(S.NumberOfRelocations);
writeLE16(S.NumberOfLineNumbers);
writeLE32(S.Characteristics);
}
void WinCOFFObjectWriter::WriteRelocation(const COFF::relocation &R) {
WriteLE32(R.VirtualAddress);
WriteLE32(R.SymbolTableIndex);
WriteLE16(R.Type);
writeLE32(R.VirtualAddress);
writeLE32(R.SymbolTableIndex);
writeLE16(R.Type);
}
////////////////////////////////////////////////////////////////////////////////
@ -669,7 +669,7 @@ void WinCOFFObjectWriter::ExecutePostLayoutBinding(MCAssembler &Asm,
DefineSymbol(Symbol, Asm, Layout);
}
bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
bool WinCOFFObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
const MCAssembler &Asm, const MCSymbol &SymA, const MCFragment &FB,
bool InSet, bool IsPCRel) const {
// MS LINK expects to be able to replace all references to a function with a
@ -678,7 +678,7 @@ bool WinCOFFObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(
if ((((SymA.getFlags() & COFF::SF_TypeMask) >> COFF::SF_TypeShift) >>
COFF::SCT_COMPLEX_TYPE_SHIFT) == COFF::IMAGE_SYM_DTYPE_FUNCTION)
return false;
return MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
return MCObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(Asm, SymA, FB,
InSet, IsPCRel);
}
@ -699,7 +699,7 @@ bool WinCOFFObjectWriter::isWeak(const MCSymbol &Sym) const {
return true;
}
void WinCOFFObjectWriter::RecordRelocation(
void WinCOFFObjectWriter::recordRelocation(
MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue) {
assert(Target.getSymA() && "Relocation must reference a symbol!");
@ -830,7 +830,7 @@ void WinCOFFObjectWriter::RecordRelocation(
coff_section->Relocations.push_back(Reloc);
}
void WinCOFFObjectWriter::WriteObject(MCAssembler &Asm,
void WinCOFFObjectWriter::writeObject(MCAssembler &Asm,
const MCAsmLayout &Layout) {
size_t SectionsSize = Sections.size();
if (SectionsSize > static_cast<size_t>(INT32_MAX))

View File

@ -252,7 +252,7 @@ bool AArch64AsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
// We are properly aligned, so write NOPs as requested.
Count /= 4;
for (uint64_t i = 0; i != Count; ++i)
OW->Write32(0xd503201f);
OW->write32(0xd503201f);
return true;
}

View File

@ -33,7 +33,7 @@ public:
AArch64MachObjectWriter(uint32_t CPUType, uint32_t CPUSubtype)
: MCMachObjectTargetWriter(true /* is64Bit */, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue) override;
@ -139,7 +139,7 @@ static bool canUseLocalRelocation(const MCSectionMachO &Section,
return false;
}
void AArch64MachObjectWriter::RecordRelocation(
void AArch64MachObjectWriter::recordRelocation(
MachObjectWriter *Writer, MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue) {
@ -313,7 +313,7 @@ void AArch64MachObjectWriter::RecordRelocation(
Asm.getContext().reportFatalError(Fixup.getLoc(),
"unable to resolve variable '" +
Symbol->getName() + "'");
return RecordRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
return recordRelocation(Writer, Asm, Layout, Fragment, Fixup, Target,
FixedValue);
}

View File

@ -260,9 +260,9 @@ bool ARMAsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
hasNOP() ? Thumb2_16bitNopEncoding : Thumb1_16bitNopEncoding;
uint64_t NumNops = Count / 2;
for (uint64_t i = 0; i != NumNops; ++i)
OW->Write16(nopEncoding);
OW->write16(nopEncoding);
if (Count & 1)
OW->Write8(0);
OW->write8(0);
return true;
}
// ARM mode
@ -270,21 +270,21 @@ bool ARMAsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
hasNOP() ? ARMv6T2_NopEncoding : ARMv4_NopEncoding;
uint64_t NumNops = Count / 4;
for (uint64_t i = 0; i != NumNops; ++i)
OW->Write32(nopEncoding);
OW->write32(nopEncoding);
// FIXME: should this function return false when unable to write exactly
// 'Count' bytes with NOP encodings?
switch (Count % 4) {
default:
break; // No leftover bytes to write
case 1:
OW->Write8(0);
OW->write8(0);
break;
case 2:
OW->Write16(0);
OW->write16(0);
break;
case 3:
OW->Write16(0);
OW->Write8(0xa0);
OW->write16(0);
OW->write8(0xa0);
break;
}

View File

@ -52,7 +52,7 @@ public:
ARMMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue) override;
@ -338,7 +338,7 @@ bool ARMMachObjectWriter::requiresExternRelocation(MachObjectWriter *Writer,
return false;
}
void ARMMachObjectWriter::RecordRelocation(MachObjectWriter *Writer,
void ARMMachObjectWriter::recordRelocation(MachObjectWriter *Writer,
MCAssembler &Asm,
const MCAsmLayout &Layout,
const MCFragment *Fragment,

View File

@ -57,7 +57,7 @@ bool BPFAsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
return false;
for (uint64_t i = 0; i < Count; i += 8)
OW->Write64(0x15000000);
OW->write64(0x15000000);
return true;
}

View File

@ -177,7 +177,7 @@ public:
bool writeNopData(uint64_t Count, MCObjectWriter *OW) const override {
uint64_t NumNops = Count / 4;
for (uint64_t i = 0; i != NumNops; ++i)
OW->Write32(0x60000000);
OW->write32(0x60000000);
OW->WriteZeros(Count % 4);

View File

@ -40,7 +40,7 @@ public:
PPCMachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue) override {

View File

@ -29,14 +29,14 @@ public:
const MCAsmLayout &Layout) override {
//XXX: Implement if necessary.
}
void RecordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFragment *Fragment, const MCFixup &Fixup,
MCValue Target, bool &IsPCRel,
uint64_t &FixedValue) override {
assert(!"Not implemented");
}
void WriteObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
void writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override;
};
@ -64,7 +64,7 @@ public:
} //End anonymous namespace
void AMDGPUMCObjectWriter::WriteObject(MCAssembler &Asm,
void AMDGPUMCObjectWriter::writeObject(MCAssembler &Asm,
const MCAsmLayout &Layout) {
for (MCAssembler::iterator I = Asm.begin(), E = Asm.end(); I != E; ++I) {
Asm.writeSectionData(&*I, Layout);

View File

@ -260,7 +260,7 @@ namespace {
uint64_t NumNops = Count / 4;
for (uint64_t i = 0; i != NumNops; ++i)
OW->Write32(0x01000000);
OW->write32(0x01000000);
return true;
}

View File

@ -105,7 +105,7 @@ void SystemZMCAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
bool SystemZMCAsmBackend::writeNopData(uint64_t Count,
MCObjectWriter *OW) const {
for (uint64_t I = 0; I != Count; ++I)
OW->Write8(7);
OW->write8(7);
return true;
}

View File

@ -326,7 +326,7 @@ bool X86AsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
// FIXME: We could generated something better than plain 0x90.
if (!HasNopl) {
for (uint64_t i = 0; i < Count; ++i)
OW->Write8(0x90);
OW->write8(0x90);
return true;
}
@ -336,10 +336,10 @@ bool X86AsmBackend::writeNopData(uint64_t Count, MCObjectWriter *OW) const {
const uint8_t ThisNopLength = (uint8_t) std::min(Count, MaxNopLength);
const uint8_t Prefixes = ThisNopLength <= 10 ? 0 : ThisNopLength - 10;
for (uint8_t i = 0; i < Prefixes; i++)
OW->Write8(0x66);
OW->write8(0x66);
const uint8_t Rest = ThisNopLength - Prefixes;
for (uint8_t i = 0; i < Rest; i++)
OW->Write8(Nops[Rest - 1][i]);
OW->write8(Nops[Rest - 1][i]);
Count -= ThisNopLength;
} while (Count != 0);

View File

@ -57,7 +57,7 @@ public:
X86MachObjectWriter(bool Is64Bit, uint32_t CPUType, uint32_t CPUSubtype)
: MCMachObjectTargetWriter(Is64Bit, CPUType, CPUSubtype) {}
void RecordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm,
const MCAsmLayout &Layout, const MCFragment *Fragment,
const MCFixup &Fixup, MCValue Target,
uint64_t &FixedValue) override {