1 ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=static -simplifycfg-require-and-preserve-domtree=1 -o - %s | FileCheck %s
2 ; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -simplifycfg-require-and-preserve-domtree=1 -o - %s | FileCheck %s
3 ; RUN: llc -mtriple=aarch64_be-none-linux-gnu -relocation-model=pic -simplifycfg-require-and-preserve-domtree=1 -o - %s | FileCheck %s
5 ; Make sure exception-handling PIC code can be linked correctly. An alternative
6 ; to the sequence described below would have .gcc_except_table itself writable
7 ; and not use the indirection, but this isn't what LLVM does right now.
9 ; There should be a read-only .gcc_except_table section...
10 ; CHECK: .section .gcc_except_table,"a"
12 ; ... referring indirectly to stubs for its typeinfo ...
13 ; CHECK: // @TType Encoding = indirect pcrel sdata8
14 ; ... one of which is "int"'s typeinfo
15 ; CHECK: [[TYPEINFO_LBL:.Ltmp[0-9]+]]: // TypeInfo 1
16 ; CHECK-NEXT: .xword .L_ZTIi.DW.stub-[[TYPEINFO_LBL]]
18 ; .. and which is properly defined (in a writable section for the dynamic loader) later.
20 ; CHECK: .L_ZTIi.DW.stub:
21 ; CHECK-NEXT: .xword _ZTIi
23 @_ZTIi = external constant ptr
25 define i32 @_Z3barv() personality ptr @__gxx_personality_v0 {
27 invoke void @_Z3foov()
28 to label %return unwind label %lpad
30 lpad: ; preds = %entry
31 %0 = landingpad { ptr, i32 }
33 %1 = extractvalue { ptr, i32 } %0, 1
34 %2 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi) nounwind
35 %matches = icmp eq i32 %1, %2
36 br i1 %matches, label %catch, label %eh.resume
38 catch: ; preds = %lpad
39 %3 = extractvalue { ptr, i32 } %0, 0
40 %4 = tail call ptr @__cxa_begin_catch(ptr %3) nounwind
41 %exn.scalar = load i32, ptr %4, align 4
42 tail call void @__cxa_end_catch() nounwind
45 return: ; preds = %entry, %catch
46 %retval.0 = phi i32 [ %exn.scalar, %catch ], [ 42, %entry ]
49 eh.resume: ; preds = %lpad
50 resume { ptr, i32 } %0
53 declare void @_Z3foov()
55 declare i32 @__gxx_personality_v0(...)
57 declare i32 @llvm.eh.typeid.for(ptr) nounwind readnone
59 declare ptr @__cxa_begin_catch(ptr)
61 declare void @__cxa_end_catch()