Index: include/llvm/MC/MCELFStreamer.h =================================================================== --- include/llvm/MC/MCELFStreamer.h +++ include/llvm/MC/MCELFStreamer.h @@ -39,7 +39,7 @@ /// \name MCStreamer Interface /// @{ - void InitSections(bool NoExecStack) override; + void InitSections(bool NoExecStack, const MCSubtargetInfo &STI) override; void ChangeSection(MCSection *Section, const MCExpr *Subsection) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc, MCFragment *F) override; Index: include/llvm/MC/MCFragment.h =================================================================== --- include/llvm/MC/MCFragment.h +++ include/llvm/MC/MCFragment.h @@ -306,6 +306,10 @@ /// cannot be satisfied in this width then this fragment is ignored. unsigned MaxBytesToEmit; + /// MCSubtargetInfo - When emitting Nops some subtargets have specific + /// nop encodings. + const MCSubtargetInfo *STI; + public: MCAlignFragment(unsigned Alignment, int64_t Value, unsigned ValueSize, unsigned MaxBytesToEmit, MCSection *Sec = nullptr) @@ -324,10 +328,16 @@ unsigned getMaxBytesToEmit() const { return MaxBytesToEmit; } bool hasEmitNops() const { return EmitNops; } - void setEmitNops(bool Value) { EmitNops = Value; } + + const MCSubtargetInfo *getSubtargetInfo() const { return STI; } /// @} + void setEmitNops(const MCSubtargetInfo *STI) { + EmitNops = true; + this->STI = STI; + } + static bool classof(const MCFragment *F) { return F->getKind() == MCFragment::FT_Align; } Index: include/llvm/MC/MCObjectStreamer.h =================================================================== --- include/llvm/MC/MCObjectStreamer.h +++ include/llvm/MC/MCObjectStreamer.h @@ -121,7 +121,7 @@ void EmitValueToAlignment(unsigned ByteAlignment, int64_t Value = 0, unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0) override; - void EmitCodeAlignment(unsigned ByteAlignment, + void EmitCodeAlignment(unsigned ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit = 0) override; void emitValueToOffset(const MCExpr *Offset, unsigned char Value, SMLoc Loc) override; Index: include/llvm/MC/MCStreamer.h =================================================================== --- include/llvm/MC/MCStreamer.h +++ include/llvm/MC/MCStreamer.h @@ -416,7 +416,7 @@ } /// Create the default sections and set the initial one. - virtual void InitSections(bool NoExecStack); + virtual void InitSections(bool NoExecStack, const MCSubtargetInfo &STI); MCSymbol *endSection(MCSection *Section); @@ -741,10 +741,12 @@ /// /// \param ByteAlignment - The alignment to reach. This must be a power of /// two on some targets. + /// \param STI - The MCSubtargetInfo in operation when padding is emitted. /// \param MaxBytesToEmit - The maximum numbers of bytes to emit, or 0. If /// the alignment cannot be reached in this many bytes, no bytes are /// emitted. virtual void EmitCodeAlignment(unsigned ByteAlignment, + const MCSubtargetInfo *STI, unsigned MaxBytesToEmit = 0); /// Emit some number of copies of \p Value until the byte offset \p Index: include/llvm/MC/MCWinCOFFStreamer.h =================================================================== --- include/llvm/MC/MCWinCOFFStreamer.h +++ include/llvm/MC/MCWinCOFFStreamer.h @@ -40,7 +40,7 @@ /// \name MCStreamer interface /// \{ - void InitSections(bool NoExecStack) override; + void InitSections(bool NoExecStack, const MCSubtargetInfo &STI) override; void EmitLabel(MCSymbol *Symbol, SMLoc Loc = SMLoc()) override; void EmitAssemblerFlag(MCAssemblerFlag Flag) override; void EmitThumbFunc(MCSymbol *Func) override; Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -251,7 +251,13 @@ const_cast(getObjFileLowering()) .Initialize(OutContext, TM); - OutStreamer->InitSections(false); + // We're at the module level. Construct MCSubtarget from the default CPU + // and target triple. + std::unique_ptr STI(TM.getTarget().createMCSubtargetInfo( + TM.getTargetTriple().str(), TM.getTargetCPU(), + TM.getTargetFeatureString())); + + OutStreamer->InitSections(false, OutContext.getSubtargetCopy(*STI)); // Emit the version-min deployment target directive if needed. // @@ -283,11 +289,6 @@ // Emit module-level inline asm if it exists. if (!M.getModuleInlineAsm().empty()) { - // We're at the module level. Construct MCSubtarget from the default CPU - // and target triple. - std::unique_ptr STI(TM.getTarget().createMCSubtargetInfo( - TM.getTargetTriple().str(), TM.getTargetCPU(), - TM.getTargetFeatureString())); OutStreamer->AddComment("Start of file scope inline assembly"); OutStreamer->AddBlankLine(); EmitInlineAsm(M.getModuleInlineAsm()+"\n", @@ -2079,8 +2080,15 @@ assert(NumBits < static_cast(std::numeric_limits::digits) && "undefined behavior"); - if (getCurrentSection()->getKind().isText()) - OutStreamer->EmitCodeAlignment(1u << NumBits); + + if (getCurrentSection()->getKind().isText()) { + const MCSubtargetInfo *STI = nullptr; + if (this->MF) + STI = &getSubtargetInfo(); + else + STI = TM.getMCSubtargetInfo(); + OutStreamer->EmitCodeAlignment(1u << NumBits, STI); + } else OutStreamer->EmitValueToAlignment(1u << NumBits); } @@ -3076,7 +3084,7 @@ // Each entry here will be 2 * word size aligned, as we're writing down two // pointers. This should work for both 32-bit and 64-bit platforms. OutStreamer->SwitchSection(FnSledIndex); - OutStreamer->EmitCodeAlignment(2 * WordSizeBytes); + OutStreamer->EmitCodeAlignment(2 * WordSizeBytes, &getSubtargetInfo()); OutStreamer->EmitSymbolValue(SledsStart, WordSizeBytes, false); OutStreamer->EmitSymbolValue(SledsEnd, WordSizeBytes, false); OutStreamer->SwitchSection(PrevSection); Index: lib/MC/ConstantPools.cpp =================================================================== --- lib/MC/ConstantPools.cpp +++ lib/MC/ConstantPools.cpp @@ -29,7 +29,7 @@ return; Streamer.EmitDataRegion(MCDR_DataRegion); for (const ConstantPoolEntry &Entry : Entries) { - Streamer.EmitCodeAlignment(Entry.Size); // align naturally + Streamer.EmitValueToAlignment(Entry.Size); // align naturally Streamer.EmitLabel(Entry.Label); Streamer.EmitValue(Entry.Value, Entry.Size, Entry.Loc); } Index: lib/MC/MCAsmStreamer.cpp =================================================================== --- lib/MC/MCAsmStreamer.cpp +++ lib/MC/MCAsmStreamer.cpp @@ -216,7 +216,7 @@ unsigned ValueSize = 1, unsigned MaxBytesToEmit = 0) override; - void EmitCodeAlignment(unsigned ByteAlignment, + void EmitCodeAlignment(unsigned ByteAlignment, const MCSubtargetInfo *STI, unsigned MaxBytesToEmit = 0) override; void emitValueToOffset(const MCExpr *Offset, @@ -1106,6 +1106,7 @@ } void MCAsmStreamer::EmitCodeAlignment(unsigned ByteAlignment, + const MCSubtargetInfo *STI, unsigned MaxBytesToEmit) { // Emit with a text fill value. EmitValueToAlignment(ByteAlignment, MAI->getTextAlignFillValue(), Index: lib/MC/MCELFStreamer.cpp =================================================================== --- lib/MC/MCELFStreamer.cpp +++ lib/MC/MCELFStreamer.cpp @@ -88,10 +88,10 @@ DF->getContents().append(EF->getContents().begin(), EF->getContents().end()); } -void MCELFStreamer::InitSections(bool NoExecStack) { +void MCELFStreamer::InitSections(bool NoExecStack, const MCSubtargetInfo &STI) { MCContext &Ctx = getContext(); SwitchSection(Ctx.getObjectFileInfo()->getTextSection()); - EmitCodeAlignment(4); + EmitCodeAlignment(4, &STI); if (NoExecStack) SwitchSection(Ctx.getAsmInfo()->getNonexecutableStackSection(Ctx)); Index: lib/MC/MCObjectStreamer.cpp =================================================================== --- lib/MC/MCObjectStreamer.cpp +++ lib/MC/MCObjectStreamer.cpp @@ -520,9 +520,10 @@ } void MCObjectStreamer::EmitCodeAlignment(unsigned ByteAlignment, + const MCSubtargetInfo *STI, unsigned MaxBytesToEmit) { EmitValueToAlignment(ByteAlignment, 0, 1, MaxBytesToEmit); - cast(getCurrentFragment())->setEmitNops(true); + cast(getCurrentFragment())->setEmitNops(STI); } void MCObjectStreamer::emitValueToOffset(const MCExpr *Offset, Index: lib/MC/MCParser/AsmParser.cpp =================================================================== --- lib/MC/MCParser/AsmParser.cpp +++ lib/MC/MCParser/AsmParser.cpp @@ -854,7 +854,7 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { // Create the initial section, if requested. if (!NoInitialTextSection) - Out.InitSections(false); + Out.InitSections(false, getTargetParser().getSTI()); // Prime the lexer. Lex(); @@ -963,7 +963,7 @@ bool AsmParser::checkForValidSection() { if (!ParsingInlineAsm && !getStreamer().getCurrentSectionOnly()) { - Out.InitSections(false); + Out.InitSections(false, getTargetParser().getSTI()); return Error(getTok().getLoc(), "expected section directive before assembly directive"); } @@ -3282,7 +3282,8 @@ bool UseCodeAlign = Section->UseCodeAlign(); if ((!HasFillExpr || Lexer.getMAI().getTextAlignFillValue() == FillExpr) && ValueSize == 1 && UseCodeAlign) { - getStreamer().EmitCodeAlignment(Alignment, MaxBytesToFill); + getStreamer().EmitCodeAlignment(Alignment, &getTargetParser().getSTI(), + MaxBytesToFill); } else { // FIXME: Target specific behavior about how the "extra" bytes are filled. getStreamer().EmitValueToAlignment(Alignment, FillExpr, ValueSize, Index: lib/MC/MCStreamer.cpp =================================================================== --- lib/MC/MCStreamer.cpp +++ lib/MC/MCStreamer.cpp @@ -324,7 +324,7 @@ MCSymbol *EHSymbol) { } -void MCStreamer::InitSections(bool NoExecStack) { +void MCStreamer::InitSections(bool NoExecStack, const MCSubtargetInfo &STI) { SwitchSection(getContext().getObjectFileInfo()->getTextSection()); } @@ -1011,6 +1011,7 @@ unsigned ValueSize, unsigned MaxBytesToEmit) {} void MCStreamer::EmitCodeAlignment(unsigned ByteAlignment, + const MCSubtargetInfo *STI, unsigned MaxBytesToEmit) {} void MCStreamer::emitValueToOffset(const MCExpr *Offset, unsigned char Value, SMLoc Loc) {} Index: lib/MC/MCWinCOFFStreamer.cpp =================================================================== --- lib/MC/MCWinCOFFStreamer.cpp +++ lib/MC/MCWinCOFFStreamer.cpp @@ -67,18 +67,18 @@ DF->getContents().append(Code.begin(), Code.end()); } -void MCWinCOFFStreamer::InitSections(bool NoExecStack) { +void MCWinCOFFStreamer::InitSections(bool NoExecStack, const MCSubtargetInfo &STI) { // FIXME: this is identical to the ELF one. // 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); + EmitCodeAlignment(4, &STI); SwitchSection(getContext().getObjectFileInfo()->getDataSection()); - EmitCodeAlignment(4); + EmitCodeAlignment(4, &STI); SwitchSection(getContext().getObjectFileInfo()->getBSSSection()); - EmitCodeAlignment(4); + EmitCodeAlignment(4, &STI); SwitchSection(getContext().getObjectFileInfo()->getTextSection()); } Index: lib/Target/AArch64/AArch64AsmPrinter.cpp =================================================================== --- lib/Target/AArch64/AArch64AsmPrinter.cpp +++ lib/Target/AArch64/AArch64AsmPrinter.cpp @@ -191,7 +191,7 @@ // ;DATA: higher 32 bits of the address of the trampoline // LDP X0, X30, [SP], #16 ; pop X0 and the link register from the stack // - OutStreamer->EmitCodeAlignment(4); + OutStreamer->EmitCodeAlignment(4, &getSubtargetInfo()); auto CurSled = OutContext.createTempSymbol("xray_sled_", true); OutStreamer->EmitLabel(CurSled); auto Target = OutContext.createTempSymbol(); Index: lib/Target/ARM/ARMAsmPrinter.cpp =================================================================== --- lib/Target/ARM/ARMAsmPrinter.cpp +++ lib/Target/ARM/ARMAsmPrinter.cpp @@ -1627,7 +1627,7 @@ // FIXME: Ideally we could vary the LDRB index based on the padding // between the sequence and jump table, however that relies on MCExprs // for load indexes which are currently not supported. - OutStreamer->EmitCodeAlignment(4); + OutStreamer->EmitCodeAlignment(4, &getSubtargetInfo()); EmitToStreamer(*OutStreamer, MCInstBuilder(ARM::tADDhirr) .addReg(Idx) .addReg(Idx) Index: lib/Target/ARM/ARMMCInstLower.cpp =================================================================== --- lib/Target/ARM/ARMMCInstLower.cpp +++ lib/Target/ARM/ARMMCInstLower.cpp @@ -195,7 +195,7 @@ // BLX ip // POP{ r0, lr } // - OutStreamer->EmitCodeAlignment(4); + OutStreamer->EmitCodeAlignment(4, &getSubtargetInfo()); auto CurSled = OutContext.createTempSymbol("xray_sled_", true); OutStreamer->EmitLabel(CurSled); auto Target = OutContext.createTempSymbol(); Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp =================================================================== --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -10119,13 +10119,13 @@ return true; if (!Section) { - getStreamer().InitSections(false); + getStreamer().InitSections(false, getSTI()); Section = getStreamer().getCurrentSectionOnly(); } assert(Section && "must have section to emit alignment"); if (Section->UseCodeAlign()) - getStreamer().EmitCodeAlignment(2); + getStreamer().EmitCodeAlignment(2, &getSTI()); else getStreamer().EmitValueToAlignment(2); @@ -10327,7 +10327,7 @@ const MCSection *Section = getStreamer().getCurrentSectionOnly(); assert(Section && "must have section to emit alignment"); if (Section->UseCodeAlign()) - getStreamer().EmitCodeAlignment(4, 0); + getStreamer().EmitCodeAlignment(4, &getSTI(), 0); else getStreamer().EmitValueToAlignment(4, 0, 1, 0); return false; Index: lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp =================================================================== --- lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp +++ lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp @@ -1218,7 +1218,7 @@ // Switch to .ARM.extab or .ARM.exidx section SwitchSection(EHSection); - EmitCodeAlignment(4); + EmitValueToAlignment(4, 0, 1, 0); } inline void ARMELFStreamer::SwitchToExTabSection(const MCSymbol &FnStart) { Index: lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp =================================================================== --- lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp +++ lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp @@ -1488,7 +1488,7 @@ MES->SwitchSection(mySection); unsigned byteSize = is32bit ? 4 : 8; - getStreamer().EmitCodeAlignment(byteSize, byteSize); + getStreamer().EmitCodeAlignment(byteSize, &getSTI(), byteSize); MCSymbol *Sym; Index: lib/Target/Hexagon/HexagonAsmPrinter.cpp =================================================================== --- lib/Target/Hexagon/HexagonAsmPrinter.cpp +++ lib/Target/Hexagon/HexagonAsmPrinter.cpp @@ -187,7 +187,7 @@ static MCSymbol *smallData(AsmPrinter &AP, const MachineInstr &MI, MCStreamer &OutStreamer, const MCOperand &Imm, - int AlignSize) { + int AlignSize, const MCSubtargetInfo& STI) { MCSymbol *Sym; int64_t Value; if (Imm.getExpr()->evaluateAsAbsolute(Value)) { @@ -217,7 +217,7 @@ OutStreamer.EmitLabel(Sym); OutStreamer.EmitSymbolAttribute(Sym, MCSA_Global); OutStreamer.EmitIntValue(Value, AlignSize); - OutStreamer.EmitCodeAlignment(AlignSize); + OutStreamer.EmitCodeAlignment(AlignSize, &STI); } } else { assert(Imm.isExpr() && "Expected expression and found none"); @@ -245,7 +245,7 @@ OutStreamer.EmitLabel(Sym); OutStreamer.EmitSymbolAttribute(Sym, MCSA_Local); OutStreamer.EmitValue(Imm.getExpr(), AlignSize); - OutStreamer.EmitCodeAlignment(AlignSize); + OutStreamer.EmitCodeAlignment(AlignSize, &STI); } } return Sym; @@ -335,8 +335,7 @@ if (!OutStreamer->hasRawTextSupport()) { const MCOperand &Imm = MappedInst.getOperand(1); MCSectionSubPair Current = OutStreamer->getCurrentSection(); - - MCSymbol *Sym = smallData(*this, MI, *OutStreamer, Imm, 8); + MCSymbol *Sym = smallData(*this, MI, *OutStreamer, Imm, 8, getSubtargetInfo()); OutStreamer->SwitchSection(Current.first, Current.second); MCInst TmpInst; @@ -353,7 +352,7 @@ if (!OutStreamer->hasRawTextSupport()) { MCOperand &Imm = MappedInst.getOperand(1); MCSectionSubPair Current = OutStreamer->getCurrentSection(); - MCSymbol *Sym = smallData(*this, MI, *OutStreamer, Imm, 4); + MCSymbol *Sym = smallData(*this, MI, *OutStreamer, Imm, 4, getSubtargetInfo()); OutStreamer->SwitchSection(Current.first, Current.second); MCInst TmpInst; MCOperand &Reg = MappedInst.getOperand(0); Index: lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp =================================================================== --- lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp +++ lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp @@ -880,7 +880,7 @@ if (Alignment) { OS.SwitchSection(&Section); if (Section.UseCodeAlign()) - OS.EmitCodeAlignment(Alignment, Alignment); + OS.EmitCodeAlignment(Alignment, &STI, Alignment); else OS.EmitValueToAlignment(Alignment, 0, 1, Alignment); } Index: lib/Target/Mips/MipsAsmPrinter.cpp =================================================================== --- lib/Target/Mips/MipsAsmPrinter.cpp +++ lib/Target/Mips/MipsAsmPrinter.cpp @@ -1152,7 +1152,7 @@ // LD RA, 8(SP) // DADDIU SP, SP, 16 // - OutStreamer->EmitCodeAlignment(4); + OutStreamer->EmitCodeAlignment(4, &getSubtargetInfo()); auto CurSled = OutContext.createTempSymbol("xray_sled_", true); OutStreamer->EmitLabel(CurSled); auto Target = OutContext.createTempSymbol(); Index: lib/Target/PowerPC/PPCAsmPrinter.cpp =================================================================== --- lib/Target/PowerPC/PPCAsmPrinter.cpp +++ lib/Target/PowerPC/PPCAsmPrinter.cpp @@ -1197,7 +1197,7 @@ // // Update compiler-rt/lib/xray/xray_powerpc64.cc accordingly when number // of instructions change. - OutStreamer->EmitCodeAlignment(8); + OutStreamer->EmitCodeAlignment(8, &getSubtargetInfo()); MCSymbol *BeginOfSled = OutContext.createTempSymbol(); OutStreamer->EmitLabel(BeginOfSled); EmitToStreamer(*OutStreamer, RetInst); Index: lib/Target/X86/AsmParser/X86AsmParser.cpp =================================================================== --- lib/Target/X86/AsmParser/X86AsmParser.cpp +++ lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -3332,11 +3332,11 @@ const MCSection *Section = getStreamer().getCurrentSectionOnly(); if (!Section) { - getStreamer().InitSections(false); + getStreamer().InitSections(false, getSTI()); Section = getStreamer().getCurrentSectionOnly(); } if (Section->UseCodeAlign()) - getStreamer().EmitCodeAlignment(2, 0); + getStreamer().EmitCodeAlignment(2, &getSTI(), 0); else getStreamer().EmitValueToAlignment(2, 0, 1, 0); return false; Index: lib/Target/X86/X86MCInstLower.cpp =================================================================== --- lib/Target/X86/X86MCInstLower.cpp +++ lib/Target/X86/X86MCInstLower.cpp @@ -1111,7 +1111,7 @@ // First we emit the label and the jump. auto CurSled = OutContext.createTempSymbol("xray_event_sled_", true); OutStreamer->AddComment("# XRay Custom Event Log"); - OutStreamer->EmitCodeAlignment(2); + OutStreamer->EmitCodeAlignment(2, &getSubtargetInfo()); OutStreamer->EmitLabel(CurSled); // Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as @@ -1202,7 +1202,7 @@ // First we emit the label and the jump. auto CurSled = OutContext.createTempSymbol("xray_typed_event_sled_", true); OutStreamer->AddComment("# XRay Typed Event Log"); - OutStreamer->EmitCodeAlignment(2); + OutStreamer->EmitCodeAlignment(2, &getSubtargetInfo()); OutStreamer->EmitLabel(CurSled); // Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as @@ -1288,7 +1288,7 @@ // call // 5 bytes // auto CurSled = OutContext.createTempSymbol("xray_sled_", true); - OutStreamer->EmitCodeAlignment(2); + OutStreamer->EmitCodeAlignment(2, &getSubtargetInfo()); OutStreamer->EmitLabel(CurSled); // Use a two-byte `jmp`. This version of JMP takes an 8-bit relative offset as @@ -1316,7 +1316,7 @@ // // This just makes sure that the alignment for the next instruction is 2. auto CurSled = OutContext.createTempSymbol("xray_sled_", true); - OutStreamer->EmitCodeAlignment(2); + OutStreamer->EmitCodeAlignment(2, &getSubtargetInfo()); OutStreamer->EmitLabel(CurSled); unsigned OpCode = MI.getOperand(0).getImm(); MCInst Ret; @@ -1338,7 +1338,7 @@ // the PATCHABLE_FUNCTION_ENTER case, followed by the lowering of the actual // tail call much like how we have it in PATCHABLE_RET. auto CurSled = OutContext.createTempSymbol("xray_sled_", true); - OutStreamer->EmitCodeAlignment(2); + OutStreamer->EmitCodeAlignment(2, &getSubtargetInfo()); OutStreamer->EmitLabel(CurSled); auto Target = OutContext.createTempSymbol(); Index: tools/llvm-mc/Disassembler.cpp =================================================================== --- tools/llvm-mc/Disassembler.cpp +++ tools/llvm-mc/Disassembler.cpp @@ -161,7 +161,7 @@ } // Set up initial section manually here - Streamer.InitSections(false); + Streamer.InitSections(false, STI); bool ErrorOccurred = false; Index: tools/llvm-mc/llvm-mc.cpp =================================================================== --- tools/llvm-mc/llvm-mc.cpp +++ tools/llvm-mc/llvm-mc.cpp @@ -499,7 +499,7 @@ MCOptions.MCIncrementalLinkerCompatible, /*DWARFMustBeAtTheEnd*/ false)); if (NoExecStack) - Str->InitSections(true); + Str->InitSections(true, *STI); } // Use Assembler information for parsing.