|
| 1 | +# RUN: %{cxx} %{flags} %s %{link_flags} -no-pie -o %t.exe |
| 2 | +# RUN: %t.exe |
| 3 | + |
| 4 | +# REQUIRES: linux && target={{x86_64-.+}} |
| 5 | +# UNSUPPORTED: no-exceptions |
| 6 | + |
| 7 | +## Check that libc++abi works correctly when LPStart address is explicitly set |
| 8 | +## to zero. |
| 9 | + |
| 10 | +## This file is generated from the following C++ source code. |
| 11 | +## |
| 12 | +## ``` |
| 13 | +## int main() { |
| 14 | +## try { |
| 15 | +## throw 42; |
| 16 | +## } catch (...) { |
| 17 | +## return 0; |
| 18 | +## } |
| 19 | +## return 1; |
| 20 | +## } |
| 21 | +## ``` |
| 22 | +## The exception table is modified to use udata4 encoding for LPStart and |
| 23 | +## sdata4 encoding for call sites. |
| 24 | + |
| 25 | + .text |
| 26 | + .globl main # -- Begin function main |
| 27 | + .p2align 4, 0x90 |
| 28 | + .type main,@function |
| 29 | +main: # @main |
| 30 | +.Lfunc_begin0: |
| 31 | + .cfi_startproc |
| 32 | + .globl __gxx_personality_v0 |
| 33 | + .cfi_personality 3, __gxx_personality_v0 |
| 34 | + .cfi_lsda 27, .Lexception0 |
| 35 | +# %bb.0: # %entry |
| 36 | + pushq %rbp |
| 37 | + .cfi_def_cfa_offset 16 |
| 38 | + .cfi_offset %rbp, -16 |
| 39 | + movq %rsp, %rbp |
| 40 | + .cfi_def_cfa_register %rbp |
| 41 | + subq $32, %rsp |
| 42 | + movl $0, -4(%rbp) |
| 43 | + movl $4, %edi |
| 44 | + callq __cxa_allocate_exception@PLT |
| 45 | + movq %rax, %rdi |
| 46 | + movl $42, (%rdi) |
| 47 | +.Ltmp0: |
| 48 | + movq _ZTIi@GOTPCREL(%rip), %rsi |
| 49 | + xorl %eax, %eax |
| 50 | + movl %eax, %edx |
| 51 | + callq __cxa_throw@PLT |
| 52 | +.Ltmp1: |
| 53 | + jmp .LBB0_4 |
| 54 | +.LBB0_1: # %lpad |
| 55 | +.Ltmp2: |
| 56 | + movq %rax, %rcx |
| 57 | + movl %edx, %eax |
| 58 | + movq %rcx, -16(%rbp) |
| 59 | + movl %eax, -20(%rbp) |
| 60 | +# %bb.2: # %catch |
| 61 | + movq -16(%rbp), %rdi |
| 62 | + callq __cxa_begin_catch@PLT |
| 63 | + movl $0, -4(%rbp) |
| 64 | + callq __cxa_end_catch@PLT |
| 65 | +# %bb.3: # %return |
| 66 | + movl -4(%rbp), %eax |
| 67 | + addq $32, %rsp |
| 68 | + popq %rbp |
| 69 | + .cfi_def_cfa %rsp, 8 |
| 70 | + retq |
| 71 | +.LBB0_4: # %unreachable |
| 72 | +.Lfunc_end0: |
| 73 | + .size main, .Lfunc_end0-main |
| 74 | + .cfi_endproc |
| 75 | + |
| 76 | + .section .gcc_except_table,"a",@progbits |
| 77 | + .p2align 2, 0x0 |
| 78 | +GCC_except_table0: |
| 79 | +.Lexception0: |
| 80 | + .byte 3 # @LPStart Encoding = udata4 |
| 81 | + .long 0 |
| 82 | + .byte 155 # @TType Encoding = indirect pcrel sdata4 |
| 83 | + .uleb128 .Lttbase0-.Lttbaseref0 |
| 84 | +.Lttbaseref0: |
| 85 | + .byte 11 # Call site Encoding = udata4 |
| 86 | + .uleb128 .Lcst_end0-.Lcst_begin0 |
| 87 | +.Lcst_begin0: |
| 88 | + .long .Lfunc_begin0-.Lfunc_begin0 # >> Call Site 1 << |
| 89 | + .long .Ltmp0-.Lfunc_begin0 # Call between .Lfunc_begin0 and .Ltmp0 |
| 90 | + .long 0 # has no landing pad |
| 91 | + .byte 0 # On action: cleanup |
| 92 | + .long .Ltmp0-.Lfunc_begin0 # >> Call Site 2 << |
| 93 | + .long .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1 |
| 94 | + .long .Ltmp2 |
| 95 | + .byte 1 # On action: 1 |
| 96 | + .long .Ltmp1-.Lfunc_begin0 # >> Call Site 3 << |
| 97 | + .long .Lfunc_end0-.Ltmp1 # Call between .Ltmp1 and .Lfunc_end0 |
| 98 | + .long 0 # has no landing pad |
| 99 | + .byte 0 # On action: cleanup |
| 100 | +.Lcst_end0: |
| 101 | + .byte 1 # >> Action Record 1 << |
| 102 | + # Catch TypeInfo 1 |
| 103 | + .byte 0 # No further actions |
| 104 | + .p2align 2, 0x0 |
| 105 | + # >> Catch TypeInfos << |
| 106 | + .long 0 # TypeInfo 1 |
| 107 | +.Lttbase0: |
| 108 | + .p2align 2, 0x0 |
| 109 | + # -- End function |
0 commit comments