152 lines · plain
1## Verify that the compact unwind entries for two functions with identical2## unwind information and LSDA aren't folded together; see the comment in3## UnwindInfoSectionImpl::finalize for why.4 5# REQUIRES: x866# RUN: rm -rf %t; mkdir %t7# RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -emit-compact-unwind-non-canonical=true -o %t/lsda.o %s8# RUN: %lld -dylib --icf=all -lSystem -lc++ -o %t/liblsda.dylib %t/lsda.o9# RUN: llvm-objdump --macho --syms --unwind-info %t/liblsda.dylib | FileCheck %s10 11## Check that f and g have the same unwind encoding and LSDA offset (we need to12## link with ICF above in order to get the LSDA deduplicated), and that their13## compact unwind entries aren't folded.14 15# CHECK-LABEL: SYMBOL TABLE:16# CHECK: [[#%x,G_ADDR:]] {{.*}} __Z1gv17# CHECK: [[#%x,H_ADDR:]] {{.*}} __Z1hv18 19# CHECK-LABEL: Contents of __unwind_info section:20# CHECK: LSDA descriptors21# CHECK-NEXT: [0]: function offset=[[#%#.8x,G_ADDR]], LSDA offset=[[#%#x,LSDA:]]22# CHECK-NEXT: [1]: function offset=[[#%#.8x,H_ADDR]], LSDA offset=[[#%#.8x,LSDA]]23# CHECK-NEXT: Second level indices:24# CHECK: [1]: function offset=[[#%#.8x,G_ADDR]], encoding[0]=[[#%#x,ENCODING:]]25# CHECK: [2]: function offset=[[#%#.8x,H_ADDR]], encoding[0]=[[#%#.8x,ENCODING]]26 27## Generated from the following C++ code built with:28## clang -target x86_64-apple-macosx11.0 -S -Os -fno-inline -fomit-frame-pointer29## void f(int i) { throw i; }30## void g() { try { f(1); } catch (int) {} }31## void h() { try { f(2); } catch (int) {} }32 33 .section __TEXT,__text,regular,pure_instructions34 .globl __Z1fi ## -- Begin function _Z1fi35__Z1fi: ## @_Z1fi36 .cfi_startproc37 pushq %rbx38 .cfi_def_cfa_offset 1639 .cfi_offset %rbx, -1640 movl %edi, %ebx41 movl $4, %edi42 callq ___cxa_allocate_exception43 movl %ebx, (%rax)44 movq __ZTIi@GOTPCREL(%rip), %rsi45 movq %rax, %rdi46 xorl %edx, %edx47 callq ___cxa_throw48 .cfi_endproc49 ## -- End function50 .globl __Z1gv ## -- Begin function _Z1gv51__Z1gv: ## @_Z1gv52Lfunc_begin0:53 .cfi_startproc54 .cfi_personality 155, ___gxx_personality_v055 .cfi_lsda 16, Lexception056 pushq %rax57 .cfi_def_cfa_offset 1658Ltmp0:59 movl $1, %edi60 callq __Z1fi61Ltmp1:62 ud263LBB1_2: ## %lpad64Ltmp2:65 movq %rax, %rdi66 callq ___cxa_begin_catch67 popq %rax68 jmp ___cxa_end_catch ## TAILCALL69Lfunc_end0:70 .cfi_endproc71 .section __TEXT,__gcc_except_tab72 .p2align 2, 0x073GCC_except_table1:74Lexception0:75 .byte 255 ## @LPStart Encoding = omit76 .byte 155 ## @TType Encoding = indirect pcrel sdata477 .uleb128 Lttbase0-Lttbaseref078Lttbaseref0:79 .byte 1 ## Call site Encoding = uleb12880 .uleb128 Lcst_end0-Lcst_begin081Lcst_begin0:82 .uleb128 Ltmp0-Lfunc_begin0 ## >> Call Site 1 <<83 .uleb128 Ltmp1-Ltmp0 ## Call between Ltmp0 and Ltmp184 .uleb128 Ltmp2-Lfunc_begin0 ## jumps to Ltmp285 .byte 1 ## On action: 186 .uleb128 Ltmp1-Lfunc_begin0 ## >> Call Site 2 <<87 .uleb128 Lfunc_end0-Ltmp1 ## Call between Ltmp1 and Lfunc_end088 .byte 0 ## has no landing pad89 .byte 0 ## On action: cleanup90Lcst_end0:91 .byte 1 ## >> Action Record 1 <<92 ## Catch TypeInfo 193 .byte 0 ## No further actions94 .p2align 2, 0x095 ## >> Catch TypeInfos <<96 .long __ZTIi@GOTPCREL+4 ## TypeInfo 197Lttbase0:98 .p2align 2, 0x099 ## -- End function100 .section __TEXT,__text,regular,pure_instructions101 .globl __Z1hv ## -- Begin function _Z1hv102__Z1hv: ## @_Z1hv103Lfunc_begin1:104 .cfi_startproc105 .cfi_personality 155, ___gxx_personality_v0106 .cfi_lsda 16, Lexception1107 pushq %rax108 .cfi_def_cfa_offset 16109Ltmp3:110 movl $2, %edi111 callq __Z1fi112Ltmp4:113 ud2114LBB2_2: ## %lpad115Ltmp5:116 movq %rax, %rdi117 callq ___cxa_begin_catch118 popq %rax119 jmp ___cxa_end_catch ## TAILCALL120Lfunc_end1:121 .cfi_endproc122 .section __TEXT,__gcc_except_tab123 .p2align 2, 0x0124GCC_except_table2:125Lexception1:126 .byte 255 ## @LPStart Encoding = omit127 .byte 155 ## @TType Encoding = indirect pcrel sdata4128 .uleb128 Lttbase1-Lttbaseref1129Lttbaseref1:130 .byte 1 ## Call site Encoding = uleb128131 .uleb128 Lcst_end1-Lcst_begin1132Lcst_begin1:133 .uleb128 Ltmp3-Lfunc_begin1 ## >> Call Site 1 <<134 .uleb128 Ltmp4-Ltmp3 ## Call between Ltmp3 and Ltmp4135 .uleb128 Ltmp5-Lfunc_begin1 ## jumps to Ltmp5136 .byte 1 ## On action: 1137 .uleb128 Ltmp4-Lfunc_begin1 ## >> Call Site 2 <<138 .uleb128 Lfunc_end1-Ltmp4 ## Call between Ltmp4 and Lfunc_end1139 .byte 0 ## has no landing pad140 .byte 0 ## On action: cleanup141Lcst_end1:142 .byte 1 ## >> Action Record 1 <<143 ## Catch TypeInfo 1144 .byte 0 ## No further actions145 .p2align 2, 0x0146 ## >> Catch TypeInfos <<147 .long __ZTIi@GOTPCREL+4 ## TypeInfo 1148Lttbase1:149 .p2align 2, 0x0150 ## -- End function151.subsections_via_symbols152