Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / compact-unwind-foldings.s
blob18511da772144c5f92933f07359bbe3bb49d7d1e
1 # REQUIRES: x86
2 # Tests to verify that
3 # - the folded CUEs covered up to the last entries, even if they were removed/folded.
4 # - only entries that *should* be in eh_frame are actually included. (**)
5 # (**) This is where LD64 does differently.
7 # RUN: rm -rf %t; split-file %s %t
8 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/fold-tail.s -o %t/fold-tail.o
9 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/cues-range-gap.s -o %t/cues-range-gap.o
11 # RUN: %lld -o %t/fold-tail.out %t/fold-tail.o
12 # RUN: llvm-objdump --macho --syms --unwind-info %t/fold-tail.out | FileCheck %s
14 # RUN: %lld -o %t/cues-range-gap.out %t/cues-range-gap.o
16 # CHECK-LABEL: SYMBOL TABLE:
17 # CHECK: [[#%x,A_ADDR:]] l F __TEXT,__text _a
18 # CHECK: [[#%x,B_ADDR:]] l F __TEXT,__text _b
19 # CHECK: [[#%x,C_ADDR:]] l F __TEXT,__text _c
20 # CHECK: [[#%x,D_ADDR:]] l F __TEXT,__text _d
21 # CHECK: [[#%x,MAIN_ADDR:]] g F __TEXT,__text _main
23 ## Check that [1] offset starts at c's address + 3 (its length).
24 # CHECK-LABEL: Contents of __unwind_info section:
25 # CHECK: Top level indices: (count = 2)
26 # CHECK-NEXT : [0]: function offset=[[#%#.7x,MAIN_ADDR]]
27 # CHECK-NEXT : [1]: function offset=[[#%#.7x,C_ADDR + 3]]
29 #--- fold-tail.s
30 .text
31 .globl _main
32 .p2align 4, 0x90
33 _main:
34 .cfi_startproc
35 callq _a
36 retq
37 .cfi_endproc
39 .p2align 4, 0x90
40 _a:
41 .cfi_startproc
42 callq _b
43 retq
44 .cfi_endproc
46 .p2align 4, 0x90
47 _b:
48 .cfi_startproc
49 callq _c
50 retq
51 .cfi_endproc
53 .p2align 4, 0x90
54 _c:
55 .cfi_startproc
56 retq
57 .cfi_endproc
59 // _d should NOT have an entry in .eh_frame
60 // So it shouldn't be covered by the unwind table.
61 _d:
62 xorl %eax, %eax
63 ret
65 .subsections_via_symbols
67 #--- cues-range-gap.s
68 .text
69 .globl _main
70 .p2align 4, 0x90
71 _main:
72 .cfi_startproc
73 callq _a
74 retq
75 .cfi_endproc
77 .p2align 4, 0x90
78 _a:
79 .cfi_startproc
80 callq _b
81 retq
82 .cfi_endproc
84 // _d is intentionally placed in between the symbols with eh_frame entries.
85 // but _d should NOT have an entry in .eh_frame
86 // So it shouldn't be covered by the unwind table.
87 _d:
88 xorl %eax, %eax
89 ret
91 .p2align 4, 0x90
92 _b:
93 .cfi_startproc
94 callq _c
95 retq
96 .cfi_endproc
98 .p2align 4, 0x90
99 _c:
100 .cfi_startproc
101 retq
102 .cfi_endproc
104 .subsections_via_symbols