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