43 bool DWARFMustBeAtTheEnd;
44 bool CreatedADWARFSection;
54 void EmitDataRegionEnd();
60 DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd), CreatedADWARFSection(
false) {}
63 void reset()
override {
64 CreatedADWARFSection =
false;
65 HasSectionLabel.clear();
80 unsigned Minor,
unsigned Update)
override;
83 void EmitSymbolDesc(
MCSymbol *
Symbol,
unsigned DescValue)
override;
89 void EmitCOFFSymbolStorageClass(
int StorageClass)
override {
92 void EmitCOFFSymbolType(
int Type)
override {
95 void EndCOFFSymbolDef()
override {
105 void EmitFileDirective(
StringRef Filename)
override {
112 void EmitIdent(
StringRef IdentString)
override {
117 getAssembler().getLOHContainer().addDirective(Kind, Args);
120 void FinishImpl()
override;
131 if (SegName ==
"__LD" && SecName ==
"__compact_unwind")
134 if (SegName ==
"__IMPORT") {
135 if (SecName ==
"__jump_table")
138 if (SecName ==
"__pointers")
142 if (SegName ==
"__TEXT" && SecName ==
"__eh_frame")
145 if (SegName ==
"__DATA" && (SecName ==
"__nl_symbol_ptr" ||
146 SecName ==
"__thread_ptr"))
153 const MCExpr *Subsection) {
158 if (SegName ==
"__DWARF")
159 CreatedADWARFSection =
true;
161 assert(!CreatedADWARFSection &&
"Creating regular section after DWARF");
165 if (LabelSections && !HasSectionLabel[Section] &&
167 MCSymbol *
Label = getContext().createLinkerPrivateTempSymbol();
169 HasSectionLabel[
Section] =
true;
175 getAssembler().registerSymbol(*Symbol);
178 if (cast<MCSymbolMachO>(Symbol)->isWeakDefinition())
184 void MCMachOStreamer::EmitLabel(
MCSymbol *Symbol) {
189 if (getAssembler().isSymbolLinkerVisible(*Symbol))
201 cast<MCSymbolMachO>(
Symbol)->clearReferenceType();
209 const MCSymbol &SymA = SymAExpr->getSymbol();
211 cast<MCSymbolMachO>(
Symbol)->setAltEntry();
219 MCSymbol *Start = getContext().createTempSymbol();
223 std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
224 Regions.push_back(Data);
227 void MCMachOStreamer::EmitDataRegionEnd() {
228 std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
229 assert(!Regions.empty() &&
"Mismatched .end_data_region!");
231 assert(!Data.End &&
"Mismatched .end_data_region!");
233 Data.End = getContext().createTempSymbol();
239 getAssembler().getBackend().handleAssemblerFlag(Flag);
247 getAssembler().setSubsectionsViaSymbols(
true);
253 getAssembler().getLinkerOptions().push_back(Options);
277 unsigned Minor,
unsigned Update) {
278 getAssembler().setVersionMinInfo(Kind, Major, Minor, Update);
281 void MCMachOStreamer::EmitThumbFunc(
MCSymbol *Symbol) {
284 getAssembler().setIsThumbFunc(Symbol);
285 cast<MCSymbolMachO>(
Symbol)->setThumbFunc();
288 bool MCMachOStreamer::EmitSymbolAttribute(
MCSymbol *Sym,
299 ISD.
Section = getCurrentSectionOnly();
300 getAssembler().getIndirectSymbols().push_back(ISD);
307 getAssembler().registerSymbol(*Symbol);
391 void MCMachOStreamer::EmitSymbolDesc(
MCSymbol *Symbol,
unsigned DescValue) {
393 getAssembler().registerSymbol(*Symbol);
394 cast<MCSymbolMachO>(
Symbol)->setDesc(DescValue);
397 void MCMachOStreamer::EmitCommonSymbol(
MCSymbol *Symbol, uint64_t Size,
402 getAssembler().registerSymbol(*Symbol);
407 void MCMachOStreamer::EmitLocalCommonSymbol(
MCSymbol *Symbol, uint64_t Size,
408 unsigned ByteAlignment) {
410 return EmitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
411 Symbol, Size, ByteAlignment);
415 uint64_t Size,
unsigned ByteAlignment) {
416 getAssembler().registerSection(*Section);
427 getAssembler().registerSymbol(*Symbol);
430 if (ByteAlignment != 1)
444 uint64_t Size,
unsigned ByteAlignment) {
445 EmitZerofill(Section, Symbol, Size, ByteAlignment);
448 void MCMachOStreamer::EmitInstToData(
const MCInst &Inst,
455 getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
458 for (
MCFixup &Fixup : Fixups) {
465 void MCMachOStreamer::FinishImpl() {
466 EmitFrames(&getAssembler().getBackend());
474 for (
const MCSymbol &Symbol : getAssembler().symbols()) {
475 if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.
isInSection() &&
479 "Invalid offset in atom defining symbol!");
487 const MCSymbol *CurrentAtom =
nullptr;
490 CurrentAtom = Symbol;
491 Frag.setAtom(CurrentAtom);
500 bool RelaxAll,
bool DWARFMustBeAtTheEnd,
501 bool LabelSections) {
502 MCMachOStreamer *S =
new MCMachOStreamer(Context, MAB, OS, CE,
503 DWARFMustBeAtTheEnd, LabelSections);
506 unsigned Major, Minor, Update;
518 assert(TT.
isiOS() &&
"Must only be iOS platform left");
521 S->EmitVersionMin(VersionType, Major, Minor, Update);
525 S->getAssembler().setRelaxAll(
true);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void setPrivateExtern(bool Value)
bool changeSectionImpl(MCSection *Section, const MCExpr *Subsection)
This represents a section on a Mach-O system (used by Mac OS X).
ValueT lookup(const KeyT &Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
void EmitLabel(MCSymbol *Symbol) override
Emit a label for Symbol into the current section.
.type _foo, STT_OBJECT # aka
This represents an "assembler immediate".
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void setAlignment(unsigned Value)
A raw_ostream that writes to an SmallVector or SmallString.
.type _foo, STT_NOTYPE # aka
unsigned getAlignment() const
COFF::SymbolStorageClass StorageClass
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
bool isMacOSX() const
isMacOSX - Is this a Mac OS X triple.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Base class for the full range of assembler expressions which are needed for parsing.
Represent a reference to a symbol from inside an expression.
void setCommon(uint64_t Size, unsigned Align)
Mark this symbol as being 'common'.
Context object for machine code objects.
void setWeakReference() const
.code16 (X86) / .code 16 (ARM)
Streaming object file generation interface.
StringRef getSectionName() const
.type _foo, STT_GNU_IFUNC
Function Alias Analysis false
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
void setWeakDefinition() const
void setExternal(bool Value) const
bool isTvOS() const
Is this an Apple tvOS triple.
const Triple & getTargetTriple() const
SmallVectorImpl< char > & getContents()
Instances of this class represent a single low-level machine instruction.
Flag
These should be considered private to the implementation of the MCInstrDesc class.
void setFragment(MCFragment *F) const
Mark the symbol as defined in the fragment F.
bool isiOS() const
Is this an iOS triple.
Streaming machine code generation interface.
.weak_def_can_be_hidden (MachO)
The instances of the Type class are immutable: once they are created, they are never changed...
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
MCCodeEmitter - Generic instruction encoding interface.
SmallVectorImpl< MCFixup > & getFixups()
bool isWatchOS() const
Is this an Apple watchOS triple.
MCLOHType
Linker Optimization Hint Type.
.subsections_via_symbols (MachO)
void setReferenceTypeUndefinedLazy(bool Value) const
bool isInSection(bool SetUsed=true) const
isInSection - Check if this symbol is defined in some section (i.e., it is defined but not absolute)...
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
const MCSymbolRefExpr * getSymB() const
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Triple - Helper class for working with autoconf configuration names.
static bool canGoAfterDWARF(const MCSectionMachO &MSec)
PowerPC TLS Dynamic Call Fixup
bool isOSDarwin() const
isOSDarwin - Is this a "Darwin" OS (OS X, iOS, or watchOS).
void setSymbolResolver() const
const MCSymbolRefExpr * getSymA() const
virtual bool isVirtualSection() const =0
Check whether this section is "virtual", that is has no actual object file contents.
void getOSVersion(unsigned &Major, unsigned &Minor, unsigned &Micro) const
getOSVersion - Parse the version number from the OS name component of the triple, if present...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
.type _foo, STT_TLS # aka
MCSymbol * getBeginSymbol()
void setNoDeadStrip() const
bool evaluateAsRelocatable(MCValue &Res, const MCAsmLayout *Layout, const MCFixup *Fixup) const
Try to evaluate the expression to a relocatable value, i.e.
StringRef getSegmentName() const
.code32 (X86) / .code 32 (ARM)
.type _foo, STT_COMMON # aka
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator end()
StringRef getName() const
getName - Get the symbol name.
void FinishImpl() override
Streamer specific finalization.
uint64_t getOffset() const
.type _foo, STT_FUNC # aka
void EmitAssignment(MCSymbol *Symbol, const MCExpr *Value) override
Emit an assignment of Value to Symbol.
void reset() override
state management
LLVM_ATTRIBUTE_ALWAYS_INLINE size_type size() const
MCSubtargetInfo - Generic base class for all target subtargets.
bool isVariable() const
isVariable - Check if this is a variable symbol.
MCFragment * getFragment(bool SetUsed=true) const
An abstract base class for streams implementations that also support a pwrite operation.
Fragment for data and encoded instructions.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
int64_t getConstant() const
bool isPrivateExtern() const
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
MCStreamer * createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB, raw_pwrite_stream &OS, MCCodeEmitter *CE, bool RelaxAll, bool DWARFMustBeAtTheEnd, bool LabelSections=false)
LLVM Value Representation.
Generic interface to target specific assembler backends.
const MCObjectFileInfo * getObjectFileInfo() const
StringRef - Represent a constant reference to a string, i.e.
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
void setBeginSymbol(MCSymbol *Sym)