Index: lib/CodeGen/AsmPrinter/EHStreamer.cpp =================================================================== --- lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -374,15 +374,17 @@ computeCallSiteTable(CallSites, LandingPads, FirstActions); bool IsSJLJ = Asm->MAI->getExceptionHandlingType() == ExceptionHandling::SjLj; - bool HaveTTData = IsSJLJ ? (!TypeInfos.empty() || !FilterIds.empty()) : true; + 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; 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; } else { // Okay, we have actual filters or typeinfos to emit. As such, we need to @@ -450,7 +452,7 @@ // Emit the landing pad call site table. MCSymbol *CstBeginLabel = Asm->createTempSymbol("cst_begin"); MCSymbol *CstEndLabel = Asm->createTempSymbol("cst_end"); - Asm->EmitEncodingByte(dwarf::DW_EH_PE_udata4, "Call site"); + Asm->EmitEncodingByte(CallSiteEncoding, "Call site"); Asm->EmitLabelDifferenceAsULEB128(CstEndLabel, CstBeginLabel); Asm->OutStreamer->EmitLabel(CstBeginLabel); @@ -518,23 +520,24 @@ // 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 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 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 @@ -57,5 +57,5 @@ ; CHECK: .byte 255 @ @LPStart Encoding = omit ; CHECK: .byte 0 @ @TType Encoding = absptr ; CHECK: .uleb128 .Lttbase -; CHECK: .byte 3 @ Call site Encoding = udata4 +; 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 @@ -52,9 +52,9 @@ ; CHECK: .byte 255 @ @LPStart Encoding = omit ; CHECK: .byte 0 @ @TType Encoding = absptr ; CHECK: .uleb128 .Lttbase -; CHECK: .byte 3 @ Call site Encoding = udata4 +; CHECK: .byte 1 @ Call site Encoding = uleb128 ; CHECK: .uleb128 .Lcst_end -; CHECK: .long -; CHECK: .long -; CHECK: .long +; 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,14 +22,12 @@ ; CHECK: .seh_handlerdata ; CHECK: .Lexception0: ; CHECK: .byte 255 # @LPStart Encoding = omit -; CHECK: .byte 0 # @TType Encoding = absptr -; CHECK: .uleb128 .Lttbase0-.Lttbaseref0 -; CHECK: .Lttbaseref0: -; CHECK: .byte 3 # Call site Encoding = udata4 +; CHECK: .byte 255 # @TType Encoding = omit +; CHECK: .byte 1 # Call site Encoding = uleb128 ; CHECK: .uleb128 .Lcst_end0-.Lcst_begin0 ; CHECK: .Lcst_begin0: -; 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: .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 @@ -36,12 +36,12 @@ ; CHECK-NEXT: .byte 3 ; CHECK-NEXT: .uleb128 .Lttbase{{[0-9]+}}-[[TTBASEREF:.Lttbaseref[0-9]+]] ; CHECK-NEXT: [[TTBASEREF]]: -; CHECK-NEXT: .byte 3 +; 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 @@ -107,16 +107,16 @@ ; CHECK: .byte 0 ; CHECK: .uleb128 [[TTBASE:.Lttbase[0-9]+]]-[[TTBASEREF:.Lttbaseref[0-9]+]] ; CHECK: [[TTBASEREF]]: -; CHECK: .byte 3 +; CHECK: .byte 1 ; CHECK: .uleb128 [[CST_END:.Lcst_end[0-9]+]]-[[CST_BEGIN:.Lcst_begin[0-9]+]] ; CHECK: [[CST_BEGIN]]: -; CHECK: .long [[PRE_G]]-[[START]] -; CHECK: .long [[POST_G]]-[[PRE_G]] -; CHECK: .long [[LANDING]]-[[START]] +; 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