1# REQUIRES: asserts
2# UNSUPPORTED: system-windows
3# RUN: llvm-mc -triple=x86_64-unknown-linux -position-independent \
4# RUN:     -filetype=obj -o %t %s
5# RUN: llvm-jitlink -debug-only=jitlink -abs bar=0x01 \
6# RUN:     -abs _ZTIi=0x02 -noexec %t 2>&1 | FileCheck %s
7#
8# FIXME: This test should run on windows. Investigate spurious
9# 'note: command had no output on stdout or stderr' errors, then re-enable.
10#
11# Check that a basic .eh-frame section is recognized and parsed. We
12# Expect to see two FDEs with corresponding keep-alive edges.
13#
14# CHECK: Adding keep-alive edge from target at {{.*}} to FDE at
15# CHECK: Adding keep-alive edge from target at {{.*}} to FDE at
16
17	.text
18	.file	"exceptions.cpp"
19	.globl	foo
20	.p2align	4, 0x90
21	.type	foo,@function
22foo:
23	.cfi_startproc
24
25	pushq	%rax
26	.cfi_def_cfa_offset 16
27	movl	$4, %edi
28	callq	__cxa_allocate_exception@PLT
29	movl	$1, (%rax)
30	movq	_ZTIi@GOTPCREL(%rip), %rsi
31	movq	%rax, %rdi
32	xorl	%edx, %edx
33	callq	__cxa_throw@PLT
34.Lfunc_end0:
35	.size	foo, .Lfunc_end0-foo
36	.cfi_endproc
37
38	.globl	main
39	.p2align	4, 0x90
40	.type	main,@function
41main:
42.Lfunc_begin0:
43	.cfi_startproc
44	.cfi_personality 155, DW.ref.__gxx_personality_v0
45	.cfi_lsda 27, .Lexception0
46
47	pushq	%rbx
48	.cfi_def_cfa_offset 16
49	.cfi_offset %rbx, -16
50	xorl	%ebx, %ebx
51.Ltmp0:
52	callq	bar@PLT
53.Ltmp1:
54
55	movl	%ebx, %eax
56	popq	%rbx
57	.cfi_def_cfa_offset 8
58	retq
59.LBB1_1:
60	.cfi_def_cfa_offset 16
61.Ltmp2:
62	movq	%rax, %rdi
63	callq	__cxa_begin_catch@PLT
64	callq	__cxa_end_catch@PLT
65	movl	$1, %ebx
66	movl	%ebx, %eax
67	popq	%rbx
68	.cfi_def_cfa_offset 8
69	retq
70.Lfunc_end1:
71	.size	main, .Lfunc_end1-main
72	.cfi_endproc
73	.section	.gcc_except_table,"a",@progbits
74	.p2align	2
75GCC_except_table1:
76.Lexception0:
77	.byte	255
78	.byte	156
79	.uleb128 .Lttbase0-.Lttbaseref0
80.Lttbaseref0:
81	.byte	1
82	.uleb128 .Lcst_end0-.Lcst_begin0
83.Lcst_begin0:
84	.uleb128 .Ltmp0-.Lfunc_begin0
85	.uleb128 .Ltmp1-.Ltmp0
86	.uleb128 .Ltmp2-.Lfunc_begin0
87	.byte	1
88	.uleb128 .Ltmp1-.Lfunc_begin0
89	.uleb128 .Lfunc_end1-.Ltmp1
90	.byte	0
91	.byte	0
92.Lcst_end0:
93	.byte	1
94
95	.byte	0
96	.p2align	2
97
98.Ltmp3:
99	.quad	.L_ZTIi.DW.stub-.Ltmp3
100.Lttbase0:
101	.p2align	2
102
103	.data
104	.p2align	3
105.L_ZTIi.DW.stub:
106	.quad	_ZTIi
107	.hidden	DW.ref.__gxx_personality_v0
108	.weak	DW.ref.__gxx_personality_v0
109	.section	.data.DW.ref.__gxx_personality_v0,"aGw",@progbits,DW.ref.__gxx_personality_v0,comdat
110	.p2align	3
111	.type	DW.ref.__gxx_personality_v0,@object
112	.size	DW.ref.__gxx_personality_v0, 8
113DW.ref.__gxx_personality_v0:
114	.quad	__gxx_personality_v0
115	.ident	"clang version 12.0.0 ([email protected]:llvm/llvm-project.git afd483e57d166418e94a65bd9716e7dc4c114eed)"
116	.section	".note.GNU-stack","",@progbits
117	.addrsig
118	.addrsig_sym __gxx_personality_v0
119	.addrsig_sym _ZTIi
120