1 ## Verify that the compact unwind entries for two functions with identical
2 ## unwind information and LSDA aren't folded together; see the comment in
3 ## UnwindInfoSectionImpl::finalize for why.
6 # RUN: rm -rf %t; mkdir %t
7 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos11.0 -emit-compact-unwind-non-canonical=true -o %t/lsda.o %s
8 # RUN: %lld -dylib --icf=all -lSystem -lc++ -o %t/liblsda.dylib %t/lsda.o
9 # RUN: llvm-objdump --macho --syms --unwind-info %t/liblsda.dylib | FileCheck %s
11 ## Check that f and g have the same unwind encoding and LSDA offset (we need to
12 ## link with ICF above in order to get the LSDA deduplicated), and that their
13 ## compact unwind entries aren't folded.
15 # CHECK-LABEL: SYMBOL TABLE:
16 # CHECK: [[#%x,G_ADDR:]] {{.*}} __Z1gv
17 # CHECK: [[#%x,H_ADDR:]] {{.*}} __Z1hv
19 # CHECK-LABEL: Contents of __unwind_info section:
20 # CHECK: LSDA descriptors
21 # 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]]
27 ## Generated from the following C++ code built with:
28 ## clang -target x86_64-apple-macosx11.0 -S -Os -fno-inline -fomit-frame-pointer
29 ## void f(int i) { throw i; }
30 ## void g() { try { f(1); } catch (int) {} }
31 ## void h() { try { f(2); } catch (int) {} }
33 .section __TEXT,__text,regular,pure_instructions
34 .globl __Z1fi ## -- Begin function _Z1fi
38 .cfi_def_cfa_offset 16
42 callq ___cxa_allocate_exception
44 movq __ZTIi@GOTPCREL
(%rip
), %rsi
50 .globl __Z1gv ## -- Begin function _Z1gv
54 .cfi_personality 155, ___gxx_personality_v0
55 .cfi_lsda 16, Lexception0
57 .cfi_def_cfa_offset 16
66 callq ___cxa_begin_catch
68 jmp ___cxa_end_catch
## TAILCALL
71 .section __TEXT,__gcc_except_tab
75 .byte 255 ## @LPStart Encoding = omit
76 .byte 155 ## @TType Encoding = indirect pcrel sdata4
77 .uleb128 Lttbase0-Lttbaseref0
79 .byte 1 ## Call site Encoding = uleb128
80 .uleb128 Lcst_end0-Lcst_begin0
82 .uleb128 Ltmp0-Lfunc_begin0 ## >> Call Site 1 <<
83 .uleb128 Ltmp1-Ltmp0 ## Call between Ltmp0 and Ltmp1
84 .uleb128 Ltmp2-Lfunc_begin0 ## jumps to Ltmp2
85 .byte 1 ## On action: 1
86 .uleb128 Ltmp1-Lfunc_begin0 ## >> Call Site 2 <<
87 .uleb128 Lfunc_end0-Ltmp1 ## Call between Ltmp1 and Lfunc_end0
88 .byte 0 ## has no landing pad
89 .byte 0 ## On action: cleanup
91 .byte 1 ## >> Action Record 1 <<
93 .byte 0 ## No further actions
95 ## >> Catch TypeInfos <<
96 .long __ZTIi@GOTPCREL+4 ## TypeInfo 1
100 .section __TEXT,__text,regular,pure_instructions
101 .globl __Z1hv ## -- Begin function _Z1hv
105 .cfi_personality 155, ___gxx_personality_v0
106 .cfi_lsda 16, Lexception1
108 .cfi_def_cfa_offset 16
117 callq ___cxa_begin_catch
119 jmp ___cxa_end_catch
## TAILCALL
122 .section __TEXT,__gcc_except_tab
126 .byte 255 ## @LPStart Encoding = omit
127 .byte 155 ## @TType Encoding = indirect pcrel sdata4
128 .uleb128 Lttbase1-Lttbaseref1
130 .byte 1 ## Call site Encoding = uleb128
131 .uleb128 Lcst_end1-Lcst_begin1
133 .uleb128 Ltmp3-Lfunc_begin1 ## >> Call Site 1 <<
134 .uleb128 Ltmp4-Ltmp3 ## Call between Ltmp3 and Ltmp4
135 .uleb128 Ltmp5-Lfunc_begin1 ## jumps to Ltmp5
136 .byte 1 ## On action: 1
137 .uleb128 Ltmp4-Lfunc_begin1 ## >> Call Site 2 <<
138 .uleb128 Lfunc_end1-Ltmp4 ## Call between Ltmp4 and Lfunc_end1
139 .byte 0 ## has no landing pad
140 .byte 0 ## On action: cleanup
142 .byte 1 ## >> Action Record 1 <<
144 .byte 0 ## No further actions
146 ## >> Catch TypeInfos <<
147 .long __ZTIi@GOTPCREL+4 ## TypeInfo 1
151 .subsections_via_symbols