168 lines · plain
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 main3# right before landing pad.4 5# RUN: llvm-mc --filetype=obj --triple x86_64-unknown-unknown %s -o %t.o6# RUN: link_fdata %s %t.o %t.fdata7# RUN: llvm-strip --strip-unneeded %t.o8# RUN: %clang++ %cflags %t.o -o %t.exe -Wl,-q9# 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 %s12# RUN: %t.bolt | FileCheck --check-prefix=RUN-CHECK %s13 14# BOLT-CHECK: ------- HOT-COLD SPLIT POINT -------15# BOLT-CHECK-EMPTY:16# BOLT-CHECK-NEXT: .LLP117 18# RUN-CHECK: failed successfully19 20 21 .text22 .file "lp-fragment-start.cpp"23 .globl main # -- Begin function main24 .p2align 4, 0x9025 .type main,@function26main: # @main27.Lfunc_begin0:28 .cfi_startproc29 .cfi_personality 155, DW.ref.__gxx_personality_v030 .cfi_lsda 27, .Lexception031 pushq %r1532 .cfi_def_cfa_offset 1633 pushq %r1434 .cfi_def_cfa_offset 2435 pushq %rbx36 .cfi_def_cfa_offset 3237 .cfi_offset %rbx, -3238 .cfi_offset %r14, -2439 .cfi_offset %r15, -1640 movl $16, %edi41LL_fdata0:42 callq __cxa_allocate_exception@PLT43# FDATA: 1 main #LL_fdata0# 1 __cxa_allocate_exception@PLT 0 0 144 movq %rax, %rbx45.Ltmp0:46 leaq .L.str(%rip), %rsi47 movq %rax, %rdi48 callq _ZNSt13runtime_errorC1EPKc@PLT49 jmp .Ltmp350.Ltmp1:51# Cause split here, so .Ltmp5 is the first block of the fragment52.Ltmp5: # LP for .Ltmp3 to .Ltmp453 movq %rdx, %r1554 movq %rax, %r1455 jmp .LBB0_456.Ltmp3: # throw std::runtime_error57 movq _ZTISt13runtime_error@GOTPCREL(%rip), %rsi58 movq _ZNSt13runtime_errorD1Ev@GOTPCREL(%rip), %rdx59 movq %rbx, %rdi60 callq __cxa_throw@PLT # LP: .Ltmp561.Ltmp4:62.Ltmp2:63 movq %rdx, %r1564 movq %rax, %r1465 movq %rbx, %rdi66 callq __cxa_free_exception@PLT67.LBB0_4:68 movq %r14, %rdi69 cmpl $1, %r15d70 jne .LBB0_571 callq __cxa_begin_catch@PLT72 movq (%rax), %rcx73 movq %rax, %rdi74 callq *16(%rcx)75 movq %rax, %rdi76 callq puts@PLT77 callq __cxa_end_catch@PLT78 xorl %eax, %eax79 popq %rbx80 .cfi_def_cfa_offset 2481 popq %r1482 .cfi_def_cfa_offset 1683 popq %r1584 .cfi_def_cfa_offset 885 retq86.LBB0_5:87 .cfi_def_cfa_offset 3288 callq _Unwind_Resume@PLT89.Lfunc_end0:90 .size main, .Lfunc_end0-main91 .cfi_endproc92 .section .gcc_except_table,"a",@progbits93 .p2align 294GCC_except_table0:95.Lexception0:96 .byte 255 # @LPStart Encoding = omit97 .byte 155 # @TType Encoding = indirect pcrel sdata498 .uleb128 .Lttbase0-.Lttbaseref099.Lttbaseref0:100 .byte 1 # Call site Encoding = uleb128101 .uleb128 .Lcst_end0-.Lcst_begin0102.Lcst_begin0:103 .uleb128 .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 <<104 .uleb128 .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0105 .byte 0 # has no landing pad106 .byte 0 # On action: cleanup107 .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 2 <<108 .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1109 .uleb128 .Ltmp2-.Lfunc_begin0 # jumps to .Ltmp2110 .byte 3 # On action: 2111 .uleb128 .Ltmp3-.Lfunc_begin0 # >> Call Site 3 <<112 .uleb128 .Ltmp4-.Ltmp3 # Call between .Ltmp3 and .Ltmp4113 .uleb128 .Ltmp5-.Lfunc_begin0 # jumps to .Ltmp5114 .byte 5 # On action: 3115 .uleb128 .Ltmp4-.Lfunc_begin0 # >> Call Site 4 <<116 .uleb128 .Lfunc_end0-.Ltmp4 # Call between .Ltmp4 and .Lfunc_end0117 .byte 0 # has no landing pad118 .byte 0 # On action: cleanup119.Lcst_end0:120 .byte 0 # >> Action Record 1 <<121 .byte 0 # No further actions122 .byte 1 # >> Action Record 2 <<123 .byte 125 # Continue to action 1124 .byte 1 # >> Action Record 3 <<125 .byte 0 # No further actions126 .p2align 2127.Ltmp6: # TypeInfo 1128 .long .L_ZTISt13runtime_error.DW.stub-.Ltmp6129.Lttbase0:130 .p2align 2131 .type .L.str,@object # @.str132 .section .rodata.str1.1,"aMS",@progbits,1133.L.str:134 .asciz "failed successfully"135 .size .L.str, 20136 137 .data138 .p2align 3139.L_ZTISt13runtime_error.DW.stub:140 .quad _ZTISt13runtime_error141 .hidden DW.ref.__gxx_personality_v0142 .weak DW.ref.__gxx_personality_v0143 .section .data.DW.ref.__gxx_personality_v0,"aGw",@progbits,DW.ref.__gxx_personality_v0,comdat144 .p2align 3145 .type DW.ref.__gxx_personality_v0,@object146 .size DW.ref.__gxx_personality_v0, 8147DW.ref.__gxx_personality_v0:148 .quad __gxx_personality_v0149 .ident "clang version 14.0.0 (https://github.com/llvm/llvm-project.git 329fda39c507e8740978d10458451dcdb21563be)"150 .section ".note.GNU-stack","",@progbits151 .addrsig152 .addrsig_sym __gxx_personality_v0153 .addrsig_sym _Unwind_Resume154 .addrsig_sym _ZTISt13runtime_error155 156 157# #include <cstdio>158# #include <stdexcept>159#160# int main() {161# try {162# throw std::runtime_error("failed successfully");163# } catch (const std::runtime_error &e) {164# puts(e.what());165# }166# return 0;167# }168