Streaming object file generation interface.

Synopsis

Declared in <llvm/MC/MCObjectStreamer.h>

class MCObjectStreamer
    : public MCStreamer

Description

This class provides an implementation of the MCStreamer interface which is suitable for use with the assembler backend. Specific object file formats are expected to subclass this interface to implement directives specific to that file format or custom semantics expected by the object writer implementation.

Base Classes

Name

Description

MCStreamer

Streaming machine code generation interface.

Member Functions

Name

Description

operator= [deleted]

Deleted copy assignment.

AddComment [virtual]

Add a textual comment.

EnsureValidWinFrameInfo

Retrieve the current frame info if one is available and it is not yet closed. Otherwise, issue an error and return null.

addBlankLine [virtual]

Emit a blank line to a .s file to pretty it up.

addExplicitComment [virtual]

Add explicit comment T. T is required to be a valid comment in the output and does not need to be escaped.

addFixup

Add a fixup to the current fragment.

allocFragSpace

Allocate a new fragment storage block with room for Headroom bytes.

appendContents

appendContents overloads

beginCOFFSymbolDef [virtual]

Start emitting COFF symbol definition

changeSection [virtual]

Update streamer state for a new active section.

emitAbsoluteSymbolDiff [virtual]

Emit the absolute difference between two symbols if possible.

emitAbsoluteSymbolDiffAsULEB128 [virtual]

Emit the absolute difference between two symbols encoded as ULEB128.

emitAddrsig [virtual]

Emit a .addrsig directive starting an address‐significance table.

emitAddrsigSym [virtual]

Add Sym to the address‐significance table.

emitAssignment [virtual]

Emit an assignment of Value to Symbol.

emitBinaryData [virtual]

Functionally identical to EmitBytes. When emitting textual assembly, this method uses .byte directives instead of .ascii or .asciz for readability.

emitBuildVersion [virtual]

Emit/Specify Mach‐O build version command. Platform should be one of MachO::PlatformType.

emitBundleAlignMode [virtual]

Enable aligned instruction bundling with the given bundle size.

emitBundleLock [virtual]

The following instructions are a bundle‐locked group.

emitBundleUnlock [virtual]

Ends a bundle‐locked group.

emitBytes [virtual]

Emit the bytes in Data into the current section.

emitCFIAdjustCfaOffset [virtual]

Emit a .cfi_adjust_cfa_offset directive.

emitCFIBKeyFrame [virtual]

Emit a .cfi_b_key_frame directive.

emitCFIDefCfa [virtual]

Emit a .cfi_def_cfa directive.

emitCFIDefCfaOffset [virtual]

Emit a .cfi_def_cfa_offset directive.

emitCFIDefCfaRegister [virtual]

Emit a .cfi_def_cfa_register directive.

emitCFIEndProc

Emit a .cfi_endproc directive.

emitCFIEscape [virtual]

Emit a .cfi_escape directive with raw DWARF CFI bytes.

emitCFIGnuArgsSize [virtual]

Emit a .cfi_gnu_args_size directive.

emitCFILLVMDefAspaceCfa [virtual]

Emit a .cfi_llvm_def_aspace_cfa directive.

emitCFILLVMRegisterPair [virtual]

Emit a .cfi_llvm_register_pair directive.

emitCFILLVMSetRAState

emitCFILLVMSetRAState overloads

emitCFILLVMVectorOffset [virtual]

Emit a .cfi_llvm_vector_offset directive.

emitCFILLVMVectorRegisterMask [virtual]

Emit a .cfi_llvm_vector_register_mask directive.

emitCFILLVMVectorRegisters [virtual]

Emit a .cfi_llvm_vector_registers directive.

emitCFILabel [virtual]

Emit a real CFI label into the object when emitting object files.

emitCFILabelDirective [virtual]

Emit a .cfi_label directive.

emitCFILsda [virtual]

Emit a .cfi_lsda directive.

emitCFIMTETaggedFrame [virtual]

Emit a .cfi_mte_tagged_frame directive.

emitCFINegateRAState [virtual]

Emit a .cfi_negate_ra_state directive.

emitCFINegateRAStateWithPC [virtual]

Emit a .cfi_negate_ra_state_with_pc directive.

emitCFIOffset [virtual]

Emit a .cfi_offset directive.

emitCFIPersonality [virtual]

Emit a .cfi_personality directive.

emitCFIRegister [virtual]

Emit a .cfi_register directive.

emitCFIRelOffset [virtual]

