1# debug-names.s was generated with: 2 3# - clang++ -g -O0 -gpubnames -fdebug-compilation-dir='/proc/self/cwd' \ 4# -S a.cpp -o a.s 5 6# a.cpp contents: 7 8# struct t1 { }; 9# void f1(t1) { } 10 11# REQUIRES: x86 12# RUN: rm -rf %t && split-file %s %t && cd %t 13# RUN: llvm-mc -filetype=obj -triple=x86_64 --crel a.s -o a.o 14# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o 15 16# RUN: ld.lld --debug-names --no-debug-names a.o b.o -o out0 17# RUN: llvm-readelf -SW out0 | FileCheck %s --check-prefix=NO_MERGE 18 19# NO_MERGE: Name Type Address Off Size ES Flg Lk Inf Al 20# NO_MERGE: .debug_names PROGBITS 0000000000000000 [[#%x,]] 000110 00 0 0 4 21 22# RUN: ld.lld --debug-names a.o b.o -o out 23 24# RUN: llvm-dwarfdump -debug-names out | FileCheck %s --check-prefix=DWARF 25# RUN: llvm-readelf -SW out | FileCheck %s --check-prefix=READELF 26 27## Test we can handle concatenated .debug_names. 28# RUN: ld.lld -r a.o b.o -o ab.o 29# RUN: ld.lld --debug-names ab.o -o out1 30# RUN: llvm-dwarfdump -debug-names out1 | FileCheck %s --check-prefix=DWARF 31 32# READELF: Name Type Address Off Size ES Flg Lk Inf Al 33# READELF: .debug_names PROGBITS 0000000000000000 [[#%x,]] 0000cc 00 0 0 4 34 35## Test we can handle compressed input and --compress-debug-sections compresses output .debug_names. 36# RUN: %if zlib %{ llvm-objcopy --compress-debug-sections=zlib a.o a.zlib.o %} 37# RUN: %if zlib %{ ld.lld --debug-names --compress-debug-sections=zlib a.zlib.o b.o -o out.zlib %} 38# RUN: %if zlib %{ llvm-readelf -S out.zlib | FileCheck %s --check-prefix=READELF-ZLIB %} 39# RUN: %if zlib %{ llvm-objcopy --decompress-debug-sections out.zlib out.zlib.de %} 40# RUN: %if zlib %{ llvm-dwarfdump -debug-names out.zlib.de | FileCheck %s --check-prefix=DWARF %} 41 42# READELF-ZLIB: Name Type Address Off Size ES Flg Lk Inf Al 43# READELF-ZLIB: .debug_names PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 C 0 0 1 44 45# DWARF: .debug_names contents: 46# DWARF: Name Index @ 0x0 { 47# DWARF-NEXT: Header { 48# DWARF-NEXT: Length: 0xC8 49# DWARF-NEXT: Format: DWARF32 50# DWARF-NEXT: Version: 5 51# DWARF-NEXT: CU count: 2 52# DWARF-NEXT: Local TU count: 0 53# DWARF-NEXT: Foreign TU count: 0 54# DWARF-NEXT: Bucket count: 5 55# DWARF-NEXT: Name count: 5 56# DWARF-NEXT: Abbreviations table size: 0x1F 57# DWARF-NEXT: Augmentation: 'LLVM0700' 58# DWARF: Compilation Unit offsets [ 59# DWARF-NEXT: CU[0]: 0x00000000 60# DWARF-NEXT: CU[1]: 0x0000000c 61# DWARF: Abbreviations [ 62# DWARF-NEXT: Abbreviation 0x1 { 63# DWARF: Tag: DW_TAG_structure_type 64# DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref4 65# DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present 66# DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data1 67# DWARF: Abbreviation 0x2 { 68# DWARF-NEXT: Tag: DW_TAG_subprogram 69# DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref4 70# DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present 71# DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data1 72# DWARF: Abbreviation 0x3 { 73# DWARF-NEXT: Tag: DW_TAG_base_type 74# DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref4 75# DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present 76# DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data1 77# DWARF: Bucket 0 [ 78# DWARF-NEXT: EMPTY 79# DWARF-NEXT: ] 80# DWARF-NEXT: Bucket 1 [ 81# DWARF-NEXT: Name 1 { 82# DWARF-NEXT: Hash: 0x59796A 83# DWARF-NEXT: String: 0x00000089 "t1" 84# DWARF-NEXT: Entry @ 0xaa { 85# DWARF-NEXT: Abbrev: 0x1 86# DWARF-NEXT: Tag: DW_TAG_structure_type 87# DWARF-NEXT: DW_IDX_die_offset: 0x0000003a 88# DWARF-NEXT: DW_IDX_parent: <parent not indexed> 89# DWARF-NEXT: DW_IDX_compile_unit: 0x00 90# DWARF-NEXT: } 91# DWARF-NEXT: Entry @ 0xb0 { 92# DWARF-NEXT: Abbrev: 0x1 93# DWARF-NEXT: Tag: DW_TAG_structure_type 94# DWARF-NEXT: DW_IDX_die_offset: 0x00000042 95# DWARF-NEXT: DW_IDX_parent: <parent not indexed> 96# DWARF-NEXT: DW_IDX_compile_unit: 0x01 97# DWARF-NEXT: } 98# DWARF-NEXT: } 99# DWARF-NEXT: Name 2 { 100# DWARF-NEXT: Hash: 0x5355B2BE 101# DWARF-NEXT: String: 0x00000080 "_Z2f12t1" 102# DWARF-NEXT: Entry @ 0xbe { 103# DWARF-NEXT: Abbrev: 0x2 104# DWARF-NEXT: Tag: DW_TAG_subprogram 105# DWARF-NEXT: DW_IDX_die_offset: 0x00000023 106# DWARF-NEXT: DW_IDX_parent: <parent not indexed> 107# DWARF-NEXT: DW_IDX_compile_unit: 0x00 108# DWARF-NEXT: } 109# DWARF-NEXT: } 110# DWARF-NEXT: Name 3 { 111# DWARF-NEXT: Hash: 0x7C9A7F6A 112# DWARF-NEXT: String: 0x00000111 "main" 113# DWARF-NEXT: Entry @ 0xc5 { 114# DWARF-NEXT: Abbrev: 0x2 115# DWARF-NEXT: Tag: DW_TAG_subprogram 116# DWARF-NEXT: DW_IDX_die_offset: 0x00000023 117# DWARF-NEXT: DW_IDX_parent: <parent not indexed> 118# DWARF-NEXT: DW_IDX_compile_unit: 0x01 119# DWARF-NEXT: } 120# DWARF-NEXT: } 121# DWARF-NEXT: ] 122# DWARF-NEXT: Bucket 2 [ 123# DWARF-NEXT: EMPTY 124# DWARF-NEXT: ] 125# DWARF-NEXT: Bucket 3 [ 126# DWARF-NEXT: Name 4 { 127# DWARF-NEXT: Hash: 0xB888030 128# DWARF-NEXT: String: 0x00000116 "int" 129# DWARF-NEXT: Entry @ 0xb7 { 130# DWARF-NEXT: Abbrev: 0x3 131# DWARF-NEXT: Tag: DW_TAG_base_type 132# DWARF-NEXT: DW_IDX_die_offset: 0x0000003e 133# DWARF-NEXT: DW_IDX_parent: <parent not indexed> 134# DWARF-NEXT: DW_IDX_compile_unit: 0x01 135# DWARF-NEXT: } 136# DWARF-NEXT: } 137# DWARF-NEXT: ] 138# DWARF-NEXT: Bucket 4 [ 139# DWARF-NEXT: Name 5 { 140# DWARF-NEXT: Hash: 0x59779C 141# DWARF-NEXT: String: 0x0000007d "f1" 142# DWARF-NEXT: Entry @ 0xa3 { 143# DWARF-NEXT: Abbrev: 0x2 144# DWARF-NEXT: Tag: DW_TAG_subprogram 145# DWARF-NEXT: DW_IDX_die_offset: 0x00000023 146# DWARF-NEXT: DW_IDX_parent: <parent not indexed> 147# DWARF-NEXT: DW_IDX_compile_unit: 0x00 148# DWARF-NEXT: } 149# DWARF-NEXT: } 150# DWARF-NEXT: ] 151 152#--- a.s 153 .text 154 .globl _Z2f12t1 # -- Begin function _Z2f12t1 155 .p2align 4, 0x90 156 .type _Z2f12t1,@function 157_Z2f12t1: # @_Z2f12t1 158.Lfunc_begin0: 159 .cfi_startproc 160# %bb.0: # %entry 161 pushq %rbp 162 .cfi_def_cfa_offset 16 163 .cfi_offset %rbp, -16 164 movq %rsp, %rbp 165 .cfi_def_cfa_register %rbp 166.Ltmp0: 167 popq %rbp 168 .cfi_def_cfa %rsp, 8 169 retq 170.Ltmp1: 171.Lfunc_end0: 172 .size _Z2f12t1, .Lfunc_end0-_Z2f12t1 173 .cfi_endproc 174 # -- End function 175 .section .debug_abbrev,"",@progbits 176 .byte 0 # EOM(1) 177 .byte 0 # EOM(2) 178 .byte 0 # EOM(3) 179 .section .debug_info,"",@progbits 180.Lcu_begin0: 181 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 182.Ldebug_info_start0: 183 .short 5 # DWARF version number 184 .byte 1 # DWARF Unit Type 185 .byte 8 # Address Size (in bytes) 186 .long .debug_abbrev # Offset Into Abbrev. Section 187.Ldebug_info_end0: 188 .section .debug_str_offsets,"",@progbits 189 .long 28 # Length of String Offsets Set 190 .short 5 191 .short 0 192.Lstr_offsets_base0: 193 .section .debug_str,"MS",@progbits,1 194.Linfo_string0: 195 .asciz "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" # string offset=0 196.Linfo_string1: 197 .asciz "a.cpp" # string offset=104 198.Linfo_string2: 199 .asciz "/proc/self/cwd" # string offset=110 200.Linfo_string3: 201 .asciz "f1" # string offset=125 202.Linfo_string4: 203 .asciz "_Z2f12t1" # string offset=128 204.Linfo_string5: 205 .asciz "t1" # string offset=137 206.Laddr_table_base0: 207 .quad .Lfunc_begin0 208.Ldebug_addr_end0: 209 .section .debug_names,"",@progbits 210 .long .Lnames_end0-.Lnames_start0 # Header: unit length 211.Lnames_start0: 212 .short 5 # Header: version 213 .short 0 # Header: padding 214 .long 1 # Header: compilation unit count 215 .long 0 # Header: local type unit count 216 .long 0 # Header: foreign type unit count 217 .long 3 # Header: bucket count 218 .long 3 # Header: name count 219 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size 220 .long 8 # Header: augmentation string size 221 .ascii "LLVM0700" # Header: augmentation string 222 .long .Lcu_begin0 # Compilation unit 0 223 .long 0 # Bucket 0 224 .long 1 # Bucket 1 225 .long 3 # Bucket 2 226 .long 5863324 # Hash in Bucket 1 227 .long 5863786 # Hash in Bucket 1 228 .long 1398125246 # Hash in Bucket 2 229 .long .Linfo_string3 # String in Bucket 1: f1 230 .long .Linfo_string5 # String in Bucket 1: t1 231 .long .Linfo_string4 # String in Bucket 2: _Z2f12t1 232 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 1 233 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1 234 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 2 235.Lnames_abbrev_start0: 236 .byte 1 # Abbrev code 237 .byte 46 # DW_TAG_subprogram 238 .byte 3 # DW_IDX_die_offset 239 .byte 19 # DW_FORM_ref4 240 .byte 4 # DW_IDX_parent 241 .byte 25 # DW_FORM_flag_present 242 .byte 0 # End of abbrev 243 .byte 0 # End of abbrev 244 .byte 2 # Abbrev code 245 .byte 19 # DW_TAG_structure_type 246 .byte 3 # DW_IDX_die_offset 247 .byte 19 # DW_FORM_ref4 248 .byte 4 # DW_IDX_parent 249 .byte 25 # DW_FORM_flag_present 250 .byte 0 # End of abbrev 251 .byte 0 # End of abbrev 252 .byte 0 # End of abbrev list 253.Lnames_abbrev_end0: 254.Lnames_entries0: 255.Lnames0: 256.L1: 257 .byte 1 # Abbreviation code 258 .long 35 # DW_IDX_die_offset 259 .byte 0 # DW_IDX_parent 260 # End of list: f1 261.Lnames2: 262.L0: 263 .byte 2 # Abbreviation code 264 .long 58 # DW_IDX_die_offset 265 .byte 0 # DW_IDX_parent 266 # End of list: t1 267.Lnames1: 268 .byte 1 # Abbreviation code 269 .long 35 # DW_IDX_die_offset 270 .byte 0 # DW_IDX_parent 271 # End of list: _Z2f12t1 272 .p2align 2, 0x0 273.Lnames_end0: 274 .ident "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" 275 .section ".note.GNU-stack","",@progbits 276 .addrsig 277 .section .debug_line,"",@progbits 278.Lline_table_start0: 279 280#--- b.s 281# Generated with: 282# - clang++ -g -O0 -gpubnames -fdebug-compilation-dir='/proc/self/cwd' \ 283# -S b.cpp -o b.s 284 285# b.cpp contents: 286 287# struct t1 { }; 288# int main() { 289# t1 v1; 290# } 291# 292 293 .text 294 .globl main # -- Begin function main 295 .p2align 4, 0x90 296 .type main,@function 297main: # @main 298.Lfunc_begin0: 299 .cfi_startproc 300# %bb.0: # %entry 301 pushq %rbp 302 .cfi_def_cfa_offset 16 303 .cfi_offset %rbp, -16 304 movq %rsp, %rbp 305 .cfi_def_cfa_register %rbp 306.Ltmp0: 307 xorl %eax, %eax 308 popq %rbp 309 .cfi_def_cfa %rsp, 8 310 retq 311.Ltmp1: 312.Lfunc_end0: 313 .size main, .Lfunc_end0-main 314 .cfi_endproc 315 # -- End function 316 .section .debug_abbrev,"",@progbits 317 .byte 0 # EOM(1) 318 .byte 0 # EOM(2) 319 .byte 0 # EOM(3) 320 .section .debug_info,"",@progbits 321.Lcu_begin0: 322 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit 323.Ldebug_info_start0: 324 .short 5 # DWARF version number 325 .byte 1 # DWARF Unit Type 326 .byte 8 # Address Size (in bytes) 327 .long .debug_abbrev # Offset Into Abbrev. Section 328.Ldebug_info_end0: 329 .section .debug_str_offsets,"",@progbits 330 .long 32 # Length of String Offsets Set 331 .short 5 332 .short 0 333.Lstr_offsets_base0: 334 .section .debug_str,"MS",@progbits,1 335.Linfo_string0: 336 .asciz "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" # string offset=0 337.Linfo_string1: 338 .asciz "b.cpp" # string offset=104 339.Linfo_string2: 340 .asciz "/proc/self/cwd" # string offset=110 341.Linfo_string3: 342 .asciz "main" # string offset=125 343.Linfo_string4: 344 .asciz "int" # string offset=130 345.Linfo_string5: 346 .asciz "v1" # string offset=134 347.Linfo_string6: 348 .asciz "t1" # string offset=137 349.Laddr_table_base0: 350 .quad .Lfunc_begin0 351.Ldebug_addr_end0: 352 .section .debug_names,"",@progbits 353 .long .Lnames_end0-.Lnames_start0 # Header: unit length 354.Lnames_start0: 355 .short 5 # Header: version 356 .short 0 # Header: padding 357 .long 1 # Header: compilation unit count 358 .long 0 # Header: local type unit count 359 .long 0 # Header: foreign type unit count 360 .long 3 # Header: bucket count 361 .long 3 # Header: name count 362 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size 363 .long 8 # Header: augmentation string size 364 .ascii "LLVM0700" # Header: augmentation string 365 .long .Lcu_begin0 # Compilation unit 0 366 .long 0 # Bucket 0 367 .long 1 # Bucket 1 368 .long 3 # Bucket 2 369 .long 5863786 # Hash in Bucket 1 370 .long 2090499946 # Hash in Bucket 1 371 .long 193495088 # Hash in Bucket 2 372 .long .Linfo_string6 # String in Bucket 1: t1 373 .long .Linfo_string3 # String in Bucket 1: main 374 .long .Linfo_string4 # String in Bucket 2: int 375 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1 376 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 1 377 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 2 378.Lnames_abbrev_start0: 379 .byte 1 # Abbrev code 380 .byte 19 # DW_TAG_structure_type 381 .byte 3 # DW_IDX_die_offset 382 .byte 19 # DW_FORM_ref4 383 .byte 4 # DW_IDX_parent 384 .byte 25 # DW_FORM_flag_present 385 .byte 0 # End of abbrev 386 .byte 0 # End of abbrev 387 .byte 2 # Abbrev code 388 .byte 46 # DW_TAG_subprogram 389 .byte 3 # DW_IDX_die_offset 390 .byte 19 # DW_FORM_ref4 391 .byte 4 # DW_IDX_parent 392 .byte 25 # DW_FORM_flag_present 393 .byte 0 # End of abbrev 394 .byte 0 # End of abbrev 395 .byte 3 # Abbrev code 396 .byte 36 # DW_TAG_base_type 397 .byte 3 # DW_IDX_die_offset 398 .byte 19 # DW_FORM_ref4 399 .byte 4 # DW_IDX_parent 400 .byte 25 # DW_FORM_flag_present 401 .byte 0 # End of abbrev 402 .byte 0 # End of abbrev 403 .byte 0 # End of abbrev list 404.Lnames_abbrev_end0: 405.Lnames_entries0: 406.Lnames2: 407.L1: 408 .byte 1 # Abbreviation code 409 .long 66 # DW_IDX_die_offset 410 .byte 0 # DW_IDX_parent 411 # End of list: t1 412.Lnames0: 413.L2: 414 .byte 2 # Abbreviation code 415 .long 35 # DW_IDX_die_offset 416 .byte 0 # DW_IDX_parent 417 # End of list: main 418.Lnames1: 419.L0: 420 .byte 3 # Abbreviation code 421 .long 62 # DW_IDX_die_offset 422 .byte 0 # DW_IDX_parent 423 # End of list: int 424 .p2align 2, 0x0 425.Lnames_end0: 426 .ident "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" 427 .section ".note.GNU-stack","",@progbits 428 .addrsig 429 .section .debug_line,"",@progbits 430.Lline_table_start0: 431