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 4 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. 8 9 ; There should be a read-only .gcc_except_table section... 10; CHECK: .section .gcc_except_table,"a" 11 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]] 17 18 ; .. and which is properly defined (in a writable section for the dynamic loader) later. 19; CHECK: .data 20; CHECK: .L_ZTIi.DW.stub: 21; CHECK-NEXT: .xword _ZTIi 22 23@_ZTIi = external constant ptr 24 25define i32 @_Z3barv() personality ptr @__gxx_personality_v0 { 26entry: 27 invoke void @_Z3foov() 28 to label %return unwind label %lpad 29 30lpad: ; preds = %entry 31 %0 = landingpad { ptr, i32 } 32 catch ptr @_ZTIi 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 37 38catch: ; 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 43 br label %return 44 45return: ; preds = %entry, %catch 46 %retval.0 = phi i32 [ %exn.scalar, %catch ], [ 42, %entry ] 47 ret i32 %retval.0 48 49eh.resume: ; preds = %lpad 50 resume { ptr, i32 } %0 51} 52 53declare void @_Z3foov() 54 55declare i32 @__gxx_personality_v0(...) 56 57declare i32 @llvm.eh.typeid.for(ptr) nounwind readnone 58 59declare ptr @__cxa_begin_catch(ptr) 60 61declare void @__cxa_end_catch() 62