LLVM API Documentation
#include <MCObjectWriter.h>
Public Member Functions | |
virtual | ~MCObjectWriter () |
virtual void | reset () |
lifetime management | |
bool | isLittleEndian () const |
raw_ostream & | getStream () |
void | Write8 (uint8_t Value) |
void | WriteLE16 (uint16_t Value) |
void | WriteLE32 (uint32_t Value) |
void | WriteLE64 (uint64_t Value) |
void | WriteBE16 (uint16_t Value) |
void | WriteBE32 (uint32_t Value) |
void | WriteBE64 (uint64_t Value) |
void | Write16 (uint16_t Value) |
void | Write32 (uint32_t Value) |
void | Write64 (uint64_t Value) |
void | WriteZeros (unsigned N) |
void | WriteBytes (const SmallVectorImpl< char > &ByteVec, unsigned ZeroFillSize=0) |
void | WriteBytes (StringRef Str, unsigned ZeroFillSize=0) |
High-Level API | |
virtual void | ExecutePostLayoutBinding (MCAssembler &Asm, const MCAsmLayout &Layout)=0 |
Perform any late binding of symbols (for example, to assign symbol indices for use when generating relocations). | |
virtual void | RecordRelocation (const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, bool &IsPCRel, uint64_t &FixedValue)=0 |
Record a relocation entry. | |
bool | IsSymbolRefDifferenceFullyResolved (const MCAssembler &Asm, const MCSymbolRefExpr *A, const MCSymbolRefExpr *B, bool InSet) const |
Check whether the difference (A - B) between two symbol references is fully resolved. | |
virtual bool | IsSymbolRefDifferenceFullyResolvedImpl (const MCAssembler &Asm, const MCSymbolData &DataA, const MCFragment &FB, bool InSet, bool IsPCRel) const |
virtual void | WriteObject (MCAssembler &Asm, const MCAsmLayout &Layout)=0 |
Write the object file. | |
Protected Member Functions | |
MCObjectWriter (raw_ostream &_OS, bool _IsLittleEndian) | |
Protected Attributes | |
raw_ostream & | OS |
unsigned | IsLittleEndian: 1 |
MCObjectWriter - Defines the object file and target independent interfaces used by the assembler backend to write native file format object files.
The object writer contains a few callbacks used by the assembler to allow 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().
The object writer also contains a number of helper methods for writing binary data to the output stream.
Definition at line 39 of file MCObjectWriter.h.
llvm::MCObjectWriter::MCObjectWriter | ( | raw_ostream & | _OS, |
bool | _IsLittleEndian | ||
) | [inline, protected] |
Definition at line 49 of file MCObjectWriter.h.
MCObjectWriter::~MCObjectWriter | ( | ) | [virtual] |
Definition at line 17 of file MCObjectWriter.cpp.
virtual void llvm::MCObjectWriter::ExecutePostLayoutBinding | ( | MCAssembler & | Asm, |
const MCAsmLayout & | Layout | ||
) | [pure virtual] |
Perform any late binding of symbols (for example, to assign symbol indices for use when generating relocations).
This routine is called by the assembler after layout and relaxation is complete.
Implemented in llvm::MachObjectWriter.
Referenced by llvm::MCAssembler::Finish().
raw_ostream& llvm::MCObjectWriter::getStream | ( | ) | [inline] |
Definition at line 60 of file MCObjectWriter.h.
References OS.
Referenced by llvm::MCLOHDirective::Emit(), writeFragment(), and llvm::MCAssembler::writeSectionData().
bool llvm::MCObjectWriter::isLittleEndian | ( | ) | const [inline] |
Definition at line 58 of file MCObjectWriter.h.
References IsLittleEndian.
bool MCObjectWriter::IsSymbolRefDifferenceFullyResolved | ( | const MCAssembler & | Asm, |
const MCSymbolRefExpr * | A, | ||
const MCSymbolRefExpr * | B, | ||
bool | InSet | ||
) | const |
Check whether the difference (A - B) between two symbol references is fully resolved.
Clients are not required to answer precisely and may conservatively return false, even when a difference is fully resolved.
Definition at line 21 of file MCObjectWriter.cpp.
References llvm::MCSymbol::AliasedSymbol(), llvm::MCSymbolData::getFragment(), llvm::MCSymbolRefExpr::getKind(), llvm::MCSymbolRefExpr::getSymbol(), llvm::MCAssembler::getSymbolData(), IsSymbolRefDifferenceFullyResolvedImpl(), llvm::MCSymbol::isUndefined(), and llvm::MCSymbolRefExpr::VK_None.
bool MCObjectWriter::IsSymbolRefDifferenceFullyResolvedImpl | ( | const MCAssembler & | Asm, |
const MCSymbolData & | DataA, | ||
const MCFragment & | FB, | ||
bool | InSet, | ||
bool | IsPCRel | ||
) | const [virtual] |
Reimplemented in llvm::MachObjectWriter.
Definition at line 47 of file MCObjectWriter.cpp.
References llvm::MCSymbol::AliasedSymbol(), llvm::MCFragment::getParent(), llvm::MCSymbol::getSection(), llvm::MCSectionData::getSection(), and llvm::MCSymbolData::getSymbol().
Referenced by IsSymbolRefDifferenceFullyResolved().
virtual void llvm::MCObjectWriter::RecordRelocation | ( | const MCAssembler & | Asm, |
const MCAsmLayout & | Layout, | ||
const MCFragment * | Fragment, | ||
const MCFixup & | Fixup, | ||
MCValue | Target, | ||
bool & | IsPCRel, | ||
uint64_t & | FixedValue | ||
) | [pure virtual] |
Record a relocation entry.
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().
Implemented in llvm::MachObjectWriter.
virtual void llvm::MCObjectWriter::reset | ( | ) | [inline, virtual] |
lifetime management
Reimplemented in llvm::MachObjectWriter.
Definition at line 56 of file MCObjectWriter.h.
Referenced by llvm::MCAssembler::reset().
void llvm::MCObjectWriter::Write16 | ( | uint16_t | Value | ) | [inline] |
Definition at line 148 of file MCObjectWriter.h.
Referenced by writeFragment(), llvm::MachObjectWriter::WriteNlist(), and llvm::MachObjectWriter::WriteObject().
void llvm::MCObjectWriter::Write32 | ( | uint32_t | Value | ) | [inline] |
Definition at line 155 of file MCObjectWriter.h.
Referenced by llvm::MachObjectWriter::WriteDysymtabLoadCommand(), writeFragment(), llvm::MachObjectWriter::WriteHeader(), llvm::MachObjectWriter::WriteLinkeditLoadCommand(), llvm::MachObjectWriter::WriteLinkerOptionsLoadCommand(), llvm::MachObjectWriter::WriteNlist(), llvm::MipsAsmBackend::writeNopData(), llvm::MachObjectWriter::WriteObject(), llvm::MachObjectWriter::WriteSection(), llvm::MachObjectWriter::WriteSegmentLoadCommand(), and llvm::MachObjectWriter::WriteSymtabLoadCommand().
void llvm::MCObjectWriter::Write64 | ( | uint64_t | Value | ) | [inline] |
Definition at line 162 of file MCObjectWriter.h.
Referenced by writeFragment(), llvm::MachObjectWriter::WriteNlist(), llvm::MachObjectWriter::WriteSection(), and llvm::MachObjectWriter::WriteSegmentLoadCommand().
void llvm::MCObjectWriter::Write8 | ( | uint8_t | Value | ) | [inline] |
Definition at line 114 of file MCObjectWriter.h.
References OS.
Referenced by writeFragment(), llvm::MachObjectWriter::WriteNlist(), and llvm::MachObjectWriter::WriteObject().
void llvm::MCObjectWriter::WriteBE16 | ( | uint16_t | Value | ) | [inline] |
Definition at line 133 of file MCObjectWriter.h.
void llvm::MCObjectWriter::WriteBE32 | ( | uint32_t | Value | ) | [inline] |
Definition at line 138 of file MCObjectWriter.h.
void llvm::MCObjectWriter::WriteBE64 | ( | uint64_t | Value | ) | [inline] |
Definition at line 143 of file MCObjectWriter.h.
void llvm::MCObjectWriter::WriteBytes | ( | const SmallVectorImpl< char > & | ByteVec, |
unsigned | ZeroFillSize = 0 |
||
) | [inline] |
Definition at line 178 of file MCObjectWriter.h.
Referenced by writeFragment(), writeFragmentContents(), llvm::MachObjectWriter::WriteLinkerOptionsLoadCommand(), llvm::MachObjectWriter::WriteObject(), llvm::MachObjectWriter::WriteSection(), and llvm::MachObjectWriter::WriteSegmentLoadCommand().
void llvm::MCObjectWriter::WriteBytes | ( | StringRef | Str, |
unsigned | ZeroFillSize = 0 |
||
) | [inline] |
Definition at line 182 of file MCObjectWriter.h.
void llvm::MCObjectWriter::WriteLE16 | ( | uint16_t | Value | ) | [inline] |
Definition at line 118 of file MCObjectWriter.h.
void llvm::MCObjectWriter::WriteLE32 | ( | uint32_t | Value | ) | [inline] |
Definition at line 123 of file MCObjectWriter.h.
void llvm::MCObjectWriter::WriteLE64 | ( | uint64_t | Value | ) | [inline] |
Definition at line 128 of file MCObjectWriter.h.
virtual void llvm::MCObjectWriter::WriteObject | ( | MCAssembler & | Asm, |
const MCAsmLayout & | Layout | ||
) | [pure virtual] |
Write the object file.
This routine is called by the assembler after layout and relaxation is complete, fixups have been evaluated and applied, and relocations generated.
Implemented in llvm::MachObjectWriter.
Referenced by llvm::MCAssembler::Finish().
void llvm::MCObjectWriter::WriteZeros | ( | unsigned | N | ) | [inline] |
Definition at line 169 of file MCObjectWriter.h.
Referenced by llvm::MachObjectWriter::WriteObject().
unsigned llvm::MCObjectWriter::IsLittleEndian [protected] |
Definition at line 46 of file MCObjectWriter.h.
Referenced by isLittleEndian().
raw_ostream& llvm::MCObjectWriter::OS [protected] |
Definition at line 44 of file MCObjectWriter.h.
Referenced by getStream(), Write8(), llvm::MachObjectWriter::WriteDysymtabLoadCommand(), llvm::MachObjectWriter::WriteHeader(), llvm::MachObjectWriter::WriteLinkeditLoadCommand(), llvm::MachObjectWriter::WriteLinkerOptionsLoadCommand(), llvm::MachObjectWriter::WriteObject(), llvm::MachObjectWriter::WriteSection(), llvm::MachObjectWriter::WriteSegmentLoadCommand(), and llvm::MachObjectWriter::WriteSymtabLoadCommand().