using namespace llvm;
-inline void MCELFStreamer::SetSectionData() {
- SwitchSection(getContext().getObjectFileInfo()->getDataSection());
- EmitCodeAlignment(4, 0);
-}
-
-inline void MCELFStreamer::SetSectionText() {
- SwitchSection(getContext().getObjectFileInfo()->getTextSection());
- EmitCodeAlignment(4, 0);
-}
-
-inline void MCELFStreamer::SetSectionBss() {
- SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
- EmitCodeAlignment(4, 0);
-}
-
MCELFStreamer::~MCELFStreamer() {
}
void MCELFStreamer::InitSections() {
// This emulates the same behavior of GNU as. This makes it easier
// to compare the output as the major sections are in the same order.
- SetSectionText();
- SetSectionData();
- SetSectionBss();
- SetSectionText();
+ SwitchSection(getContext().getObjectFileInfo()->getTextSection());
+ EmitCodeAlignment(4);
+
+ SwitchSection(getContext().getObjectFileInfo()->getDataSection());
+ EmitCodeAlignment(4);
+
+ SwitchSection(getContext().getObjectFileInfo()->getBSSSection());
+ EmitCodeAlignment(4);
+
+ SwitchSection(getContext().getObjectFileInfo()->getTextSection());
}
void MCELFStreamer::EmitLabel(MCSymbol *Symbol) {
void MCELFStreamer::EmitWeakReference(MCSymbol *Alias, const MCSymbol *Symbol) {
getAssembler().getOrCreateSymbolData(*Symbol);
- MCSymbolData &AliasSD = getAssembler().getOrCreateSymbolData(*Alias);
- AliasSD.setFlags(AliasSD.getFlags() | ELF_Other_Weakref);
- const MCExpr *Value = MCSymbolRefExpr::Create(Symbol, getContext());
+ const MCExpr *Value = MCSymbolRefExpr::Create(
+ Symbol, MCSymbolRefExpr::VK_WEAKREF, getContext());
Alias->setVariableValue(Value);
}
}
}
-void MCELFStreamer::EmitInstToFragment(const MCInst &Inst) {
- this->MCObjectStreamer::EmitInstToFragment(Inst);
+void MCELFStreamer::EmitInstToFragment(const MCInst &Inst,
+ const MCSubtargetInfo &STI) {
+ this->MCObjectStreamer::EmitInstToFragment(Inst, STI);
MCRelaxableFragment &F = *cast<MCRelaxableFragment>(getCurrentFragment());
for (unsigned i = 0, e = F.getFixups().size(); i != e; ++i)
fixSymbolsInTLSFixups(F.getFixups()[i].getValue());
}
-void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
+void MCELFStreamer::EmitInstToData(const MCInst &Inst,
+ const MCSubtargetInfo &STI) {
MCAssembler &Assembler = getAssembler();
SmallVector<MCFixup, 4> Fixups;
SmallString<256> Code;
raw_svector_ostream VecOS(Code);
- Assembler.getEmitter().EncodeInstruction(Inst, VecOS, Fixups);
+ Assembler.getEmitter().EncodeInstruction(Inst, VecOS, Fixups, STI);
VecOS.flush();
for (unsigned i = 0, e = Fixups.size(); i != e; ++i)
this->MCObjectStreamer::FinishImpl();
}
-MCStreamer *llvm::createELFStreamer(MCContext &Context,
- MCTargetStreamer *Streamer,
- MCAsmBackend &MAB, raw_ostream &OS,
- MCCodeEmitter *CE, bool RelaxAll,
- bool NoExecStack) {
- MCELFStreamer *S = new MCELFStreamer(Context, Streamer, MAB, OS, CE);
+MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
+ raw_ostream &OS, MCCodeEmitter *CE,
+ bool RelaxAll, bool NoExecStack) {
+ MCELFStreamer *S = new MCELFStreamer(Context, MAB, OS, CE);
if (RelaxAll)
S->getAssembler().setRelaxAll(true);
if (NoExecStack)
llvm_unreachable("Generic ELF doesn't support this directive");
}
-MCSymbolData &MCELFStreamer::getOrCreateSymbolData(MCSymbol *Symbol) {
+MCSymbolData &MCELFStreamer::getOrCreateSymbolData(const MCSymbol *Symbol) {
return getAssembler().getOrCreateSymbolData(*Symbol);
}