Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / fold-dwarf-lsda.s
blobe651fa81b8b7ac3b84586d243a79b9def24a51a9
1 # REQUIRES: x86
2 ## Regression test for https://github.com/llvm/llvm-project/issues/63039
4 ## Use an old version to ensure we do *not* have any compact-unwind.
5 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-macos9 %s -o %t.o
7 ## Pre-cond: smoke-check that there is really no compact-unwind entries - only dwarfs.
8 # RUN: llvm-objdump --macho --unwind-info --dwarf=frames %t.o | FileCheck %s --check-prefix=PRE
9 # PRE-NOT: Contents of __compact_unwind section:
10 # PRE-NOT: Entry at offset
11 # PRE: .eh_frame contents:
12 # PRE: {{[0-9a-f]+}} {{.*}} CIE
13 # PRE: Format: DWARF32
14 # PRE: Version: 1
16 ## Link should succeed (ie., not crashed due to bug in icf code).
17 # RUN: %lld -lSystem -lc++ --icf=all -arch x86_64 -arch x86_64 -platform_version macos 11.0 11.0 %t.o -o %t.out
19 ## Post-cond: verify that the final binary has expected eh-frame contents.
20 # RUN: llvm-objdump --macho --syms --dwarf=frames %t.out | FileCheck %s --check-prefix=POST
21 # POST-LABEL: SYMBOL TABLE:
22 # POST: [[#%x,EXCEPT_ADDR:]] l O __TEXT,__gcc_except_tab GCC_except_table0
23 # POST: [[#%x,EXCEPT_ADDR]] l O __TEXT,__gcc_except_tab GCC_except_table1
24 # POST: [[#%.16x,F0_ADDR:]] g F __TEXT,__text _f0
25 # POST: [[#%.16x,F1_ADDR:]] g F __TEXT,__text _f1
26 # POST: [[#%.16x,G_ADDR:]] g F __TEXT,__text _g
28 # POST-LABEL: .eh_frame contents:
29 # POST: {{.*}} FDE cie={{.+}} pc=[[#%x,G_ADDR]]...{{.+}}
31 # POST: {{.*}} FDE cie={{.+}} pc=[[#%x,F0_ADDR]]...{{.+}}
32 # POST: Format: DWARF32
33 # POST: LSDA Address: [[#%.16x,EXCEPT_ADDR]]
35 # POST: {{.*}} FDE cie={{.+}} pc=[[#%x,F1_ADDR]]...{{.+}}
36 # POST Format: DWARF32
37 # POST LSDA Address: [[#%.16x,EXCEPT_ADDR]]
39 .section __TEXT,__text,regular,pure_instructions
40 .globl _f0
41 _f0:
42 .cfi_startproc
43 .cfi_lsda 16, Lexception0
44 .cfi_def_cfa_offset 16
45 .cfi_offset %rbp, -16
46 callq _g
47 retq
48 .cfi_endproc
50 .section __TEXT,__gcc_except_tab
51 GCC_except_table0:
52 Lexception0:
53 .byte 255
55 .section __TEXT,__text,regular,pure_instructions
56 .globl _f1
57 _f1:
58 .cfi_startproc
59 .cfi_lsda 16, Lexception1
60 .cfi_def_cfa_offset 16
61 .cfi_offset %rbp, -16
62 callq _g
63 retq
64 .cfi_endproc
66 .section __TEXT,__gcc_except_tab
67 GCC_except_table1:
68 Lexception1:
69 .byte 255
71 .section __TEXT,__text,regular,pure_instructions
72 .globl _g
73 _g:
74 .cfi_startproc
75 .cfi_def_cfa_offset 16
76 .cfi_offset %rbp, -16
77 .cfi_def_cfa_register %rbp
78 retq
79 .cfi_endproc
81 .section __TEXT,__text,regular,pure_instructions
82 .globl _main
83 _main:
84 retq
86 .subsections_via_symbols