42 inline void MCELFStreamer::SetSectionData() {
45 ELF::SHF_WRITE | ELF::SHF_ALLOC,
50 inline void MCELFStreamer::SetSectionText() {
53 ELF::SHF_EXECINSTR | ELF::SHF_ALLOC,
58 inline void MCELFStreamer::SetSectionBss() {
61 ELF::SHF_WRITE | ELF::SHF_ALLOC,
83 assert(Symbol->
isUndefined() &&
"Cannot define a symbol twice!");
90 if (Section.
getFlags() & ELF::SHF_TLS)
113 const MCExpr *Subsection) {
142 if (T1 == TypeOrdering[i])
144 if (T2 == TypeOrdering[i])
195 BindingExplicitlySet.insert(Symbol);
202 BindingExplicitlySet.insert(Symbol);
208 BindingExplicitlySet.insert(Symbol);
262 if (!BindingExplicitlySet.count(Symbol)) {
278 struct LocalCommon L = {&SD, Size, ByteAlignment};
279 LocalCommons.push_back(L);
298 BindingExplicitlySet.insert(Symbol);
305 fixSymbolsInTLSFixups(Value);
312 unsigned MaxBytesToEmit) {
316 ValueSize, MaxBytesToEmit);
328 ".comment", ELF::SHT_PROGBITS, ELF::SHF_MERGE | ELF::SHF_STRINGS,
341 void MCELFStreamer::fixSymbolsInTLSFixups(
const MCExpr *expr) {
344 cast<MCTargetExpr>(expr)->fixELFSymbolsInTLSFixups(
getAssembler());
351 fixSymbolsInTLSFixups(be->
getLHS());
352 fixSymbolsInTLSFixups(be->
getRHS());
421 fixSymbolsInTLSFixups(cast<MCUnaryExpr>(expr)->getSubExpr());
426 void MCELFStreamer::EmitInstToFragment(
const MCInst &Inst) {
430 for (
unsigned i = 0, e = F.
getFixups().size(); i != e; ++i)
431 fixSymbolsInTLSFixups(F.
getFixups()[i].getValue());
434 void MCELFStreamer::EmitInstToData(
const MCInst &Inst) {
442 for (
unsigned i = 0, e = Fixups.
size(); i != e; ++i)
443 fixSymbolsInTLSFixups(Fixups[i].getValue());
494 for (
unsigned i = 0, e = Fixups.
size(); i != e; ++i) {
502 void MCELFStreamer::EmitBundleAlignMode(
unsigned AlignPow2) {
503 assert(AlignPow2 <= 30 &&
"Invalid bundle alignment");
511 void MCELFStreamer::EmitBundleLock(
bool AlignToEnd) {
526 void MCELFStreamer::EmitBundleUnlock() {
541 for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
542 e = LocalCommons.end();
545 uint64_t Size = i->Size;
561 LocalCommons.clear();
void setExternal(bool Value)
void setFlags(uint32_t Value)
setFlags - Set the (implementation defined) symbol flags.
const MCSymbol & getSymbol() const
virtual void InitToTextSection()
InitToTextSection - Create a text section and switch the streamer to it.
bool isBundleLocked() const
.type _foo, STT_OBJECT # aka
static const MCConstantExpr * Create(int64_t Value, MCContext &Ctx)
void setBundleLockState(BundleLockStateType NewState)
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size)
const MCSectionELF * getELFSection(StringRef Section, unsigned Type, unsigned Flags, SectionKind Kind)
static SectionKind getDataRel()
unsigned getBundleAlignSize() const
unsigned getFlags() const
virtual void EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment)
void EmitFrames(MCAsmBackend *MAB, bool usingCFI)
MCCodeEmitter & getEmitter() const
virtual SmallVectorImpl< char > & getContents()
void setBundleGroupBeforeFirstInst(bool IsFirst)
virtual void EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol)
static void SetType(MCSymbolData &SD, unsigned Type)
std::vector< IndirectSymbolData > & getIndirectSymbols()
.type _foo, STT_NOTYPE # aka
virtual void ChangeSection(const MCSection *Section, const MCExpr *Subsection)
COFF::SymbolStorageClass StorageClass
MCContext & getContext() const
static unsigned CombineSymbolTypes(unsigned T1, unsigned T2)
virtual void EmitValueToAlignment(unsigned, int64_t, unsigned, unsigned)
const MCSymbol & getSymbol() const
MCStreamer * createELFStreamer(MCContext &Ctx, MCTargetStreamer *TargetStreamer, MCAsmBackend &TAB, raw_ostream &OS, MCCodeEmitter *CE, bool RelaxAll, bool NoExecStack)
static void SetVisibility(MCSymbolData &SD, unsigned Visibility)
BundleLockStateType getBundleLockState() const
LLVM_ATTRIBUTE_NORETURN void report_fatal_error(const char *reason, bool gen_crash_diag=true)
virtual void EmitValueImpl(const MCExpr *Value, unsigned Size)
MCFragment * getCurrentFragment() const
virtual void EmitCOFFSymbolStorageClass(int StorageClass)
SmallVectorImpl< MCFixup > & getFixups()
static SectionKind getBSS()
void insert(MCFragment *F) const
const MCSection & getSection() const
virtual void FinishImpl()
FinishImpl - Streamer specific finalization.
#define llvm_unreachable(msg)
void AssignSection(MCSymbol *Symbol, const MCSection *Section)
void setRelaxAll(bool Value)
virtual void ChangeSection(const MCSection *Section, const MCExpr *Subsection)
virtual void EmitZerofill(const MCSection *Section, MCSymbol *Symbol=0, uint64_t Size=0, unsigned ByteAlignment=0)
virtual void EmitCodeAlignment(unsigned ByteAlignment, unsigned MaxBytesToEmit=0)
static unsigned GetType(const MCSymbolData &SD)
MCContext & getContext() const
virtual void EmitAssemblerFlag(MCAssemblerFlag Flag)
EmitAssemblerFlag - Note in the output the specified Flag.
void setSubsectionsViaSymbols(bool Value)
void SwitchSection(const MCSection *Section, const MCExpr *Subsection=0)
size_t array_lengthof(T(&)[N])
Find the length of an array.
.code16 (X86) / .code 16 (ARM)
MCDataFragment * getOrCreateDataFragment() const
.type _foo, STT_GNU_IFUNC
virtual void EncodeInstruction(const MCInst &Inst, raw_ostream &OS, SmallVectorImpl< MCFixup > &Fixups) const =0
void setBundleAlignSize(unsigned Size)
virtual void EmitIntValue(uint64_t Value, unsigned Size)
virtual void EmitIdent(StringRef IdentString)
static const MCSymbolRefExpr * Create(const MCSymbol *Symbol, MCContext &Ctx)
static void SetBinding(MCSymbolData &SD, unsigned Binding)
const MCExpr * getLHS() const
getLHS - Get the left-hand side expression of the binary operator.
.weak_def_can_be_hidden (MachO)
void setNoExecStack(bool Value)
virtual void InitSections()
InitSections - Create the default sections and set the initial one.
virtual void EmitTBSSSymbol(const MCSection *Section, MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment=0)
MCAssembler & getAssembler()
uint32_t getFlags() const
getFlags - Get the (implementation defined) symbol flags.
void setCommon(uint64_t Size, unsigned Align)
MCCodeEmitter - Generic instruction encoding interface.
virtual void EmitELFSize(MCSymbol *Symbol, const MCExpr *Value)
virtual void setHasInstructions(bool V)
virtual void BeginCOFFSymbolDef(const MCSymbol *Symbol)
.subsections_via_symbols (MachO)
virtual SmallVectorImpl< char > & getContents()
void append(in_iter in_start, in_iter in_end)
MCBinaryExpr - Binary assembler expressions.
virtual void EmitInstToFragment(const MCInst &Inst)
Emit an instruction to a special fragment, because this instruction can change its size during relaxa...
MCSymbolData & getOrCreateSymbolData(const MCSymbol &Symbol, bool *Created=0)
virtual void EmitBytes(StringRef Data)
virtual void EmitFileDirective(StringRef Filename)
MCSymbolData & getSymbolData(const MCSymbol &Symbol) const
virtual void EndCOFFSymbolDef()
EndCOFFSymbolDef - Marks the end of the symbol definition.
virtual void EmitCOFFSymbolType(int Type)
virtual void setAlignToBundleEnd(bool V)
bool isBundlingEnabled() const
unsigned getAlignment() const
.type _foo, STT_TLS # aka
virtual void EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue)
virtual void EmitLabel(MCSymbol *Symbol)
virtual bool EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute)
EmitSymbolAttribute - Add the given Attribute to Symbol.
void setVariableValue(const MCExpr *Value)
void addFileName(StringRef FileName)
virtual void EmitDebugLabel(MCSymbol *Symbol)
virtual void EmitLabel(MCSymbol *Symbol)
void setSize(const MCExpr *SS)
.code32 (X86) / .code 32 (ARM)
const MCExpr * getRHS() const
getRHS - Get the right-hand side expression of the binary operator.
.type _foo, STT_COMMON # aka
MCSectionData * SectionData
virtual void EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlignment)
MCSectionData & getOrCreateSectionData(const MCSection &Section, bool *Created=0)
static unsigned GetBinding(const MCSymbolData &SD)
virtual MCSymbolData & getOrCreateSymbolData(MCSymbol *Symbol)
getOrCreateSymbolData - Get symbol data for given symbol.
virtual void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value=0, unsigned ValueSize=1, unsigned MaxBytesToEmit=0)
virtual void FinishImpl()
FinishImpl - Streamer specific finalization.
.type _foo, STT_FUNC # aka
void setFragment(MCFragment *Value)
References to labels and assigned expressions.
void setAlignment(unsigned Value)
VariantKind getKind() const
LLVM Value Representation.
MCAsmBackend - Generic interface to target specific assembler backends.
virtual void Flush()
Flush - Causes any cached state to be written out.
cl::opt< bool > RelaxAll("mc-relax-all", cl::desc("When used with filetype=obj, ""relax all fixups in the emitted object file"))
MCSectionData * getCurrentSectionData() const
bool isUndefined() const
isUndefined - Check if this symbol undefined (i.e., implicitly defined).
virtual void EmitThumbFunc(MCSymbol *Func)
Target specific expression.
static SectionKind getReadOnly()
SmallVectorImpl< MCFixup > & getFixups()
bool isBundleGroupBeforeFirstInst() const
static SectionKind getText()