1 # Test that landing pads at fragment entries are not omitted during unwinding.
2 # This uses profile2 splitting with a fake fdata, so SplitFunctions splits main
3 # right before landing pad.
5 # RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o
6 # RUN: link_fdata %s %t.o %t.fdata
7 # RUN: llvm-strip --strip-unneeded %t.o
8 # RUN: %clang++ %cflags %t.o -o %t.exe -Wl,-q
9 # RUN: llvm-bolt %t.exe -o %t.bolt --split-functions --data=%t.fdata \
10 # RUN: --print-split --print-only=main --split-eh --split-all-cold \
11 # RUN: 2>&1 | FileCheck --check-prefix=BOLT-CHECK %s
12 # RUN: %t.bolt | FileCheck --check-prefix=RUN-CHECK %s
14 # BOLT-CHECK: ------- HOT-COLD SPLIT POINT -------
16 # BOLT-CHECK-NEXT: .LLP1
18 # RUN-CHECK: failed successfully
22 .file "lp-fragment-start.cpp"
23 .globl main # -- Begin function main
29 .cfi_personality 155, DW.ref.__gxx_personality_v0
30 .cfi_lsda 27, .Lexception0
32 .cfi_def_cfa_offset 16
34 .cfi_def_cfa_offset 24
36 .cfi_def_cfa_offset 32
42 callq __cxa_allocate_exception@PLT
43 # FDATA: 1 main #LL_fdata0# 1 __cxa_allocate_exception@PLT 0 0 1
46 leaq
.L.str(%rip), %rsi
48 callq _ZNSt13runtime_errorC1EPKc@PLT
51 # Cause split here, so .Ltmp5 is the first block of the fragment
52 .Ltmp5: # LP for .Ltmp3 to .Ltmp4
56 .Ltmp3: # throw std::runtime_error
57 movq _ZTISt13runtime_error@GOTPCREL
(%rip
), %rsi
58 movq _ZNSt13runtime_errorD1Ev@GOTPCREL
(%rip
), %rdx
60 callq __cxa_throw@PLT
# LP: .Ltmp5
66 callq __cxa_free_exception@PLT
71 callq __cxa_begin_catch@PLT
77 callq __cxa_end_catch@PLT
80 .cfi_def_cfa_offset 24
82 .cfi_def_cfa_offset 16
87 .cfi_def_cfa_offset 32
88 callq _Unwind_Resume@PLT
90 .size main, .Lfunc_end0-main
92 .section .gcc_except_table,"a",@progbits
96 .byte 255 # @LPStart Encoding = omit
97 .byte 155 # @TType Encoding = indirect pcrel sdata4
98 .uleb128 .Lttbase0-.Lttbaseref0
100 .byte 1 # Call site Encoding = uleb128
101 .uleb128 .Lcst_end0-.Lcst_begin0
103 .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<
104 .uleb128 .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0
105 .byte 0 # has no landing pad
106 .byte 0 # On action: cleanup
107 .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<
108 .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1
109 .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2
110 .byte 3 # On action: 2
111 .uleb128 .Ltmp3-.Lfunc_begin0 # >> Call Site 3 <<
112 .uleb128 .Ltmp4-.Ltmp3 # Call between .Ltmp3 and .Ltmp4
113 .uleb128 .Ltmp5-.Lfunc_begin0 # jumps to .Ltmp5
114 .byte 5 # On action: 3
115 .uleb128 .Ltmp4-.Lfunc_begin0 # >> Call Site 4 <<
116 .uleb128 .Lfunc_end0-.Ltmp4 # Call between .Ltmp4 and .Lfunc_end0
117 .byte 0 # has no landing pad
118 .byte 0 # On action: cleanup
120 .byte 0 # >> Action Record 1 <<
121 .byte 0 # No further actions
122 .byte 1 # >> Action Record 2 <<
123 .byte 125 # Continue to action 1
124 .byte 1 # >> Action Record 3 <<
125 .byte 0 # No further actions
128 .long .L_ZTISt13runtime_error.DW.stub-.Ltmp6
131 .type .L.str,@object # @.str
132 .section .rodata.str1.1,"aMS",@progbits,1
134 .asciz "failed successfully"
139 .L_ZTISt13runtime_error.DW.stub:
140 .quad _ZTISt13runtime_error
141 .hidden DW.ref.__gxx_personality_v0
142 .weak DW.ref.__gxx_personality_v0
143 .section .data.DW.ref.__gxx_personality_v0,"aGw",@progbits,DW.ref.__gxx_personality_v0,comdat
145 .type DW.ref.__gxx_personality_v0,@object
146 .size DW.ref.__gxx_personality_v0, 8
147 DW.ref.__gxx_personality_v0
:
148 .quad __gxx_personality_v0
149 .ident "clang version 14.0.0 (https://github.com/llvm/llvm-project.git 329fda39c507e8740978d10458451dcdb21563be)"
150 .section ".note.GNU-stack","",@progbits
152 .addrsig_sym __gxx_personality_v0
153 .addrsig_sym _Unwind_Resume
154 .addrsig_sym _ZTISt13runtime_error
158 # #include <stdexcept>
162 # throw std::runtime_error("failed successfully");
163 # } catch (const std::runtime_error &e) {