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