X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FMCELFStreamer.cpp;h=7c70540dd5b9d08e8ff5375f40288f01583b152d;hb=049ffbbdf2a43d5529cb56b6bb696d20d28ff217;hp=8c9ad632135cee8d84d5d3bd001642a10ecc08f8;hpb=a1f7c26cc8028c73842065e33f0acdee40cf868d;p=oota-llvm.git diff --git a/lib/MC/MCELFStreamer.cpp b/lib/MC/MCELFStreamer.cpp index 8c9ad632135..7c70540dd5b 100644 --- a/lib/MC/MCELFStreamer.cpp +++ b/lib/MC/MCELFStreamer.cpp @@ -38,17 +38,17 @@ using namespace llvm; MCELFStreamer::~MCELFStreamer() { } -void MCELFStreamer::InitSections(bool Force) { +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. SwitchSection(getContext().getObjectFileInfo()->getTextSection()); - EmitCodeAlignment(4, 0); + EmitCodeAlignment(4); SwitchSection(getContext().getObjectFileInfo()->getDataSection()); - EmitCodeAlignment(4, 0); + EmitCodeAlignment(4); SwitchSection(getContext().getObjectFileInfo()->getBSSSection()); - EmitCodeAlignment(4, 0); + EmitCodeAlignment(4); SwitchSection(getContext().getObjectFileInfo()->getTextSection()); } @@ -65,10 +65,6 @@ void MCELFStreamer::EmitLabel(MCSymbol *Symbol) { MCELF::SetType(SD, ELF::STT_TLS); } -void MCELFStreamer::EmitDebugLabel(MCSymbol *Symbol) { - EmitLabel(Symbol); -} - void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) { // Let the target do whatever target specific stuff it needs to do. getAssembler().getBackend().handleAssemblerFlag(Flag); @@ -99,9 +95,8 @@ void MCELFStreamer::ChangeSection(const MCSection *Section, 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); } @@ -276,11 +271,12 @@ void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, EmitCommonSymbol(Symbol, Size, ByteAlignment); } -void MCELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size) { +void MCELFStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size, + const SMLoc &Loc) { if (getCurrentSectionData()->isBundleLocked()) report_fatal_error("Emitting values inside a locked bundle is forbidden"); fixSymbolsInTLSFixups(Value); - MCObjectStreamer::EmitValueImpl(Value, Size); + MCObjectStreamer::EmitValueImpl(Value, Size, Loc); } void MCELFStreamer::EmitValueToAlignment(unsigned ByteAlignment, @@ -397,20 +393,22 @@ void MCELFStreamer::fixSymbolsInTLSFixups(const MCExpr *expr) { } } -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(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 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) @@ -536,19 +534,17 @@ void MCELFStreamer::Flush() { } void MCELFStreamer::FinishImpl() { - EmitFrames(NULL, true); + EmitFrames(nullptr); Flush(); 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) @@ -560,10 +556,6 @@ void MCELFStreamer::EmitThumbFunc(MCSymbol *Func) { llvm_unreachable("Generic ELF doesn't support this directive"); } -MCSymbolData &MCELFStreamer::getOrCreateSymbolData(MCSymbol *Symbol) { - return getAssembler().getOrCreateSymbolData(*Symbol); -} - void MCELFStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) { llvm_unreachable("ELF doesn't support this directive"); }