Emit a .cfi_rel_offset directive.

emitCFIRememberState [virtual]

Emit a .cfi_remember_state directive.

emitCFIRestore [virtual]

Emit a .cfi_restore directive.

emitCFIRestoreState [virtual]

Emit a .cfi_restore_state directive.

emitCFIReturnColumn [virtual]

Emit a .cfi_return_column directive.

emitCFISameValue [virtual]

Emit a .cfi_same_value directive.

emitCFISections [virtual]

Select which CFI sections to emit.

emitCFISignalFrame [virtual]

Emit a .cfi_signal_frame directive.

emitCFIStartProc

Emit a .cfi_startproc directive.

emitCFIUndefined [virtual]

Emit a .cfi_undefined directive.

emitCFIValOffset [virtual]

Emit a .cfi_val_offset directive.

emitCFIWindowSave [virtual]

Emit a .cfi_window_save directive.

emitCGProfileEntry [virtual]

Emit a call‐graph profile edge.

emitCOFFImgRel32 [virtual]

Emits a COFF image relative relocation.

emitCOFFSafeSEH [virtual]

Emit a COFF .safeseh directive for Symbol.

emitCOFFSecNumber [virtual]

Emits the physical number of the section containing the given symbol as assigned during object writing (i.e., this is not a runtime relocation).

emitCOFFSecOffset [virtual]

Emits the offset of the symbol from the beginning of the section during object writing (i.e., this is not a runtime relocation).

emitCOFFSecRel32 [virtual]

Emits a COFF section relative relocation.

emitCOFFSectionIndex [virtual]

Emits a COFF section index.

emitCOFFSymbolIndex [virtual]

Emits the symbol table index of a Symbol into the current section.

emitCOFFSymbolStorageClass [virtual]

Emit the storage class of the symbol.

emitCOFFSymbolType [virtual]

Emit the type of the symbol.

emitCVDefRangeDirective

emitCVDefRangeDirective overloads

emitCVFPOData [virtual]

This implements the CodeView '.cv_fpo_data' assembler directive.

emitCVFileChecksumOffsetDirective [virtual]

Emit a CodeView .cv_filechecksumoffset directive.

emitCVFileChecksumsDirective [virtual]

Emit a CodeView .cv_filechecksums directive.

emitCVFileDirective [virtual]

Associate a filename and checksum with a CodeView logical file number.

emitCVFuncIdDirective [virtual]

Introduces a function id for use with .cv_loc.

emitCVInlineLinetableDirective [virtual]

Emit a CodeView .cv_inline_linetable directive.

emitCVInlineSiteIdDirective [virtual]

Introduces an inline call site id for use with .cv_loc. Includes extra information for inline line table generation.

emitCVLinetableDirective

emitCVLinetableDirective overloads

emitCVLocDirective [virtual]

Emit a CodeView .cv_loc directive.

emitCVStringTableDirective [virtual]

Emit a CodeView .cv_stringtable directive.

emitCodeAlignment

emitCodeAlignment overloads

emitCommonSymbol [virtual]

Emit a common symbol.

emitConditionalAssignment [virtual]

Emit an assignment of Value to Symbol only if Value is also emitted.

emitDarwinTargetVariantBuildVersion [virtual]

Emit a Mach‐O build‐version command for the Darwin target variant.

emitDataRegion [virtual]

Note in the output the specified region Kind.

emitDwarfAdvanceFrameAddr

Emit a DWARF frame address advance from LastLabel to Label.

emitDwarfAdvanceLineAddr [virtual]

Emit a raw DWARF line‐address advance from LastLabel to Label.

emitDwarfFile0Directive [virtual]

Specify the "root" file of the compilation, using the ".file 0" extension.

emitDwarfFileDirective

Associate a filename with a specified logical file number. This implements the DWARF2 '.file 4 "foo.c"' assembler directive.

emitDwarfLineEndEntry [virtual]

Emit the debug line end entry for Section.

emitDwarfLineStartLabel [virtual]

Emit the debug line start label.

emitDwarfLocDirective [virtual]

Emit a DWARF .loc directive.

emitDwarfLocDirectiveWithInlinedAt [virtual]

This is same as emitDwarfLocDirective, except it has the capability to add inlined_at information.

emitDwarfLocLabelDirective [virtual]

This implements the '.loc_label Name' directive.

emitDwarfUnitLength

emitDwarfUnitLength overloads

emitEHSymAttributes [virtual]

