62 lines · plain
1; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=static -simplifycfg-require-and-preserve-domtree=1 -o - %s | FileCheck %s2; RUN: llc -mtriple=aarch64-none-linux-gnu -relocation-model=pic -simplifycfg-require-and-preserve-domtree=1 -o - %s | FileCheck %s3; RUN: llc -mtriple=aarch64_be-none-linux-gnu -relocation-model=pic -simplifycfg-require-and-preserve-domtree=1 -o - %s | FileCheck %s4 5; Make sure exception-handling PIC code can be linked correctly. An alternative6; to the sequence described below would have .gcc_except_table itself writable7; 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 sdata814 ; ... one of which is "int"'s typeinfo15; CHECK: [[TYPEINFO_LBL:.Ltmp[0-9]+]]: // TypeInfo 116; 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: .data20; CHECK: .L_ZTIi.DW.stub:21; CHECK-NEXT: .xword _ZTIi22 23@_ZTIi = external constant ptr24 25define i32 @_Z3barv() personality ptr @__gxx_personality_v0 {26entry:27 invoke void @_Z3foov()28 to label %return unwind label %lpad29 30lpad: ; preds = %entry31 %0 = landingpad { ptr, i32 }32 catch ptr @_ZTIi33 %1 = extractvalue { ptr, i32 } %0, 134 %2 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi) nounwind35 %matches = icmp eq i32 %1, %236 br i1 %matches, label %catch, label %eh.resume37 38catch: ; preds = %lpad39 %3 = extractvalue { ptr, i32 } %0, 040 %4 = tail call ptr @__cxa_begin_catch(ptr %3) nounwind41 %exn.scalar = load i32, ptr %4, align 442 tail call void @__cxa_end_catch() nounwind43 br label %return44 45return: ; preds = %entry, %catch46 %retval.0 = phi i32 [ %exn.scalar, %catch ], [ 42, %entry ]47 ret i32 %retval.048 49eh.resume: ; preds = %lpad50 resume { ptr, i32 } %051}52 53declare void @_Z3foov()54 55declare i32 @__gxx_personality_v0(...)56 57declare i32 @llvm.eh.typeid.for(ptr) nounwind readnone58 59declare ptr @__cxa_begin_catch(ptr)60 61declare void @__cxa_end_catch()62