xref: /llvm-project/llvm/test/DebugInfo/Mips/eh_frame.ll (revision 8f21294897befee48f9f72734ea1b0ad4c920aa0)
1; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips \
2; RUN:     -relocation-model=static -O3 -filetype=obj -o - %s | \
3; RUN:     llvm-readelf -r - | FileCheck %s --check-prefixes=STATIC
4; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips \
5; RUN:     -relocation-model=pic -O3 -filetype=obj -o - %s | \
6; RUN:     llvm-readelf -r - | FileCheck %s --check-prefixes=PIC
7; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips \
8; RUN:     -relocation-model=static -O3 -filetype=obj -o - %s | \
9; RUN:     llvm-objdump -s -j .gcc_except_table - | FileCheck %s --check-prefix=EXCEPT-TABLE-STATIC
10; RUN: llc -mtriple mips-unknown-linux-gnu -mattr=+micromips \
11; RUN:     -relocation-model=pic -O3 -filetype=obj -o - %s | \
12; RUN:     llvm-objdump -s -j .gcc_except_table - | FileCheck %s --check-prefix=EXCEPT-TABLE-PIC
13
14; STATIC-LABEL: Relocation section '.rel.eh_frame'
15; STATIC-DAG: R_MIPS_32 00000000 DW.ref.__gxx_personality_v0
16; STATIC-DAG: R_MIPS_32 00000000 .text
17; STATIC-DAG: R_MIPS_32 00000000 .gcc_except_table
18
19; PIC-LABEL: Relocation section '.rel.eh_frame'
20; PIC-DAG: R_MIPS_PC32   00000000 DW.ref.__gxx_personality_v0
21; PIC-DAG: R_MIPS_PC32   00000000 .L0
22; PIC-DAG: R_MIPS_PC32   00000000 .L0
23
24; CHECK-READELF: DW.ref.__gxx_personality_v0
25; CHECK-READELF-STATIC-NEXT: R_MIPS_32 00000000 .text
26; CHECK-READELF-PIC-NEXT: R_MIPS_PC32
27; CHECK-READELF-NEXT: .gcc_except_table
28
29; EXCEPT-TABLE-STATIC: 0000 ff9b1501 0c001400 00140e22 01221e00 ..........."."..
30; EXCEPT-TABLE-STATIC: 0010 00010000 00000000
31; EXCEPT-TABLE-PIC:    0000 ff9b1501 0c002c00 002c123e 013e2a00 ......,..,.>.>*.
32; EXCEPT-TABLE-PIC:    0010 00010000 00000000                    ........
33
34@_ZTIi = external constant ptr
35
36define dso_local i32 @main() local_unnamed_addr personality ptr @__gxx_personality_v0 {
37entry:
38  %exception.i = tail call ptr @__cxa_allocate_exception(i32 4) nounwind
39  store i32 5, ptr %exception.i, align 16
40  invoke void @__cxa_throw(ptr %exception.i, ptr @_ZTIi, ptr null) noreturn
41          to label %.noexc unwind label %return
42
43.noexc:
44  unreachable
45
46return:
47  %0 = landingpad { ptr, i32 }
48          catch ptr null
49  %1 = extractvalue { ptr, i32 } %0, 0
50  %2 = tail call ptr @__cxa_begin_catch(ptr %1) nounwind
51  tail call void @__cxa_end_catch()
52  ret i32 0
53}
54
55declare i32 @__gxx_personality_v0(...)
56
57declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr
58
59declare void @__cxa_end_catch() local_unnamed_addr
60
61declare ptr @__cxa_allocate_exception(i32) local_unnamed_addr
62
63declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr
64