Copy EH‐related symbol attributes from Symbol to EHSymbol.

emitELFSize [virtual]

Emit an ELF .size directive.

emitELFSymverDirective [virtual]

Emit an ELF .symver directive.

emitExplicitComments [virtual]

Emit added explicit comments.

emitFileDirective

emitFileDirective overloads

emitFill

emitFill overloads

emitFrames

Emit collected EH, debug, and/or SFrame unwind information.

emitGNUAttribute [virtual]

Emit a .gnu_attribute directive.

emitIdent [virtual]

Emit the "identifiers" directive. This implements the '.ident "version foo"' assembler directive.

emitInstToFragment

Emit an instruction to a special fragment, because this instruction can change its size during relaxation.

emitInstruction [virtual]

Emit the given instruction into the current section.

emitInt16

Emit Value as a two‐byte integer.

emitInt32

Emit Value as a four‐byte integer.

emitInt64

Emit Value as an eight‐byte integer.

emitInt8

Emit Value as a one‐byte integer.

emitIntValue

emitIntValue overloads

emitIntValueInHex [virtual]

Special case of EmitValue that avoids the client having to pass in a MCExpr for constant integers & prints in Hex format for certain modes.

emitIntValueInHexWithPadding [virtual]

Emit a constant integer in hex, padded to Size bytes.

emitLOHDirective [virtual]

Emit a Linker Optimization Hint (LOH) directive.

emitLabel [virtual]

Emit Symbol as a label at the current position.

emitLabelAtPos [virtual]

Emit Symbol as a label at Offset within fragment F.

emitLineTableLabel

Emit a temporary label and record it in the DWARF line table.

emitLinkerOptions [virtual]

Emit the given list Options of strings as linker options into the output.

emitLocalCommonSymbol [virtual]

Emit a local common (.lcomm) symbol.

emitNops [virtual]

Emit NumBytes bytes of NOP instructions.

emitPendingAssignments

Emits pending conditional assignments that depend on Symbol being emitted.

emitPrefAlign

emitPrefAlign overloads

emitPseudoProbe [virtual]

Emit the a pseudo probe into the current section.

emitRawComment [virtual]

Print T immediately as a comment, optionally tab‐prefixed.

emitRawText

Dump String into the output assembly file.

emitRelocDirective [virtual]

Record a relocation described by the .reloc directive.

emitSFrameCalculateFuncOffset

Emit an SFrame function‐offset delta from FunCabsel to FREBegin.

emitSLEB128IntValue

Special case of EmitSLEB128Value that avoids the client having to pass in a MCExpr for constant integers.

emitSLEB128Value [virtual]

Emit Value encoded as signed LEB128.

emitSubsectionsViaSymbols [virtual]

Emit a .subsection_via_symbols directive.

emitSymbolAttribute [virtual]

Add the given Attribute to Symbol.

emitSymbolDesc [virtual]

Set the DescValue for the Symbol.

emitSymbolValue

Special case of EmitValue that avoids the client having to pass in a MCExpr for MCSymbols.

emitSyntaxDirective [virtual]

Emit a .{Syntax}_syntax directive, such as .intel_syntax.

emitTBSSSymbol [virtual]

Emit a thread local bss (.tbss) symbol.

emitTargetTriple [virtual]

Emit the target triple into the output.

emitULEB128IntValue

Special case of EmitULEB128Value that avoids the client having to pass in a MCExpr for constant integers.

emitULEB128Value [virtual]

Emit Value encoded as unsigned LEB128.

emitValue

Emit the expression Value as a native integer of Size bytes.

emitValueImpl [virtual]

Emit the expression Value as a native integer of Size bytes.

emitValueToAlignment [virtual]

Emit fill bytes until alignment Alignment is reached.

emitValueToOffset [virtual]

Emit copies of Value until byte offset Offset is reached.

emitVersionForTarget

Emit version directives appropriate for Target.

emitVersionMin [virtual]

Specify the Mach‐O minimum deployment target version.

emitWeakReference

emitWeakReference overloads

emitWinCFIAllocStack [virtual]

Emit a .seh_stackalloc directive.

emitWinCFIBeginEpilogue [virtual]

Emit a .seh_startepilogue directive.

emitWinCFIEndEpilogue [virtual]

Emit a .seh_endepilogue directive.

emitWinCFIEndProc [virtual]

Emit a .seh_endproc directive ending a Windows CFI procedure.

emitWinCFIEndProlog [virtual]

Emit a .seh_endprologue directive.

