51 bool DWARFMustBeAtTheEnd;
52 bool CreatedADWARFSection;
62 void EmitDataRegionEnd();
68 DWARFMustBeAtTheEnd(DWARFMustBeAtTheEnd), CreatedADWARFSection(
false) {}
71 void reset()
override {
72 CreatedADWARFSection =
false;
73 HasSectionLabel.clear();
83 void EmitEHSymAttributes(
const MCSymbol *Symbol,
MCSymbol *EHSymbol)
override;
88 unsigned Minor,
unsigned Update)
override;
89 void EmitThumbFunc(
MCSymbol *Func)
override;
91 void EmitSymbolDesc(
MCSymbol *Symbol,
unsigned DescValue)
override;
95 void EmitLocalCommonSymbol(
MCSymbol *Symbol, uint64_t
Size,
102 void EmitIdent(
StringRef IdentString)
override {
107 getAssembler().getLOHContainer().addDirective(Kind, Args);
110 void FinishImpl()
override;
121 if (SegName ==
"__LD" && SecName ==
"__compact_unwind")
124 if (SegName ==
"__IMPORT") {
125 if (SecName ==
"__jump_table")
128 if (SecName ==
"__pointers")
132 if (SegName ==
"__TEXT" && SecName ==
"__eh_frame")
135 if (SegName ==
"__DATA" && (SecName ==
"__nl_symbol_ptr" ||
136 SecName ==
"__thread_ptr"))
143 const MCExpr *Subsection) {
145 bool Created = changeSectionImpl(Section, Subsection);
148 if (SegName ==
"__DWARF")
149 CreatedADWARFSection =
true;
151 assert(!CreatedADWARFSection &&
"Creating regular section after DWARF");
155 if (LabelSections && !HasSectionLabel[Section] &&
157 MCSymbol *
Label = getContext().createLinkerPrivateTempSymbol();
159 HasSectionLabel[
Section] =
true;
163 void MCMachOStreamer::EmitEHSymAttributes(
const MCSymbol *Symbol,
165 getAssembler().registerSymbol(*Symbol);
168 if (cast<MCSymbolMachO>(Symbol)->isWeakDefinition())
174 void MCMachOStreamer::EmitLabel(
MCSymbol *Symbol,
SMLoc Loc) {
177 if (getAssembler().isSymbolLinkerVisible(*Symbol))
189 cast<MCSymbolMachO>(
Symbol)->clearReferenceType();
197 const MCSymbol &SymA = SymAExpr->getSymbol();
199 cast<MCSymbolMachO>(
Symbol)->setAltEntry();
207 MCSymbol *Start = getContext().createTempSymbol();
211 std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
212 Regions.push_back(Data);
215 void MCMachOStreamer::EmitDataRegionEnd() {
216 std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
217 assert(!Regions.empty() &&
"Mismatched .end_data_region!");
219 assert(!Data.End &&
"Mismatched .end_data_region!");
221 Data.End = getContext().createTempSymbol();
227 getAssembler().getBackend().handleAssemblerFlag(Flag);
235 getAssembler().setSubsectionsViaSymbols(
true);
241 getAssembler().getLinkerOptions().push_back(Options);
265 unsigned Minor,
unsigned Update) {
266 getAssembler().setVersionMinInfo(Kind, Major, Minor, Update);
269 void MCMachOStreamer::EmitThumbFunc(
MCSymbol *Symbol) {
272 getAssembler().setIsThumbFunc(Symbol);
273 cast<MCSymbolMachO>(
Symbol)->setThumbFunc();
276 bool MCMachOStreamer::EmitSymbolAttribute(
MCSymbol *Sym,
287 ISD.
Section = getCurrentSectionOnly();
288 getAssembler().getIndirectSymbols().push_back(ISD);
295 getAssembler().registerSymbol(*Symbol);
379 void MCMachOStreamer::EmitSymbolDesc(
MCSymbol *Symbol,
unsigned DescValue) {
381 getAssembler().registerSymbol(*Symbol);
382 cast<MCSymbolMachO>(
Symbol)->setDesc(DescValue);
385 void MCMachOStreamer::EmitCommonSymbol(
MCSymbol *Symbol, uint64_t
Size,
390 getAssembler().registerSymbol(*Symbol);
395 void MCMachOStreamer::EmitLocalCommonSymbol(
MCSymbol *Symbol, uint64_t Size,
396 unsigned ByteAlignment) {
398 return EmitZerofill(getContext().getObjectFileInfo()->getDataBSSSection(),
399 Symbol, Size, ByteAlignment);
403 uint64_t Size,
unsigned ByteAlignment) {
404 getAssembler().registerSection(*Section);
415 getAssembler().registerSymbol(*Symbol);
418 if (ByteAlignment != 1)
432 uint64_t Size,
unsigned ByteAlignment) {
433 EmitZerofill(Section, Symbol, Size, ByteAlignment);
436 void MCMachOStreamer::EmitInstToData(
const MCInst &Inst,
443 getAssembler().getEmitter().encodeInstruction(Inst, VecOS, Fixups, STI);
446 for (
MCFixup &Fixup : Fixups) {
453 void MCMachOStreamer::FinishImpl() {
454 EmitFrames(&getAssembler().getBackend());
462 for (
const MCSymbol &Symbol : getAssembler().symbols()) {
463 if (getAssembler().isSymbolLinkerVisible(Symbol) && Symbol.
isInSection() &&
467 "Invalid offset in atom defining symbol!");
475 const MCSymbol *CurrentAtom =
nullptr;
478 CurrentAtom = Symbol;
479 Frag.setAtom(CurrentAtom);
488 bool RelaxAll,
bool DWARFMustBeAtTheEnd,
489 bool LabelSections) {
490 MCMachOStreamer *S =
new MCMachOStreamer(Context, MAB, OS, CE,
491 DWARFMustBeAtTheEnd, LabelSections);
494 unsigned Major, Minor, Update;
506 assert(TT.
isiOS() &&
"Must only be iOS platform left");
509 S->EmitVersionMin(VersionType, Major, Minor, Update);
513 S->getAssembler().setRelaxAll(
true);
Instances of this class represent a uniqued identifier for a section in the current translation unit...
void setPrivateExtern(bool Value)
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
This represents a section on a Mach-O system (used by Mac OS X).
.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
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
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.
Function Alias Analysis false
Streaming machine code generation interface.
void EmitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
.weak_def_can_be_hidden (MachO)
LLVM_ATTRIBUTE_ALWAYS_INLINE iterator begin()
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
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)...
const MCSymbolRefExpr * getSymB() const
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
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
.code32 (X86) / .code 32 (ARM)
constexpr char Size[]
Key for Kernel::Arg::Metadata::mSize.
llvm_unreachable("Unknown RegBank!")
.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.
Represents a location in source code.
bool isUndefined(bool SetUsed=true) const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
void setBeginSymbol(MCSymbol *Sym)