1 # REQUIRES: system-linux
3 # RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
4 # RUN: %clang %cflags -gdwarf-4 %t.o -o %t.exe
5 # RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
6 # RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
8 # This test checks that BOLT handles DW_AT_sibling.
10 # The assembly was manually modified to do cross CU reference.
12 # POSTCHECK: version = 0x0004
13 # POSTCHECK: DW_TAG_structure_type [5]
14 # POSTCHECK: DW_AT_sibling [DW_FORM_ref4] (cu + 0x0062 => {0x00000062})
16 # POSTCHECK-NEXT: DW_TAG_typedef [6]
17 # POSTCHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0059 => {0x00000059} "structure ")
32 .globl main # -- Begin function main
37 .file 1 "/dwarf4-sibling-test" "main.cpp"
38 .loc 1 7 0 # main.cpp:7:0
42 .cfi_def_cfa_offset 16
45 .cfi_def_cfa_register %rbp
47 .loc 1 9 7 prologue_end # main.cpp:9:7
48 movl $
1688469761, -8(%rbp
) # imm = 0x64A40101
49 .loc 1 10 1 # main.cpp:10:1
51 .loc 1 10 1 epilogue_begin is_stmt 0 # main.cpp:10:1
57 .size main, .Lfunc_end0-main
60 .section .debug_abbrev,"",@progbits
61 .byte 1 # Abbreviation Code
62 .byte 17 # DW_TAG_compile_unit
63 .byte 1 # DW_CHILDREN_yes
64 .byte 37 # DW_AT_producer
65 .byte 14 # DW_FORM_strp
66 .byte 19 # DW_AT_language
67 .byte 5 # DW_FORM_data2
69 .byte 14 # DW_FORM_strp
70 .byte 16 # DW_AT_stmt_list
71 .byte 23 # DW_FORM_sec_offset
72 .byte 27 # DW_AT_comp_dir
73 .byte 14 # DW_FORM_strp
74 .byte 17 # DW_AT_low_pc
75 .byte 1 # DW_FORM_addr
76 .byte 18 # DW_AT_high_pc
77 .byte 6 # DW_FORM_data4
80 .byte 2 # Abbreviation Code
81 .byte 46 # DW_TAG_subprogram
82 .byte 1 # DW_CHILDREN_yes
83 .byte 17 # DW_AT_low_pc
84 .byte 1 # DW_FORM_addr
85 .byte 18 # DW_AT_high_pc
86 .byte 6 # DW_FORM_data4
87 .byte 64 # DW_AT_frame_base
88 .byte 24 # DW_FORM_exprloc
90 .byte 14 # DW_FORM_strp
91 .byte 58 # DW_AT_decl_file
92 .byte 11 # DW_FORM_data1
93 .byte 59 # DW_AT_decl_line
94 .byte 11 # DW_FORM_data1
96 .byte 19 # DW_FORM_ref4
97 .byte 63 # DW_AT_external
98 .byte 25 # DW_FORM_flag_present
101 .byte 3 # Abbreviation Code
102 .byte 52 # DW_TAG_variable
103 .byte 0 # DW_CHILDREN_no
104 .byte 2 # DW_AT_location
105 .byte 24 # DW_FORM_exprloc
107 .byte 14 # DW_FORM_strp
108 .byte 58 # DW_AT_decl_file
109 .byte 11 # DW_FORM_data1
110 .byte 59 # DW_AT_decl_line
111 .byte 11 # DW_FORM_data1
112 .byte 73 # DW_AT_type
113 .byte 19 # DW_FORM_ref4
116 .byte 4 # Abbreviation Code
117 .byte 36 # DW_TAG_base_type
118 .byte 0 # DW_CHILDREN_no
120 .byte 14 # DW_FORM_strp
121 .byte 62 # DW_AT_encoding
122 .byte 11 # DW_FORM_data1
123 .byte 11 # DW_AT_byte_size
124 .byte 11 # DW_FORM_data1
127 .byte 5 # Abbreviation Code
128 .byte 22 # DW_TAG_typedef
129 .byte 0 # DW_CHILDREN_no
130 .byte 73 # DW_AT_type
131 .byte 19 # DW_FORM_ref4
133 .byte 14 # DW_FORM_strp
134 .byte 58 # DW_AT_decl_file
135 .byte 11 # DW_FORM_data1
136 .byte 59 # DW_AT_decl_line
137 .byte 11 # DW_FORM_data1
140 .byte 6 # Abbreviation Code
141 .byte 19 # DW_TAG_structure_type
142 .byte 1 # DW_CHILDREN_yes
143 .byte 54 # DW_AT_calling_convention
144 .byte 11 # DW_FORM_data1
145 .byte 11 # DW_AT_byte_size
146 .byte 11 # DW_FORM_data1
147 .byte 58 # DW_AT_decl_file
148 .byte 11 # DW_FORM_data1
149 .byte 59 # DW_AT_decl_line
150 .byte 11 # DW_FORM_data1
151 .byte 1 # DW_AT_sibling <-- manually added
152 .byte 19 # DW_FORM_ref4
155 .byte 7 # Abbreviation Code
156 .byte 13 # DW_TAG_member
157 .byte 0 # DW_CHILDREN_no
159 .byte 14 # DW_FORM_strp
160 .byte 73 # DW_AT_type
161 .byte 19 # DW_FORM_ref4
162 .byte 58 # DW_AT_decl_file
163 .byte 11 # DW_FORM_data1
164 .byte 59 # DW_AT_decl_line
165 .byte 11 # DW_FORM_data1
166 .byte 56 # DW_AT_data_member_location
167 .byte 11 # DW_FORM_data1
171 .section .debug_info,"",@progbits
173 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
175 .short 4 # DWARF version number
176 .long .debug_abbrev # Offset Into Abbrev. Section
177 .byte 8 # Address Size (in bytes)
178 .byte 1 # Abbrev [1] 0xb:0x7f DW_TAG_compile_unit
179 .long .Linfo_string0 # DW_AT_producer
180 .short 33 # DW_AT_language
181 .long .Linfo_string1 # DW_AT_name
182 .long .Lline_table_start0 # DW_AT_stmt_list
183 .long .Linfo_string2 # DW_AT_comp_dir
184 .quad .Lfunc_begin0 # DW_AT_low_pc
185 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
186 .byte 2 # Abbrev [2] 0x2a:0x28 DW_TAG_subprogram
187 .quad .Lfunc_begin0 # DW_AT_low_pc
188 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
189 .byte 1 # DW_AT_frame_base
191 .long .Linfo_string3 # DW_AT_name
192 .byte 1 # DW_AT_decl_file
193 .byte 7 # DW_AT_decl_line
194 .long 82 # DW_AT_type
196 .byte 3 # Abbrev [3] 0x43:0xe DW_TAG_variable
197 .byte 2 # DW_AT_location
200 .long .Linfo_string5 # DW_AT_name
201 .byte 1 # DW_AT_decl_file
202 .byte 8 # DW_AT_decl_line
203 .long 89 # DW_AT_type
204 .byte 0 # End Of Children Mark
205 .byte 4 # Abbrev [4] 0x52:0x7 DW_TAG_base_type
206 .long .Linfo_string4 # DW_AT_name
207 .byte 5 # DW_AT_encoding
208 .byte 4 # DW_AT_byte_size
209 .Linfo_structured_type:
210 .byte 6 # Abbrev [6] 0x64:0x1e DW_TAG_structure_type
211 .byte 5 # DW_AT_calling_convention
212 .byte 8 # DW_AT_byte_size
213 .byte 1 # DW_AT_decl_file
214 .byte 1 # DW_AT_decl_line
215 .long .Linfo_sibling # DW_AT_sibling <-- Manually added
217 .byte 5 # Abbrev [5] 0x59:0xb DW_TAG_typedef
218 .long .Linfo_structured_type # DW_AT_type <-- Manually modified
219 .long .Linfo_string9 # DW_AT_name
220 .byte 1 # DW_AT_decl_file
221 .byte 5 # DW_AT_decl_line
222 .byte 7 # Abbrev [7] 0x69:0xc DW_TAG_member
223 .long .Linfo_string6 # DW_AT_name
224 .long .Linfo_base_type # DW_AT_type
225 .byte 1 # DW_AT_decl_file
226 .byte 3 # DW_AT_decl_line
227 .byte 0 # DW_AT_data_member_location
228 .byte 7 # Abbrev [7] 0x75:0xc DW_TAG_member
229 .long .Linfo_string8 # DW_AT_name
230 .long .Linfo_base_type # DW_AT_type
231 .byte 1 # DW_AT_decl_file
232 .byte 4 # DW_AT_decl_line
233 .byte 4 # DW_AT_data_member_location
234 .byte 0 # End Of Children Mark
236 .byte 4 # Abbrev [4] 0x82:0x7 DW_TAG_base_type
237 .long .Linfo_string7 # DW_AT_name
238 .byte 7 # DW_AT_encoding
239 .byte 4 # DW_AT_byte_size
240 .byte 0 # End Of Children Mark
242 .section .debug_str,"MS",@progbits,1
244 .asciz "clang version 15.0.0" # string offset=0
246 .asciz "main.cpp" # string offset=146
248 .asciz "/dwarf4-sibling-test" # string offset=155
250 .asciz "main" # string offset=213
252 .asciz "int" # string offset=218
254 .asciz "s" # string offset=222
256 .asciz "a" # string offset=224
258 .asciz "unsigned int" # string offset=226
260 .asciz "b" # string offset=239
262 .asciz "S" # string offset=241
263 .ident "clang version 15.0.0"
264 .section ".note.GNU-stack","",@progbits
266 .section .debug_line,"",@progbits