1; RUN: llc -basic-block-sections=all -mtriple x86_64-pc-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,CHECK-NON-PIC 2; RUN: llc -basic-block-sections=all -mtriple x86_64-pc-linux-gnu -relocation-model=pic < %s | FileCheck %s --check-prefixes=CHECK,CHECK-PIC 3@_ZTIi = external constant i8* 4 5define i32 @main() uwtable optsize ssp personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) { 6; Verify that each basic block section gets its own LSDA exception symbol. 7; 8; CHECK-LABEL: main: 9; CHECK-NEXT: .Lfunc_begin0: 10; CHECK-NEXT: .cfi_startproc 11 12;; Verify personality function and LSDA encoding for NON-PIC mode. 13; PersonalityEncoding = dwarf::DW_EH_PE_udata4 14; CHECK-NON-PIC-NEXT: .cfi_personality 3, __gxx_personality_v0 15; LSDAEncoding = dwarf::DW_EH_PE_udata4 16; CHECK-NON-PIC-NEXT: .cfi_lsda 3, .Lexception0 17 18;; Verify personality function and LSDA encoding for PIC mode. 19; PersonalityEncoding = DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4 20; CHECK-PIC-NEXT: .cfi_personality 155, DW.ref.__gxx_personality_v0 21; LSDAEncoding = DW_EH_PE_pcrel | DW_EH_PE_sdata4 22; CHECK-PIC-NEXT: .cfi_lsda 27, .Lexception0 23 24; CHECK-LABEL: .Ltmp0: 25; CHECK-NEXT: callq _Z1fv 26; CHECK-LABEL: .Ltmp1: 27 28; CHECK-NOT: .cfi_lsda 29 30; CHECK-LABEL: main.1: 31; CHECK-NEXT: .cfi_startproc 32 33; CHECK-NON-PIC-NEXT: .cfi_personality 3, __gxx_personality_v0 34; CHECK-NON-PIC-NEXT: .cfi_lsda 3, .Lexception1 35 36; CHECK-PIC-NEXT: .cfi_personality 155, DW.ref.__gxx_personality_v0 37; CHECK-PIC-NEXT: .cfi_lsda 27, .Lexception1 38 39; CHECK-NOT: .cfi_lsda 40 41; CHECK-LABEL: main.2: 42; CHECK-NEXT: .cfi_startproc 43 44; CHECK-NON-PIC-NEXT: .cfi_personality 3, __gxx_personality_v0 45; CHECK-NON-PIC-NEXT: .cfi_lsda 3, .Lexception2 46 47; CHECK-PIC-NEXT: .cfi_personality 155, DW.ref.__gxx_personality_v0 48; CHECK-PIC-NEXT: .cfi_lsda 27, .Lexception2 49 50; CHECK: nop 51; CHECK-LABEL: .Ltmp2: 52; CHECK-LABEL: .LBB_END0_2: 53 54; CHECK-NOT: .cfi_lsda 55 56entry: 57 invoke void @_Z1fv() optsize 58 to label %try.cont unwind label %lpad 59 60lpad: 61 %0 = landingpad { i8*, i32 } 62 cleanup 63 catch i8* bitcast (i8** @_ZTIi to i8*) 64 br label %eh.resume 65 66try.cont: 67 ret i32 0 68 69eh.resume: 70 resume { i8*, i32 } %0 71} 72 73declare void @_Z1fv() optsize 74 75declare i32 @__gxx_personality_v0(...) 76;; Verify that the exception table gets split across the three basic block sections. 77; 78; CHECK: .section .gcc_except_table 79; CHECK-NEXT: .p2align 2 80; CHECK-NEXT: GCC_except_table0: 81; CHECK-NEXT: .Lexception0: 82 83;; Verify @LPStart encoding for NON-PIC mode. 84; CHECK-NON-PIC-NEXT: .byte 0 # @LPStart Encoding = absptr 85; CHECK-NON-PIC-NEXT: .quad main.2 86 87;; Verify @LPStart encoding for PIC mode. 88; CHECK-PIC-NEXT: .byte 16 # @LPStart Encoding = pcrel 89; CHECK-PIC-NEXT: [[DOT:\.Ltmp[0-9]+]]: 90; CHECK-PIC-NEXT: .quad main.2-[[DOT]] 91 92;; Verify @TType encoding for NON-PIC mode. 93; CHECK-NON-PIC-NEXT: .byte 3 # @TType Encoding = udata4 94 95;; Verify @TType encoding for PIC mode. 96; CHECK-PIC-NEXT: .byte 156 # @TType Encoding = indirect pcrel sdata8 97 98; CHECK-NEXT: .uleb128 .Lttbase0-.Lttbaseref0 99; CHECK-NEXT: .Lttbaseref0: 100; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128 101; CHECK-NEXT: .uleb128 .Laction_table_base0-.Lcst_begin0 102; CHECK-NEXT: .Lcst_begin0: 103; CHECK-NEXT: .uleb128 .Ltmp0-.Lfunc_begin0 # >> Call Site 1 << 104; CHECK-NEXT: .uleb128 .Ltmp1-.Ltmp0 # Call between .Ltmp0 and .Ltmp1 105; CHECK-NEXT: .uleb128 .Ltmp2-main.2 # jumps to .Ltmp2 106; CHECK-NEXT: .byte 3 # On action: 2 107; CHECK-NEXT: .p2align 2 108; CHECK-NEXT: .Lexception1: 109 110; CHECK-NON-PIC-NEXT: .byte 0 # @LPStart Encoding = absptr 111; CHECK-NON-PIC-NEXT: .quad main.2 112 113; CHECK-PIC-NEXT: .byte 16 # @LPStart Encoding = pcrel 114; CHECK-PIC-NEXT: [[DOT:\.Ltmp[0-9]+]]: 115; CHECK-PIC-NEXT: .quad main.2-[[DOT]] 116 117; CHECK-NON-PIC-NEXT: .byte 3 # @TType Encoding = udata4 118 119; CHECK-PIC-NEXT: .byte 156 # @TType Encoding = indirect pcrel sdata8 120 121; CHECK-NEXT: .uleb128 .Lttbase0-.Lttbaseref1 122; CHECK-NEXT: .Lttbaseref1: 123; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128 124; CHECK-NEXT: .uleb128 .Laction_table_base0-.Lcst_begin1 125; CHECK-NEXT: .Lcst_begin1: 126; CHECK-NEXT: .p2align 2 127; CHECK-NEXT: .Lexception2: 128 129; CHECK-NON-PIC-NEXT: .byte 0 # @LPStart Encoding = absptr 130; CHECK-NON-PIC-NEXT: .quad main.2 131 132; CHECK-PIC-NEXT: .byte 16 # @LPStart Encoding = pcrel 133; CHECK-PIC-NEXT: [[DOT:\.Ltmp[0-9]+]]: 134; CHECK-PIC-NEXT: .quad main.2-[[DOT]] 135 136; CHECK-NON-PIC-NEXT: .byte 3 # @TType Encoding = udata4 137 138; CHECK-PIC-NEXT: .byte 156 # @TType Encoding = indirect pcrel sdata8 139 140; CHECK-NEXT: .uleb128 .Lttbase0-.Lttbaseref2 141; CHECK-NEXT: .Lttbaseref2: 142; CHECK-NEXT: .byte 1 # Call site Encoding = uleb128 143; CHECK-NEXT: .uleb128 .Laction_table_base0-.Lcst_begin2 144; CHECK-NEXT: .Lcst_begin2: 145; CHECK-NEXT: .uleb128 main.2-main.2 # >> Call Site 2 << 146; CHECK-NEXT: .uleb128 .LBB_END0_2-main.2 # Call between main.2 and .LBB_END0_2 147; CHECK-NEXT: .byte 0 # has no landing pad 148; CHECK-NEXT: .byte 0 # On action: cleanup 149; CHECK-NEXT: .Laction_table_base0: 150; CHECK-NEXT: .byte 0 # >> Action Record 1 << 151; CHECK-NEXT: # Cleanup 152; CHECK-NEXT: .byte 0 # No further actions 153; CHECK-NEXT: .byte 1 # >> Action Record 2 << 154; CHECK-NEXT: # Catch TypeInfo 1 155; CHECK-NEXT: .byte 125 # Continue to action 1 156; CHECK-NEXT: .p2align 2 157; CHECK-NEXT: # >> Catch TypeInfos << 158 159; CHECK-NON-PIC-NEXT: .long _ZTIi # TypeInfo 1 160 161; CHECK-PIC-NEXT: [[DOT:\.Ltmp[0-9]+]]: 162; CHECK-PIC-NEXT: .quad .L_ZTIi.DW.stub-[[DOT]] 163 164; CHECK-NEXT: .Lttbase0: 165; CHECK-NEXT: .p2align 2 166; CHECK-NEXT: # -- End function 167