emitWinCFIFuncletOrFuncEnd [virtual]

Emit a .seh_endfunclet directive for .xdata sizing.

emitWinCFIPush2Regs [virtual]

Emit a .seh_push2regs directive.

emitWinCFIPushFrame [virtual]

Emit a .seh_pushframe directive.

emitWinCFIPushReg [virtual]

Emit a .seh_pushreg directive.

emitWinCFISaveReg [virtual]

Emit a .seh_savereg directive.

emitWinCFISaveXMM [virtual]

Emit a .seh_savexmm directive.

emitWinCFISetFrame [virtual]

Emit a .seh_setframe directive.

emitWinCFISplitChained [virtual]

Emit a .seh_splitchained directive.

emitWinCFIStartProc [virtual]

Emit a .seh_proc directive starting a Windows CFI procedure.

emitWinCFIUnwindV2Start [virtual]

Emit a .seh_unwindv2start directive.

emitWinCFIUnwindVersion [virtual]

Emit a .seh_unwindversion directive.

emitWinEHHandler [virtual]

Emit a .seh_handler directive.

emitWinEHHandlerData [virtual]

Emit a .seh_handlerdata directive.

emitXCOFFCInfoSym [virtual]

Emit a C_INFO symbol with XCOFF embedded metadata to the .info section.

emitXCOFFExceptDirective [virtual]

Emit an XCOFF .except directive which adds information about a trap instruction to the object file exception section

emitXCOFFLocalCommonSymbol [virtual]

Emits an lcomm directive with XCOFF csect information.

emitXCOFFRefDirective [virtual]

Emit a XCOFF .ref directive which creates R_REF type entry in the relocation table for one or more symbols.

emitXCOFFRenameDirective [virtual]

Emit a XCOFF .rename directive which creates a synonym for an illegal or undesirable name.

emitXCOFFSymbolLinkageWithVisibility [virtual]

Emit a symbol's linkage and visibility with a linkage directive for XCOFF.

emitZerofill [virtual]

Emit the zerofill section and an optional symbol.

emitZeros

Emit NumBytes worth of zeros. This function properly handles data in virtual sections.

endCOFFSymbolDef [virtual]

Marks the end of the symbol definition.

endSection

End Section and return its end symbol.

ensureHeadroom

Ensure the current fragment has at least Headroom free bytes.

finish

Finish emission of machine code.

finishImpl [virtual]

Perform object‐streamer finalization before finishing the object.

generateCompactUnwindEncodings

Generate compact‐unwind encodings for collected DWARF frames.

getAllowAutoPadding

Return whether the assembler may insert padding automatically.

getAssembler

Return the assembler owned by this streamer.

getAssemblerPtr [virtual]

Return a pointer to the assembler owned by this streamer.

getAssociatedPDataSection

Return the .pdata section associated with TextSec.

getAssociatedXDataSection

Get the .xdata section used for the given section.

getCommentOS [virtual]

Return a raw_ostream that comments can be written to. Unlike AddComment, you are required to terminate comments with if you use this method.

getContext

Return the MC context this streamer is bound to.

getCurFragEnd

Return a pointer to the end of the fixed‐size contents of the current fragment.

getCurFragSize

Return the fixed size of the current data fragment.

getCurrentFragment

Return the fragment currently being appended to.

getCurrentSection

Return the current section that the streamer is emitting code to.

getCurrentSectionOnly

Return only the current section, ignoring the subsection index.

getCurrentWinEpilog

Return the Windows EH epilog currently being processed, or null.

getDefaultWinCFIUnwindVersion

Return the default unwind version for new WinCFI frames.

getDwarfFrameInfos

Return the collected DWARF CFI frames.

getDwarfLineTableSymbol [virtual]

Return the DWARF line‐table symbol for compile unit CUID.

getLFIRewriter

Return the installed LFI rewriter, or null if none.

getMnemonic [virtual]

Returns the mnemonic for MI, if the streamer has access to a instruction printer and returns an empty string otherwise.

getNumFrameInfos

Return the number of DWARF CFI frames collected so far.

getNumWinFrameInfos

Return the number of Windows EH frames collected so far.

getPreviousSection

Return the previous section that the streamer is emitting code to.

getStartTokLoc

Return the parser's current token location, if available.

getTargetStreamer

Return the attached target streamer, or null if none.

getUseAssemblerInfoForParsing

Return whether assembler info may be used during parsing.

getWinFrameInfos

