Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / MachO / invalid / undef-debug.s
blob7cf75fa898274df8a9212645b06fc4bde16cefdf
1 # REQUIRES: aarch64
2 # RUN: llvm-mc -filetype=obj -triple=arm64-apple-macos %s -o %t.o
3 # RUN: not %lld -arch arm64 %t.o -o /dev/null 2>&1 | FileCheck %s
5 # CHECK: undefined symbol: _undef
6 # CHECK-NEXT: >>> referenced by test.c:3
7 # CHECK-NEXT: >>> {{.*}}.o:(symbol _main+0x0)
8 # CHECK-NEXT: >>> referenced by test.c:2
9 # CHECK-NEXT >>> {{.*}}.o:(symbol _ptr+0x0)
11 ## This is the output of `clang -g2 -O2 -fdebug-compilation-dir=. -fno-ident` called on the following file, with the
12 ## Apple DWARF tables removed:
14 ## int undef();
15 ## int (*ptr)() = &undef;
16 ## int main() { return undef(); };
19 .section __TEXT,__text,regular,pure_instructions
20 .build_version macos, 12, 0 sdk_version 13, 0
21 .file 1 "." "test.c"
22 .globl _main ; -- Begin function main
23 .p2align 2
24 _main: ; @main
25 Lfunc_begin0:
26 .loc 1 3 0 ; test.c:3:0
27 .cfi_startproc
28 ; %bb.0:
29 .loc 1 3 21 prologue_end ; test.c:3:21
30 b _undef
31 Ltmp0:
32 Lfunc_end0:
33 .cfi_endproc
34 ; -- End function
35 .section __DATA,__data
36 .globl _ptr ; @ptr
37 .p2align 3
38 _ptr:
39 .quad _undef
41 .section __DWARF,__debug_abbrev,regular,debug
42 Lsection_abbrev:
43 .byte 1 ; Abbreviation Code
44 .byte 17 ; DW_TAG_compile_unit
45 .byte 1 ; DW_CHILDREN_yes
46 .byte 37 ; DW_AT_producer
47 .byte 14 ; DW_FORM_strp
48 .byte 19 ; DW_AT_language
49 .byte 5 ; DW_FORM_data2
50 .byte 3 ; DW_AT_name
51 .byte 14 ; DW_FORM_strp
52 .ascii "\202|" ; DW_AT_LLVM_sysroot
53 .byte 14 ; DW_FORM_strp
54 .ascii "\357\177" ; DW_AT_APPLE_sdk
55 .byte 14 ; DW_FORM_strp
56 .byte 16 ; DW_AT_stmt_list
57 .byte 23 ; DW_FORM_sec_offset
58 .byte 27 ; DW_AT_comp_dir
59 .byte 14 ; DW_FORM_strp
60 .ascii "\341\177" ; DW_AT_APPLE_optimized
61 .byte 25 ; DW_FORM_flag_present
62 .byte 17 ; DW_AT_low_pc
63 .byte 1 ; DW_FORM_addr
64 .byte 18 ; DW_AT_high_pc
65 .byte 6 ; DW_FORM_data4
66 .byte 0 ; EOM(1)
67 .byte 0 ; EOM(2)
68 .byte 2 ; Abbreviation Code
69 .byte 52 ; DW_TAG_variable
70 .byte 0 ; DW_CHILDREN_no
71 .byte 3 ; DW_AT_name
72 .byte 14 ; DW_FORM_strp
73 .byte 73 ; DW_AT_type
74 .byte 19 ; DW_FORM_ref4
75 .byte 63 ; DW_AT_external
76 .byte 25 ; DW_FORM_flag_present
77 .byte 58 ; DW_AT_decl_file
78 .byte 11 ; DW_FORM_data1
79 .byte 59 ; DW_AT_decl_line
80 .byte 11 ; DW_FORM_data1
81 .byte 2 ; DW_AT_location
82 .byte 24 ; DW_FORM_exprloc
83 .byte 0 ; EOM(1)
84 .byte 0 ; EOM(2)
85 .byte 3 ; Abbreviation Code
86 .byte 15 ; DW_TAG_pointer_type
87 .byte 0 ; DW_CHILDREN_no
88 .byte 73 ; DW_AT_type
89 .byte 19 ; DW_FORM_ref4
90 .byte 0 ; EOM(1)
91 .byte 0 ; EOM(2)
92 .byte 4 ; Abbreviation Code
93 .byte 21 ; DW_TAG_subroutine_type
94 .byte 1 ; DW_CHILDREN_yes
95 .byte 73 ; DW_AT_type
96 .byte 19 ; DW_FORM_ref4
97 .byte 0 ; EOM(1)
98 .byte 0 ; EOM(2)
99 .byte 5 ; Abbreviation Code
100 .byte 24 ; DW_TAG_unspecified_parameters
101 .byte 0 ; DW_CHILDREN_no
102 .byte 0 ; EOM(1)
103 .byte 0 ; EOM(2)
104 .byte 6 ; Abbreviation Code
105 .byte 36 ; DW_TAG_base_type
106 .byte 0 ; DW_CHILDREN_no
107 .byte 3 ; DW_AT_name
108 .byte 14 ; DW_FORM_strp
109 .byte 62 ; DW_AT_encoding
110 .byte 11 ; DW_FORM_data1
111 .byte 11 ; DW_AT_byte_size
112 .byte 11 ; DW_FORM_data1
113 .byte 0 ; EOM(1)
114 .byte 0 ; EOM(2)
115 .byte 7 ; Abbreviation Code
116 .byte 46 ; DW_TAG_subprogram
117 .byte 0 ; DW_CHILDREN_no
118 .byte 17 ; DW_AT_low_pc
119 .byte 1 ; DW_FORM_addr
120 .byte 18 ; DW_AT_high_pc
121 .byte 6 ; DW_FORM_data4
122 .ascii "\347\177" ; DW_AT_APPLE_omit_frame_ptr
123 .byte 25 ; DW_FORM_flag_present
124 .byte 64 ; DW_AT_frame_base
125 .byte 24 ; DW_FORM_exprloc
126 .byte 3 ; DW_AT_name
127 .byte 14 ; DW_FORM_strp
128 .byte 58 ; DW_AT_decl_file
129 .byte 11 ; DW_FORM_data1
130 .byte 59 ; DW_AT_decl_line
131 .byte 11 ; DW_FORM_data1
132 .byte 73 ; DW_AT_type
133 .byte 19 ; DW_FORM_ref4
134 .byte 63 ; DW_AT_external
135 .byte 25 ; DW_FORM_flag_present
136 .ascii "\341\177" ; DW_AT_APPLE_optimized
137 .byte 25 ; DW_FORM_flag_present
138 .byte 0 ; EOM(1)
139 .byte 0 ; EOM(2)
140 .byte 0 ; EOM(3)
141 .section __DWARF,__debug_info,regular,debug
142 Lsection_info:
143 Lcu_begin0:
144 .set Lset0, Ldebug_info_end0-Ldebug_info_start0 ; Length of Unit
145 .long Lset0
146 Ldebug_info_start0:
147 .short 4 ; DWARF version number
148 .set Lset1, Lsection_abbrev-Lsection_abbrev ; Offset Into Abbrev. Section
149 .long Lset1
150 .byte 8 ; Address Size (in bytes)
151 .byte 1 ; Abbrev [1] 0xb:0x69 DW_TAG_compile_unit
152 .long 0 ; DW_AT_producer
153 .short 12 ; DW_AT_language
154 .long 1 ; DW_AT_name
155 .long 8 ; DW_AT_LLVM_sysroot
156 .long 60 ; DW_AT_APPLE_sdk
157 .set Lset2, Lline_table_start0-Lsection_line ; DW_AT_stmt_list
158 .long Lset2
159 .long 71 ; DW_AT_comp_dir
160 ; DW_AT_APPLE_optimized
161 .quad Lfunc_begin0 ; DW_AT_low_pc
162 .set Lset3, Lfunc_end0-Lfunc_begin0 ; DW_AT_high_pc
163 .long Lset3
164 .byte 2 ; Abbrev [2] 0x32:0x15 DW_TAG_variable
165 .long 73 ; DW_AT_name
166 .long 71 ; DW_AT_type
167 ; DW_AT_external
168 .byte 1 ; DW_AT_decl_file
169 .byte 2 ; DW_AT_decl_line
170 .byte 9 ; DW_AT_location
171 .byte 3
172 .quad _ptr
173 .byte 3 ; Abbrev [3] 0x47:0x5 DW_TAG_pointer_type
174 .long 76 ; DW_AT_type
175 .byte 4 ; Abbrev [4] 0x4c:0x7 DW_TAG_subroutine_type
176 .long 83 ; DW_AT_type
177 .byte 5 ; Abbrev [5] 0x51:0x1 DW_TAG_unspecified_parameters
178 .byte 0 ; End Of Children Mark
179 .byte 6 ; Abbrev [6] 0x53:0x7 DW_TAG_base_type
180 .long 77 ; DW_AT_name
181 .byte 5 ; DW_AT_encoding
182 .byte 4 ; DW_AT_byte_size
183 .byte 7 ; Abbrev [7] 0x5a:0x19 DW_TAG_subprogram
184 .quad Lfunc_begin0 ; DW_AT_low_pc
185 .set Lset4, Lfunc_end0-Lfunc_begin0 ; DW_AT_high_pc
186 .long Lset4
187 ; DW_AT_APPLE_omit_frame_ptr
188 .byte 1 ; DW_AT_frame_base
189 .byte 111
190 .long 81 ; DW_AT_name
191 .byte 1 ; DW_AT_decl_file
192 .byte 3 ; DW_AT_decl_line
193 .long 83 ; DW_AT_type
194 ; DW_AT_external
195 ; DW_AT_APPLE_optimized
196 .byte 0 ; End Of Children Mark
197 Ldebug_info_end0:
198 .section __DWARF,__debug_str,regular,debug
199 Linfo_string:
200 .byte 0 ; string offset=0
201 .asciz "test.c" ; string offset=1
202 .asciz "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" ; string offset=8
203 .asciz "MacOSX.sdk" ; string offset=60
204 .asciz "." ; string offset=71
205 .asciz "ptr" ; string offset=73
206 .asciz "int" ; string offset=77
207 .asciz "main" ; string offset=81
208 .section __DWARF,__debug_line,regular,debug
209 Lsection_line:
210 Lline_table_start0: