Index: include/llvm/CodeGen/AsmPrinter.h =================================================================== --- include/llvm/CodeGen/AsmPrinter.h +++ include/llvm/CodeGen/AsmPrinter.h @@ -458,6 +458,10 @@ void EmitLabelDifference(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) const; + /// Emit something like ".uleb128 Hi-Lo". + void EmitLabelDifferenceAsULEB128(const MCSymbol *Hi, + const MCSymbol *Lo) const; + /// Emit something like ".long Label+Offset" where the size in bytes of the /// directive is specified by Size and Label specifies the label. This /// implicitly uses .set if it is available. Index: include/llvm/MC/MCObjectStreamer.h =================================================================== --- include/llvm/MC/MCObjectStreamer.h +++ include/llvm/MC/MCObjectStreamer.h @@ -179,6 +179,9 @@ void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) override; + void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, + const MCSymbol *Lo) override; + bool mayHaveInstructions(MCSection &Sec) const override; }; Index: include/llvm/MC/MCStreamer.h =================================================================== --- include/llvm/MC/MCStreamer.h +++ include/llvm/MC/MCStreamer.h @@ -828,6 +828,10 @@ virtual void emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size); + /// Emit the absolute difference between two symbols encoded with ULEB128. + virtual void emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, + const MCSymbol *Lo); + virtual MCSymbol *getDwarfLineTableSymbol(unsigned CUID); virtual void EmitCFISections(bool EH, bool Debug); void EmitCFIStartProc(bool IsSimple); Index: lib/CodeGen/AsmPrinter/ARMException.cpp =================================================================== --- lib/CodeGen/AsmPrinter/ARMException.cpp +++ lib/CodeGen/AsmPrinter/ARMException.cpp @@ -91,7 +91,7 @@ ATS.emitFnEnd(); } -void ARMException::emitTypeInfos(unsigned TTypeEncoding) { +void ARMException::emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) { const MachineFunction *MF = Asm->MF; const std::vector &TypeInfos = MF->getTypeInfos(); const std::vector &FilterIds = MF->getFilterIds(); @@ -112,6 +112,8 @@ Asm->EmitTTypeReference(GV, TTypeEncoding); } + Asm->OutStreamer->EmitLabel(TTBaseLabel); + // Emit the Exception Specifications. if (VerboseAsm && !FilterIds.empty()) { Asm->OutStreamer->AddComment(">> Filter TypeInfos <<"); Index: lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -59,6 +59,12 @@ OutStreamer->EmitULEB128IntValue(Value); } +/// Emit something like ".uleb128 Hi-Lo". +void AsmPrinter::EmitLabelDifferenceAsULEB128(const MCSymbol *Hi, + const MCSymbol *Lo) const { + OutStreamer->emitAbsoluteSymbolDiffAsULEB128(Hi, Lo); +} + static const char *DecodeDWARFEncoding(unsigned Encoding) { switch (Encoding) { case dwarf::DW_EH_PE_absptr: @@ -67,6 +73,10 @@ return "omit"; case dwarf::DW_EH_PE_pcrel: return "pcrel"; + case dwarf::DW_EH_PE_uleb128: + return "uleb128"; + case dwarf::DW_EH_PE_sleb128: + return "sleb128"; case dwarf::DW_EH_PE_udata4: return "udata4"; case dwarf::DW_EH_PE_udata8: Index: lib/CodeGen/AsmPrinter/DwarfException.h =================================================================== --- lib/CodeGen/AsmPrinter/DwarfException.h +++ lib/CodeGen/AsmPrinter/DwarfException.h @@ -70,7 +70,7 @@ }; class LLVM_LIBRARY_VISIBILITY ARMException : public DwarfCFIExceptionBase { - void emitTypeInfos(unsigned TTypeEncoding) override; + void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) override; ARMTargetStreamer &getTargetStreamer(); public: Index: lib/CodeGen/AsmPrinter/EHStreamer.h =================================================================== --- lib/CodeGen/AsmPrinter/EHStreamer.h +++ lib/CodeGen/AsmPrinter/EHStreamer.h @@ -72,9 +72,9 @@ /// Compute the actions table and gather the first action index for each /// landing pad site. - unsigned computeActionsTable(const SmallVectorImpl&LPs, - SmallVectorImpl &Actions, - SmallVectorImpl &FirstActions); + void computeActionsTable(const SmallVectorImpl &LPs, + SmallVectorImpl &Actions, + SmallVectorImpl &FirstActions); void computePadMap(const SmallVectorImpl &LandingPads, RangeMapType &PadMap); @@ -110,7 +110,7 @@ /// catches in the function. This tables is reversed indexed base 1. void emitExceptionTable(); - virtual void emitTypeInfos(unsigned TTypeEncoding); + virtual void emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel); // Helpers for identifying what kind of clause an EH typeid or selector // corresponds to. Negative selectors are for filter clauses, the zero Index: lib/CodeGen/AsmPrinter/EHStreamer.cpp =================================================================== --- lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -58,7 +58,7 @@ /// Compute the actions table and gather the first action index for each landing /// pad site. -unsigned EHStreamer:: +void EHStreamer:: computeActionsTable(const SmallVectorImpl &LandingPads, SmallVectorImpl &Actions, SmallVectorImpl &FirstActions) { @@ -161,8 +161,6 @@ PrevLPI = LPI; } - - return SizeActions; } /// Return `true' if this is a call to a function marked `nounwind'. Return @@ -369,47 +367,25 @@ // landing pad site. SmallVector Actions; SmallVector FirstActions; - unsigned SizeActions = - computeActionsTable(LandingPads, Actions, FirstActions); + computeActionsTable(LandingPads, Actions, FirstActions); // Compute the call-site table. SmallVector CallSites; computeCallSiteTable(CallSites, LandingPads, FirstActions); - // Final tallies. - - // Call sites. bool IsSJLJ = Asm->MAI->getExceptionHandlingType() == ExceptionHandling::SjLj; - bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true; - - unsigned CallSiteTableLength; - if (IsSJLJ) - CallSiteTableLength = 0; - else { - unsigned SiteStartSize = 4; // dwarf::DW_EH_PE_udata4 - unsigned SiteLengthSize = 4; // dwarf::DW_EH_PE_udata4 - unsigned LandingPadSize = 4; // dwarf::DW_EH_PE_udata4 - CallSiteTableLength = - CallSites.size() * (SiteStartSize + SiteLengthSize + LandingPadSize); - } - - for (unsigned i = 0, e = CallSites.size(); i < e; ++i) { - CallSiteTableLength += getULEB128Size(CallSites[i].Action); - if (IsSJLJ) - CallSiteTableLength += getULEB128Size(i); - } + unsigned CallSiteEncoding = IsSJLJ ? dwarf::DW_EH_PE_udata4 + : dwarf::DW_EH_PE_uleb128; + bool HaveTTData = !TypeInfos.empty() || !FilterIds.empty(); // Type infos. MCSection *LSDASection = Asm->getObjFileLowering().getLSDASection(); unsigned TTypeEncoding; - unsigned TypeFormatSize; if (!HaveTTData) { - // For SjLj exceptions, if there is no TypeInfo, then we just explicitly say - // that we're omitting that bit. + // If there is no TypeInfo, then we just explicitly say that we're omitting + // that bit. TTypeEncoding = dwarf::DW_EH_PE_omit; - // dwarf::DW_EH_PE_absptr - TypeFormatSize = Asm->getDataLayout().getPointerSize(); } else { // Okay, we have actual filters or typeinfos to emit. As such, we need to // pick a type encoding for them. We're about to emit a list of pointers to @@ -439,7 +415,6 @@ // in target-independent code. // TTypeEncoding = Asm->getObjFileLowering().getTTypeEncoding(); - TypeFormatSize = Asm->GetSizeOfEncodedValue(TTypeEncoding); } // Begin the exception table. @@ -460,64 +435,35 @@ Asm->EmitEncodingByte(dwarf::DW_EH_PE_omit, "@LPStart"); Asm->EmitEncodingByte(TTypeEncoding, "@TType"); - // The type infos need to be aligned. GCC does this by inserting padding just - // before the type infos. However, this changes the size of the exception - // table, so you need to take this into account when you output the exception - // table size. However, the size is output using a variable length encoding. - // So by increasing the size by inserting padding, you may increase the number - // of bytes used for writing the size. If it increases, say by one byte, then - // you now need to output one less byte of padding to get the type infos - // aligned. However this decreases the size of the exception table. This - // changes the value you have to output for the exception table size. Due to - // the variable length encoding, the number of bytes used for writing the - // length may decrease. If so, you then have to increase the amount of - // padding. And so on. If you look carefully at the GCC code you will see that - // it indeed does this in a loop, going on and on until the values stabilize. - // We chose another solution: don't output padding inside the table like GCC - // does, instead output it before the table. - unsigned SizeTypes = TypeInfos.size() * TypeFormatSize; - unsigned CallSiteTableLengthSize = getULEB128Size(CallSiteTableLength); - unsigned TTypeBaseOffset = - sizeof(int8_t) + // Call site format - CallSiteTableLengthSize + // Call site table length size - CallSiteTableLength + // Call site table length - SizeActions + // Actions size - SizeTypes; - unsigned TTypeBaseOffsetSize = getULEB128Size(TTypeBaseOffset); - unsigned TotalSize = - sizeof(int8_t) + // LPStart format - sizeof(int8_t) + // TType format - (HaveTTData ? TTypeBaseOffsetSize : 0) + // TType base offset size - TTypeBaseOffset; // TType base offset - unsigned PadBytes = (4 - TotalSize) & 3; - + MCSymbol *TTBaseLabel = nullptr; if (HaveTTData) { - // Account for any extra padding that will be added to the call site table - // length. - Asm->EmitPaddedULEB128(TTypeBaseOffset, TTypeBaseOffsetSize + PadBytes, - "@TType base offset"); - PadBytes = 0; + // N.B.: There is a dependency loop between the size of the TTBase uleb128 + // here and the amount of padding before the aligned type table. The + // assembler must sometimes pad this uleb128 or insert extra padding before + // the type table. See PR35809 or GNU as bug 4029. + MCSymbol *TTBaseRefLabel = Asm->createTempSymbol("ttbaseref"); + TTBaseLabel = Asm->createTempSymbol("ttbase"); + Asm->EmitLabelDifferenceAsULEB128(TTBaseLabel, TTBaseRefLabel); + Asm->OutStreamer->EmitLabel(TTBaseRefLabel); } bool VerboseAsm = Asm->OutStreamer->isVerboseAsm(); + // Emit the landing pad call site table. + MCSymbol *CstBeginLabel = Asm->createTempSymbol("cst_begin"); + MCSymbol *CstEndLabel = Asm->createTempSymbol("cst_end"); + Asm->EmitEncodingByte(CallSiteEncoding, "Call site"); + Asm->EmitLabelDifferenceAsULEB128(CstEndLabel, CstBeginLabel); + Asm->OutStreamer->EmitLabel(CstBeginLabel); + // SjLj Exception handling if (IsSJLJ) { - Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); - - // Add extra padding if it wasn't added to the TType base offset. - Asm->EmitPaddedULEB128(CallSiteTableLength, - CallSiteTableLengthSize + PadBytes, - "Call site table length"); - - // Emit the landing pad site information. unsigned idx = 0; for (SmallVectorImpl::const_iterator I = CallSites.begin(), E = CallSites.end(); I != E; ++I, ++idx) { const CallSiteEntry &S = *I; - // Offset of the landing pad, counted in 16-byte bundles relative to the - // @LPStart address. + // Index of the call site entry. if (VerboseAsm) { Asm->OutStreamer->AddComment(">> Call Site " + Twine(idx) + " <<"); Asm->OutStreamer->AddComment(" On exception at call site "+Twine(idx)); @@ -557,14 +503,6 @@ // A missing entry in the call-site table indicates that a call is not // supposed to throw. - // Emit the landing pad call site table. - Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); - - // Add extra padding if it wasn't added to the TType base offset. - Asm->EmitPaddedULEB128(CallSiteTableLength, - CallSiteTableLengthSize + PadBytes, - "Call site table length"); - unsigned Entry = 0; for (SmallVectorImpl::const_iterator I = CallSites.begin(), E = CallSites.end(); I != E; ++I) { @@ -579,29 +517,27 @@ if (!EndLabel) EndLabel = Asm->getFunctionEnd(); - // Offset of the call site relative to the previous call site, counted in - // number of 16-byte bundles. The first call site is counted relative to - // the start of the procedure fragment. + // Offset of the call site relative to the start of the procedure. if (VerboseAsm) Asm->OutStreamer->AddComment(">> Call Site " + Twine(++Entry) + " <<"); - Asm->EmitLabelDifference(BeginLabel, EHFuncBeginSym, 4); + Asm->EmitLabelDifferenceAsULEB128(BeginLabel, EHFuncBeginSym); if (VerboseAsm) Asm->OutStreamer->AddComment(Twine(" Call between ") + BeginLabel->getName() + " and " + EndLabel->getName()); - Asm->EmitLabelDifference(EndLabel, BeginLabel, 4); + Asm->EmitLabelDifferenceAsULEB128(EndLabel, BeginLabel); - // Offset of the landing pad, counted in 16-byte bundles relative to the - // @LPStart address. + // Offset of the landing pad relative to the start of the procedure. if (!S.LPad) { if (VerboseAsm) Asm->OutStreamer->AddComment(" has no landing pad"); - Asm->OutStreamer->EmitIntValue(0, 4/*size*/); + Asm->EmitULEB128(0); } else { if (VerboseAsm) Asm->OutStreamer->AddComment(Twine(" jumps to ") + S.LPad->LandingPadLabel->getName()); - Asm->EmitLabelDifference(S.LPad->LandingPadLabel, EHFuncBeginSym, 4); + Asm->EmitLabelDifferenceAsULEB128(S.LPad->LandingPadLabel, + EHFuncBeginSym); } // Offset of the first associated action record, relative to the start of @@ -617,6 +553,7 @@ Asm->EmitULEB128(S.Action); } } + Asm->OutStreamer->EmitLabel(CstEndLabel); // Emit the Action Table. int Entry = 0; @@ -660,12 +597,15 @@ Asm->EmitSLEB128(Action.NextAction); } - emitTypeInfos(TTypeEncoding); + if (HaveTTData) { + Asm->EmitAlignment(2); + emitTypeInfos(TTypeEncoding, TTBaseLabel); + } Asm->EmitAlignment(2); } -void EHStreamer::emitTypeInfos(unsigned TTypeEncoding) { +void EHStreamer::emitTypeInfos(unsigned TTypeEncoding, MCSymbol *TTBaseLabel) { const MachineFunction *MF = Asm->MF; const std::vector &TypeInfos = MF->getTypeInfos(); const std::vector &FilterIds = MF->getFilterIds(); @@ -687,6 +627,8 @@ Asm->EmitTTypeReference(GV, TTypeEncoding); } + Asm->OutStreamer->EmitLabel(TTBaseLabel); + // Emit the Exception Specifications. if (VerboseAsm && !FilterIds.empty()) { Asm->OutStreamer->AddComment(">> Filter TypeInfos <<"); Index: lib/MC/MCAsmStreamer.cpp =================================================================== --- lib/MC/MCAsmStreamer.cpp +++ lib/MC/MCAsmStreamer.cpp @@ -910,7 +910,7 @@ EmitULEB128IntValue(IntValue); return; } - OS << ".uleb128 "; + OS << "\t.uleb128 "; Value->print(OS, MAI); EmitEOL(); } @@ -921,7 +921,7 @@ EmitSLEB128IntValue(IntValue); return; } - OS << ".sleb128 "; + OS << "\t.sleb128 "; Value->print(OS, MAI); EmitEOL(); } Index: lib/MC/MCObjectStreamer.cpp =================================================================== --- lib/MC/MCObjectStreamer.cpp +++ lib/MC/MCObjectStreamer.cpp @@ -51,17 +51,36 @@ PendingLabels.clear(); } +static Optional absoluteSymbolDiff(const MCSymbol *Hi, + const MCSymbol *Lo) { + if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment() || + Hi->isVariable() || Lo->isVariable()) + return None; + + return Hi->getOffset() - Lo->getOffset(); +} + void MCObjectStreamer::emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo, unsigned Size) { - // If not assigned to the same (valid) fragment, fallback. - if (!Hi->getFragment() || Hi->getFragment() != Lo->getFragment() || - Hi->isVariable() || Lo->isVariable()) { + Optional Diff = absoluteSymbolDiff(Hi, Lo); + if (!Diff.hasValue()) { MCStreamer::emitAbsoluteSymbolDiff(Hi, Lo, Size); return; } - EmitIntValue(Hi->getOffset() - Lo->getOffset(), Size); + EmitIntValue(*Diff, Size); +} + +void MCObjectStreamer::emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, + const MCSymbol *Lo) { + Optional Diff = absoluteSymbolDiff(Hi, Lo); + if (!Diff.hasValue()) { + MCStreamer::emitAbsoluteSymbolDiffAsULEB128(Hi, Lo); + return; + } + + EmitULEB128IntValue(*Diff); } void MCObjectStreamer::reset() { Index: lib/MC/MCStreamer.cpp =================================================================== --- lib/MC/MCStreamer.cpp +++ lib/MC/MCStreamer.cpp @@ -902,6 +902,16 @@ EmitSymbolValue(SetLabel, Size); } +void MCStreamer::emitAbsoluteSymbolDiffAsULEB128(const MCSymbol *Hi, + const MCSymbol *Lo) { + // Get the Hi-Lo expression. + const MCExpr *Diff = + MCBinaryExpr::createSub(MCSymbolRefExpr::create(Hi, Context), + MCSymbolRefExpr::create(Lo, Context), Context); + + EmitULEB128Value(Diff); +} + void MCStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {} void MCStreamer::EmitThumbFunc(MCSymbol *Func) {} void MCStreamer::EmitSymbolDesc(MCSymbol *Symbol, unsigned DescValue) {} Index: test/CodeGen/ARM/dwarf-eh.ll =================================================================== --- test/CodeGen/ARM/dwarf-eh.ll +++ test/CodeGen/ARM/dwarf-eh.ll @@ -64,8 +64,8 @@ ; CHECK: .cfi_personality 0, ; CHECK: .cfi_lsda 0, ; CHECK: @TType Encoding = absptr -; CHECK: @ Call site Encoding = udata4 +; CHECK: @ Call site Encoding = uleb128 ; CHECK-PIC: .cfi_personality 155, ; CHECK-PIC: .cfi_lsda 27, ; CHECK-PIC: @TType Encoding = indirect pcrel sdata4 -; CHECK-PIC: @ Call site Encoding = udata4 +; CHECK-PIC: @ Call site Encoding = uleb128 Index: test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll =================================================================== --- test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll +++ test/CodeGen/ARM/ehabi-handlerdata-nounwind.ll @@ -56,6 +56,6 @@ ; CHECK-LABEL: .Lexception0: ; CHECK: .byte 255 @ @LPStart Encoding = omit ; CHECK: .byte 0 @ @TType Encoding = absptr -; CHECK: .asciz -; CHECK: .byte 3 @ Call site Encoding = udata4 +; CHECK: .uleb128 .Lttbase +; CHECK: .byte 1 @ Call site Encoding = uleb128 ; CHECK: .fnend Index: test/CodeGen/ARM/ehabi-handlerdata.ll =================================================================== --- test/CodeGen/ARM/ehabi-handlerdata.ll +++ test/CodeGen/ARM/ehabi-handlerdata.ll @@ -51,9 +51,10 @@ ; CHECK-LABEL: .Lexception0: ; CHECK: .byte 255 @ @LPStart Encoding = omit ; CHECK: .byte 0 @ @TType Encoding = absptr -; CHECK: .asciz -; CHECK: .byte 3 @ Call site Encoding = udata4 -; CHECK: .long -; CHECK: .long -; CHECK: .long +; CHECK: .uleb128 .Lttbase +; CHECK: .byte 1 @ Call site Encoding = uleb128 +; CHECK: .uleb128 .Lcst_end +; CHECK: .uleb128 +; CHECK: .uleb128 +; CHECK: .uleb128 ; CHECK: .fnend Index: test/CodeGen/X86/eh-label.ll =================================================================== --- test/CodeGen/X86/eh-label.ll +++ test/CodeGen/X86/eh-label.ll @@ -20,5 +20,5 @@ ret void ; CHECK: [[END:.Lfunc_end.*]]: -; CHECK: .long [[END]]- +; CHECK: .uleb128 [[END]]- } Index: test/CodeGen/X86/eh-unknown.ll =================================================================== --- test/CodeGen/X86/eh-unknown.ll +++ test/CodeGen/X86/eh-unknown.ll @@ -22,11 +22,12 @@ ; CHECK: .seh_handlerdata ; CHECK: .Lexception0: ; CHECK: .byte 255 # @LPStart Encoding = omit -; CHECK: .byte 0 # @TType Encoding = absptr -; CHECK: .asciz "\217\200" # @TType base offset -; CHECK: .byte 3 # Call site Encoding = udata4 -; CHECK: .byte 13 # Call site table length -; CHECK: .long .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 << -; CHECK: .long .Lfunc_end0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Lfunc_end0 -; CHECK: .long 0 # has no landing pad +; CHECK: .byte 255 # @TType Encoding = omit +; CHECK: .byte 1 # Call site Encoding = uleb128 +; CHECK: .uleb128 .Lcst_end0-.Lcst_begin0 +; CHECK: .Lcst_begin0: +; CHECK: .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 << +; CHECK: .uleb128 .Lfunc_end0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Lfunc_end0 +; CHECK: .byte 0 # has no landing pad ; CHECK: .byte 0 # On action: cleanup +; CHECK: .Lcst_end0: Index: test/CodeGen/X86/patchpoint-invoke.ll =================================================================== --- test/CodeGen/X86/patchpoint-invoke.ll +++ test/CodeGen/X86/patchpoint-invoke.ll @@ -34,12 +34,14 @@ ; CHECK: [[EXCEPTION_LABEL]]: ; CHECK-NEXT: .byte 255 ; CHECK-NEXT: .byte 3 -; CHECK-NEXT: .byte 21 -; CHECK-NEXT: .byte 3 -; CHECK-NEXT: .byte 13 +; CHECK-NEXT: .uleb128 .Lttbase{{[0-9]+}}-[[TTBASEREF:.Lttbaseref[0-9]+]] +; CHECK-NEXT: [[TTBASEREF]]: +; CHECK-NEXT: .byte 1 +; CHECK-NEXT: .uleb128 .Lcst_end{{[0-9]+}}-[[CST_BEGIN:.Lcst_begin[0-9]+]] +; CHECK-NEXT: [[CST_BEGIN]]: ; Verify that the unwind data covers the entire patchpoint region: -; CHECK-NEXT: .long .Ltmp0-[[FUNC_BEGIN]] -; CHECK-NEXT: .long [[PP_END]]-.Ltmp0 +; CHECK-NEXT: .uleb128 .Ltmp0-[[FUNC_BEGIN]] +; CHECK-NEXT: .uleb128 [[PP_END]]-.Ltmp0 ; Verify that the stackmap section got emitted: Index: test/CodeGen/X86/push-cfi-obj.ll =================================================================== --- test/CodeGen/X86/push-cfi-obj.ll +++ test/CodeGen/X86/push-cfi-obj.ll @@ -11,7 +11,7 @@ ; LINUX-NEXT: SHF_ALLOC (0x2) ; LINUX-NEXT: ] ; LINUX-NEXT: Address: 0x0 -; LINUX-NEXT: Offset: 0x68 +; LINUX-NEXT: Offset: 0x5C ; LINUX-NEXT: Size: 64 ; LINUX-NEXT: Link: 0 ; LINUX-NEXT: Info: 0 Index: test/CodeGen/X86/statepoint-invoke.ll =================================================================== --- test/CodeGen/X86/statepoint-invoke.ll +++ test/CodeGen/X86/statepoint-invoke.ll @@ -38,8 +38,8 @@ ret i64 addrspace(1)* %obj1.relocated1 } ; CHECK-LABEL: GCC_except_table{{[0-9]+}}: -; CHECK: .long .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}} -; CHECK: .long .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}} +; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}} +; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}} ; CHECK: .byte 0 ; CHECK: .p2align 4 @@ -68,8 +68,8 @@ ret i64 addrspace(1)* %obj.relocated } ; CHECK-LABEL: GCC_except_table{{[0-9]+}}: -; CHECK: .long .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}} -; CHECK: .long .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}} +; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Ltmp{{[0-9]+}} +; CHECK: .uleb128 .Ltmp{{[0-9]+}}-.Lfunc_begin{{[0-9]+}} ; CHECK: .byte 0 ; CHECK: .p2align 4 Index: test/CodeGen/XCore/exception.ll =================================================================== --- test/CodeGen/XCore/exception.ll +++ test/CodeGen/XCore/exception.ll @@ -105,21 +105,27 @@ ; CHECK: [[LSDA]]: ; CHECK: .byte 255 ; CHECK: .byte 0 -; CHECK: .asciiz -; CHECK: .byte 3 -; CHECK: .byte 26 -; CHECK: .long [[PRE_G]]-[[START]] -; CHECK: .long [[POST_G]]-[[PRE_G]] -; CHECK: .long [[LANDING]]-[[START]] +; CHECK: .uleb128 [[TTBASE:.Lttbase[0-9]+]]-[[TTBASEREF:.Lttbaseref[0-9]+]] +; CHECK: [[TTBASEREF]]: +; CHECK: .byte 1 +; CHECK: .uleb128 [[CST_END:.Lcst_end[0-9]+]]-[[CST_BEGIN:.Lcst_begin[0-9]+]] +; CHECK: [[CST_BEGIN]]: +; CHECK: .uleb128 [[PRE_G]]-[[START]] +; CHECK: .uleb128 [[POST_G]]-[[PRE_G]] +; CHECK: .uleb128 [[LANDING]]-[[START]] ; CHECK: .byte 5 -; CHECK: .long [[POST_G]]-[[START]] -; CHECK: .long [[END]]-[[POST_G]] -; CHECK: .long 0 +; CHECK: .uleb128 [[POST_G]]-[[START]] +; CHECK: .uleb128 [[END]]-[[POST_G]] +; CHECK: .byte 0 +; CHECK: .byte 0 +; CHECK: [[CST_END]]: ; CHECK: .byte 0 ; CHECK: .byte 0 ; CHECK: .byte 1 ; CHECK: .byte 125 ; CHECK: .byte 2 ; CHECK: .byte 125 +; CHECK: .p2align 2 ; CHECK: .long _ZTIi ; CHECK: .long _ZTId +; CHECK: [[TTBASE]]: