Index: llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -671,8 +671,13 @@ } Asm->emitULEB128(S.Action); } + + Asm->OutStreamer->emitLabel(CstEndLabel); + + // With multiple call ranges, we need go generate multiple bases + if (CstEndLabel) + CstEndLabel = Asm->createTempSymbol("action_table_base"); } - Asm->OutStreamer->emitLabel(CstEndLabel); } // Emit the Action Table. Index: llvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll =================================================================== --- llvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll +++ llvm/test/CodeGen/X86/gcc_except_table_bb_sections.ll @@ -104,6 +104,7 @@ ; CHECK-NEXT: .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1 ; CHECK-NEXT: .uleb128 .Ltmp2-main.2 # jumps to .Ltmp2 ; CHECK-NEXT: .byte 3 # On action: 2 +; CHECK-NEXT: .Laction_table_base0 ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: .Lexception1: @@ -121,8 +122,9 @@ ; CHECK-NEXT: .uleb128 .Lttbase0-.Lttbaseref1 ; CHECK-NEXT: .Lttbaseref1: ; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128 -; CHECK-NEXT: .uleb128 .Laction_table_base0-.Lcst_begin1 +; CHECK-NEXT: .uleb128 .Laction_table_base1-.Lcst_begin1 ; CHECK-NEXT: .Lcst_begin1: +; CHECK-NEXT: .Laction_table_base1 ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: .Lexception2: @@ -140,13 +142,13 @@ ; CHECK-NEXT: .uleb128 .Lttbase0-.Lttbaseref2 ; CHECK-NEXT: .Lttbaseref2: ; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128 -; CHECK-NEXT: .uleb128 .Laction_table_base0-.Lcst_begin2 +; CHECK-NEXT: .uleb128 .Laction_table_base2-.Lcst_begin2 ; CHECK-NEXT: .Lcst_begin2: ; CHECK-NEXT: .uleb128 main.2-main.2 # >> Call Site 2 << ; CHECK-NEXT: .uleb128 .LBB_END0_2-main.2 # Call between main.2 and .LBB_END0_2 ; CHECK-NEXT: .byte 0 # has no landing pad ; CHECK-NEXT: .byte 0 # On action: cleanup -; CHECK-NEXT: .Laction_table_base0: +; CHECK-NEXT: .Laction_table_base2: ; CHECK-NEXT: .byte 0 # >> Action Record 1 << ; CHECK-NEXT: # Cleanup ; CHECK-NEXT: .byte 0 # No further actions Index: llvm/test/CodeGen/X86/gcc_except_table_bb_sections_ehpad_groups_with_cold.ll =================================================================== --- llvm/test/CodeGen/X86/gcc_except_table_bb_sections_ehpad_groups_with_cold.ll +++ llvm/test/CodeGen/X86/gcc_except_table_bb_sections_ehpad_groups_with_cold.ll @@ -67,6 +67,7 @@ ; CHECK-NEXT: .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1 ; CHECK-NEXT: .uleb128 .Ltmp2-main.cold # jumps to .Ltmp2 ; CHECK-NEXT: .byte 3 # On action: 2 +; CHECK-NEXT: .Laction_table_base0: ; CHECK-NEXT: .p2align 2 ; CHECK-NEXT: .Lexception1: ; CHECK-NEXT: .byte 0 # @LPStart Encoding = absptr @@ -75,13 +76,13 @@ ; CHECK-NEXT: .uleb128 .Lttbase0-.Lttbaseref1 ; CHECK-NEXT: .Lttbaseref1: ; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128 -; CHECK-NEXT: .uleb128 .Laction_table_base0-.Lcst_begin1 +; CHECK-NEXT: .uleb128 .Laction_table_base1-.Lcst_begin1 ; CHECK-NEXT: .Lcst_begin1: ; CHECK-NEXT: .uleb128 main.cold-main.cold # >> Call Site 2 << ; CHECK-NEXT: .uleb128 .LBB_END0_2-main.cold # Call between main.cold and .LBB_END0_2 ; CHECK-NEXT: .byte 0 # has no landing pad ; CHECK-NEXT: .byte 0 # On action: cleanup -; CHECK-NEXT: .Laction_table_base0: +; CHECK-NEXT: .Laction_table_base1: ; CHECK-NEXT: .byte 0 # >> Action Record 1 << ; CHECK-NEXT: # Cleanup ; CHECK-NEXT: .byte 0 # No further actions