33 virtual void EmitInstToData(
const MCInst &Inst);
36 void EmitDataRegionEnd();
45 virtual void InitSections();
46 virtual void InitToTextSection();
62 virtual void EmitCOFFSymbolStorageClass(
int StorageClass) {
65 virtual void EmitCOFFSymbolType(
int Type) {
68 virtual void EndCOFFSymbolDef() {
74 virtual void EmitLocalCommonSymbol(
MCSymbol *
Symbol, uint64_t Size,
81 virtual void EmitFileDirective(
StringRef Filename) {
88 virtual void EmitIdent(
StringRef IdentString) {
92 virtual void FinishImpl();
97 void MCMachOStreamer::InitSections() {
101 void MCMachOStreamer::InitToTextSection() {
102 SwitchSection(getContext().getMachOSection(
104 MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0,
111 getAssembler().getOrCreateSymbolData(*Symbol);
120 void MCMachOStreamer::EmitLabel(
MCSymbol *Symbol) {
121 assert(Symbol->
isUndefined() &&
"Cannot define a symbol twice!");
124 AssignSection(Symbol, getCurrentSection().first);
127 if (getAssembler().isSymbolLinkerVisible(*Symbol))
132 MCSymbolData &SD = getAssembler().getSymbolData(*Symbol);
143 void MCMachOStreamer::EmitDebugLabel(
MCSymbol *Symbol) {
147 if (!getAssembler().getBackend().hasDataInCodeSupport())
150 MCSymbol *Start = getContext().CreateTempSymbol();
154 std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
155 Regions.push_back(Data);
158 void MCMachOStreamer::EmitDataRegionEnd() {
159 if (!getAssembler().getBackend().hasDataInCodeSupport())
161 std::vector<DataRegionData> &Regions = getAssembler().getDataRegions();
162 assert(Regions.size() &&
"Mismatched .end_data_region!");
164 assert(Data.End == NULL &&
"Mismatched .end_data_region!");
166 Data.End = getContext().CreateTempSymbol();
172 getAssembler().getBackend().handleAssemblerFlag(Flag);
180 getAssembler().setSubsectionsViaSymbols(
true);
186 getAssembler().getLinkerOptions().push_back(Options);
209 void MCMachOStreamer::EmitThumbFunc(
MCSymbol *Symbol) {
212 getAssembler().setIsThumbFunc(Symbol);
215 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
219 bool MCMachOStreamer::EmitSymbolAttribute(
MCSymbol *Symbol,
229 getAssembler().getIndirectSymbols().push_back(ISD);
236 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
315 void MCMachOStreamer::EmitSymbolDesc(
MCSymbol *Symbol,
unsigned DescValue) {
318 "Invalid .desc value!");
319 getAssembler().getOrCreateSymbolData(*Symbol).setFlags(
323 void MCMachOStreamer::EmitCommonSymbol(
MCSymbol *Symbol, uint64_t Size,
326 assert(Symbol->
isUndefined() &&
"Cannot define a symbol twice!");
328 AssignSection(Symbol, NULL);
330 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
335 void MCMachOStreamer::EmitLocalCommonSymbol(
MCSymbol *Symbol, uint64_t Size,
336 unsigned ByteAlignment) {
338 return EmitZerofill(getContext().getMachOSection(
"__DATA",
"__bss",
341 Symbol, Size, ByteAlignment);
345 uint64_t Size,
unsigned ByteAlignment) {
346 MCSectionData &SectData = getAssembler().getOrCreateSectionData(*Section);
353 assert(Section->
isVirtualSection() &&
"Section does not have zerofill type!");
355 assert(Symbol->
isUndefined() &&
"Cannot define a symbol twice!");
357 MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
360 if (ByteAlignment != 1)
366 AssignSection(Symbol, Section);
376 uint64_t Size,
unsigned ByteAlignment) {
377 EmitZerofill(Section, Symbol, Size, ByteAlignment);
381 void MCMachOStreamer::EmitInstToData(
const MCInst &Inst) {
387 getAssembler().getEmitter().EncodeInstruction(Inst, VecOS, Fixups);
391 for (
unsigned i = 0, e = Fixups.
size(); i != e; ++i) {
398 void MCMachOStreamer::FinishImpl() {
399 EmitFrames(&getAssembler().getBackend(),
true);
408 ie = getAssembler().symbol_end(); it != ie; ++it) {
409 if (getAssembler().isSymbolLinkerVisible(it->getSymbol()) &&
412 assert(it->getOffset() == 0 &&
"Invalid offset in atom defining symbol!");
413 DefiningSymbolMap[it->getFragment()] = it;
420 ie = getAssembler().
end(); it != ie; ++it) {
423 ie2 = it->end(); it2 != ie2; ++it2) {
426 it2->setAtom(CurrentAtom);
436 MCMachOStreamer *S =
new MCMachOStreamer(Context, MAB, OS, CE);
438 S->getAssembler().setRelaxAll(
true);
void setExternal(bool Value)
const_iterator end(StringRef path)
Get end iterator over path.
void setFlags(uint32_t Value)
setFlags - Set the (implementation defined) symbol flags.
.type _foo, STT_OBJECT # aka
const_iterator begin(StringRef path)
Get begin iterator over path.
virtual SmallVectorImpl< char > & getContents()
.type _foo, STT_NOTYPE # aka
COFF::SymbolStorageClass StorageClass
SmallVectorImpl< MCFixup > & getFixups()
static SectionKind getBSS()
MCStreamer * createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll=false)
#define llvm_unreachable(msg)
.code16 (X86) / .code 16 (ARM)
Streaming object file generation interface.
.type _foo, STT_GNU_IFUNC
.weak_def_can_be_hidden (MachO)
void setPrivateExtern(bool Value)
uint32_t getFlags() const
getFlags - Get the (implementation defined) symbol flags.
void setCommon(uint64_t Size, unsigned Align)
MCCodeEmitter - Generic instruction encoding interface.
.subsections_via_symbols (MachO)
void append(in_iter in_start, in_iter in_end)
virtual bool isVirtualSection() const =0
unsigned getAlignment() const
.type _foo, STT_TLS # aka
virtual void EmitLabel(MCSymbol *Symbol)
.code32 (X86) / .code 32 (ARM)
.type _foo, STT_COMMON # aka
MCSectionData * SectionData
virtual void FinishImpl()
FinishImpl - Streamer specific finalization.
.type _foo, STT_FUNC # aka
void setAlignment(unsigned Value)
LLVM Value Representation.
MCAsmBackend - Generic interface to target specific assembler backends.
ValueT lookup(const KeyT &Val) 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"))
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
static SectionKind getText()