llvm-project
86 строк · 2.5 Кб
1# REQUIRES: x86
2## Regression test for https://github.com/llvm/llvm-project/issues/63039
3
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
6
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
15
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
18
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
27
28# POST-LABEL: .eh_frame contents:
29# POST: {{.*}} FDE cie={{.+}} pc=[[#%x,G_ADDR]]...{{.+}}
30
31# POST: {{.*}} FDE cie={{.+}} pc=[[#%x,F0_ADDR]]...{{.+}}
32# POST: Format: DWARF32
33# POST: LSDA Address: [[#%.16x,EXCEPT_ADDR]]
34
35# POST: {{.*}} FDE cie={{.+}} pc=[[#%x,F1_ADDR]]...{{.+}}
36# POST Format: DWARF32
37# POST LSDA Address: [[#%.16x,EXCEPT_ADDR]]
38
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
46callq _g
47retq
48.cfi_endproc
49
50.section __TEXT,__gcc_except_tab
51GCC_except_table0:
52Lexception0:
53.byte 255
54
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
62callq _g
63retq
64.cfi_endproc
65
66.section __TEXT,__gcc_except_tab
67GCC_except_table1:
68Lexception1:
69.byte 255
70
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
78retq
79.cfi_endproc
80
81.section __TEXT,__text,regular,pure_instructions
82.globl _main
83_main:
84retq
85
86.subsections_via_symbols
87