xref: /llvm-project/llvm/test/ExecutionEngine/JITLink/RISCV/ELF_ehframe.s (revision 255870d7b5c474b1ea0b61f165d11930ada2e2ef)
1# REQUIRES: asserts
2
3# RUN: llvm-mc -triple=riscv32-linux-gnu -mattr=+relax -filetype=obj -o %t.32.o %s
4# RUN: llvm-jitlink -noexec -phony-externals -debug-only=jitlink %t.32.o 2>&1 | \
5# RUN:   FileCheck %s
6
7# RUN: llvm-mc -triple=riscv64-linux-gnu -mattr=+relax -filetype=obj -o %t.64.o %s
8# RUN: llvm-jitlink -noexec -phony-externals -debug-only=jitlink %t.64.o 2>&1 | \
9# RUN:   FileCheck %s
10
11# Check that splitting of eh-frame sections works.
12#
13# CHECK: DWARFRecordSectionSplitter: Processing .eh_frame...
14# CHECK:  Processing block at
15# CHECK:    Processing CFI record at
16# CHECK:    Processing CFI record at
17# CHECK: EHFrameEdgeFixer: Processing .eh_frame in "{{.*}}"...
18# CHECK:   Processing block at
19# CHECK:     Record is CIE
20# CHECK:   Processing block at
21# CHECK:     Record is FDE
22# CHECK:       Adding edge at {{.*}} to CIE at: {{.*}}
23# CHECK:       Existing edge at {{.*}} to PC begin at {{.*}}
24# CHECK:       Adding keep-alive edge from target at {{.*}} to FDE at {{.*}}
25# CHECK:   Processing block at
26# CHECK:     Record is FDE
27# CHECK:       Adding edge at {{.*}} to CIE at: {{.*}}
28# CHECK:       Existing edge at {{.*}} to PC begin at {{.*}}
29# CHECK:       Adding keep-alive edge from target at {{.*}} to FDE at {{.*}}
30
31## This is "int main { throw 1; }" compiled for riscv32. We use the 32-bit
32## version because it is also legal for riscv64.
33	.text
34	.globl	main
35	.p2align	1
36	.type	main,@function
37main:
38	.cfi_startproc
39	addi	sp, sp, -16
40	.cfi_def_cfa_offset 16
41	sw	ra, 12(sp)
42	.cfi_offset ra, -4
43	li	a0, 4
44	call	__cxa_allocate_exception
45	li	a1, 1
46	sw	a1, 0(a0)
47	lga a1, _ZTIi
48	li	a2, 0
49	call	__cxa_throw
50.Lfunc_end0:
51	.size	main, .Lfunc_end0-main
52	.cfi_endproc
53
54	.globl	dup
55	.p2align	1
56	.type	dup,@function
57dup:
58	.cfi_startproc
59	addi	sp, sp, -16
60	.cfi_def_cfa_offset 16
61	sw	ra, 12(sp)
62	.cfi_offset ra, -4
63	li	a0, 4
64	call	__cxa_allocate_exception
65	li	a1, 1
66	sw	a1, 0(a0)
67	lga a1, _ZTIi
68	li	a2, 0
69	call	__cxa_throw
70.Lfunc_end1:
71	.size	dup, .Lfunc_end1-dup
72	.cfi_endproc
73