Return the collected Windows EH frames.

hasRawTextSupport [virtual]

Return true if this asm streamer supports emitting unformatted text to the .s file with EmitRawText.

hasUnfinishedDwarfFrameInfo

Return true if a DWARF CFI frame has been started but not ended.

initSections [virtual]

Create the default sections and set the initial one.

isBundleLocked

Return true if a .bundle_lock group is currently open.

isInEpilogCFI

Return true if SEH directives are being recorded for an epilog.

isIntegratedAssemblerRequired [virtual]

Object streamers require the integrated assembler.

isObj

Return true if this streamer emits an object file.

isVerboseAsm [virtual]

Return true if this streamer supports verbose assembly and if it is enabled.

isWinCFIPrologEnded

Returns true if a WinCFI prolog has been completed (.seh_endprologue) in the current frame.

mayHaveInstructions [virtual]

Return true if Sec may contain instructions.

maybeEmitDwarf64Mark

Emit a special value of 0xffffffff if producing 64‐bit debugging info.

newFragment

Add a new fragment to the current section without a variable‐size tail.

newSpecialFragment

Add a new special fragment of type FT to the current section and start a new empty fragment afterward.

popSection [virtual]

Restore the current and previous section from the section stack. Calls changeSection as needed.

pushSection

Save the current and previous section on the section stack.

reset [virtual]

state management

setAllowAutoPadding

Set whether the assembler may insert padding automatically.

setDefaultWinCFIUnwindVersion

Set the default unwind version for new WinCFI frames.

setLFIRewriter

Take ownership of LFI rewriter Rewriter.

setStartTokLocPtr

Point at the parser's current token location for diagnostics.

setTargetStreamer

Take ownership of target streamer TS.

setUseAssemblerInfoForParsing

Set whether assembler info may be used during parsing.

switchSection

switchSection overloads

switchSectionNoPrint

Similar to switchSection, but does not print the section directive.

tryEmitDwarfFileDirective [virtual]

Associate a filename with a specified logical file number.

visitUsedExpr

Visit symbols referenced by Expr.

visitUsedSymbol [virtual]

Register Sym with the assembler when it is used.

Using Declarations

Name

Description

emitFill

Bring MCStreamer::emitFill overloads into scope.

Protected Member Functions

Name

Description

MCObjectStreamer [constructor]

Construct an object streamer.

~MCObjectStreamer [destructor] [virtual]

Destroy the object streamer.

addFragment

Append fragment F to the current section.

changeSection [virtual]

This is called by popSection and switchSection, if the current section changes.

checkCVLocSection

Returns true if the .cv_loc directive is in the right section.

emitCFIEndProcImpl [virtual]

Target‐specific implementation of .cfi_endproc.

emitCFIStartProcImpl [virtual]

Target‐specific implementation of .cfi_startproc.

emitRawTextImpl [virtual]

Implementation of emitRawText, used by assembly streamers.

emitWindowsUnwindTables

emitWindowsUnwindTables overloads

getCurrentWinFrameInfo

Return the current Windows EH frame, or null if none is active.

Protected Data Members

Name

Description

BundleLocked

True while inside a .bundle_lock / .bundle_unlock group.

CurFrag

Fragment currently being appended to.

CurrentWinEpilog

Symbol of the current epilog for which we are processing SEH directives.

DwarfFrameInfos

DWARF CFI frames collected while streaming.

IsObj

True if this streamer is emitting an object file rather than assembly.

LFIRewriter

Optional LFI rewriter applied to emitted instructions.

Non-Member Functions

Name

Description

emitLFIBundleAlign

Emit LFI bundle‐alignment mode for the current target, if required.

emitLFINoteSection

Emit the ELF note section that identifies an LFI object file.

initializeLFIMCStreamer

Initialize Streamer with LFI rewriting support for TheTriple.

mcdwarf::emitListsTableHeaderStart

Emit the common part of the DWARF 5 range/locations list tables header.

Derived Classes

Name

Description

MCDXContainerStreamer

Streaming DXContainer object file generation interface.

MCELFStreamer

Streaming ELF object file generation interface.

MCGOFFStreamer

Streaming GOFF object file generation interface.

MCSPIRVStreamer

Streaming SPIR‐V object file generation interface.

MCWasmStreamer

Streaming Wasm object file generation interface.

MCWinCOFFStreamer

Streaming Windows COFF object file generation interface.

MCXCOFFStreamer

Streaming XCOFF object file generation interface.

Created with MrDocs