431 lines · plain
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.s5 6# a.cpp contents:7 8# struct t1 { };9# void f1(t1) { }10 11# REQUIRES: x8612# RUN: rm -rf %t && split-file %s %t && cd %t13# RUN: llvm-mc -filetype=obj -triple=x86_64 --crel a.s -o a.o14# RUN: llvm-mc -filetype=obj -triple=x86_64 b.s -o b.o15 16# RUN: ld.lld --debug-names --no-debug-names a.o b.o -o out017# RUN: llvm-readelf -SW out0 | FileCheck %s --check-prefix=NO_MERGE18 19# NO_MERGE: Name Type Address Off Size ES Flg Lk Inf Al20# NO_MERGE: .debug_names PROGBITS 0000000000000000 [[#%x,]] 000110 00 0 0 421 22# RUN: ld.lld --debug-names a.o b.o -o out23 24# RUN: llvm-dwarfdump -debug-names out | FileCheck %s --check-prefix=DWARF25# RUN: llvm-readelf -SW out | FileCheck %s --check-prefix=READELF26 27## Test we can handle concatenated .debug_names.28# RUN: ld.lld -r a.o b.o -o ab.o29# RUN: ld.lld --debug-names ab.o -o out130# RUN: llvm-dwarfdump -debug-names out1 | FileCheck %s --check-prefix=DWARF31 32# READELF: Name Type Address Off Size ES Flg Lk Inf Al33# READELF: .debug_names PROGBITS 0000000000000000 [[#%x,]] 0000cc 00 0 0 434 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 Al43# READELF-ZLIB: .debug_names PROGBITS 0000000000000000 [[#%x,]] [[#%x,]] 00 C 0 0 144 45# DWARF: .debug_names contents:46# DWARF: Name Index @ 0x0 {47# DWARF-NEXT: Header {48# DWARF-NEXT: Length: 0xC849# DWARF-NEXT: Format: DWARF3250# DWARF-NEXT: Version: 551# DWARF-NEXT: CU count: 252# DWARF-NEXT: Local TU count: 053# DWARF-NEXT: Foreign TU count: 054# DWARF-NEXT: Bucket count: 555# DWARF-NEXT: Name count: 556# DWARF-NEXT: Abbreviations table size: 0x1F57# DWARF-NEXT: Augmentation: 'LLVM0700'58# DWARF: Compilation Unit offsets [59# DWARF-NEXT: CU[0]: 0x0000000060# DWARF-NEXT: CU[1]: 0x0000000c61# DWARF: Abbreviations [62# DWARF-NEXT: Abbreviation 0x1 {63# DWARF: Tag: DW_TAG_structure_type64# DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref465# DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present66# DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data167# DWARF: Abbreviation 0x2 {68# DWARF-NEXT: Tag: DW_TAG_subprogram69# DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref470# DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present71# DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data172# DWARF: Abbreviation 0x3 {73# DWARF-NEXT: Tag: DW_TAG_base_type74# DWARF-NEXT: DW_IDX_die_offset: DW_FORM_ref475# DWARF-NEXT: DW_IDX_parent: DW_FORM_flag_present76# DWARF-NEXT: DW_IDX_compile_unit: DW_FORM_data177# DWARF: Bucket 0 [78# DWARF-NEXT: EMPTY79# DWARF-NEXT: ]80# DWARF-NEXT: Bucket 1 [81# DWARF-NEXT: Name 1 {82# DWARF-NEXT: Hash: 0x59796A83# DWARF-NEXT: String: 0x00000089 "t1"84# DWARF-NEXT: Entry @ 0xaa {85# DWARF-NEXT: Abbrev: 0x186# DWARF-NEXT: Tag: DW_TAG_structure_type87# DWARF-NEXT: DW_IDX_die_offset: 0x0000003a88# DWARF-NEXT: DW_IDX_parent: <parent not indexed>89# DWARF-NEXT: DW_IDX_compile_unit: 0x0090# DWARF-NEXT: }91# DWARF-NEXT: Entry @ 0xb0 {92# DWARF-NEXT: Abbrev: 0x193# DWARF-NEXT: Tag: DW_TAG_structure_type94# DWARF-NEXT: DW_IDX_die_offset: 0x0000004295# DWARF-NEXT: DW_IDX_parent: <parent not indexed>96# DWARF-NEXT: DW_IDX_compile_unit: 0x0197# DWARF-NEXT: }98# DWARF-NEXT: }99# DWARF-NEXT: Name 2 {100# DWARF-NEXT: Hash: 0x5355B2BE101# DWARF-NEXT: String: 0x00000080 "_Z2f12t1"102# DWARF-NEXT: Entry @ 0xbe {103# DWARF-NEXT: Abbrev: 0x2104# DWARF-NEXT: Tag: DW_TAG_subprogram105# DWARF-NEXT: DW_IDX_die_offset: 0x00000023106# DWARF-NEXT: DW_IDX_parent: <parent not indexed>107# DWARF-NEXT: DW_IDX_compile_unit: 0x00108# DWARF-NEXT: }109# DWARF-NEXT: }110# DWARF-NEXT: Name 3 {111# DWARF-NEXT: Hash: 0x7C9A7F6A112# DWARF-NEXT: String: 0x00000111 "main"113# DWARF-NEXT: Entry @ 0xc5 {114# DWARF-NEXT: Abbrev: 0x2115# DWARF-NEXT: Tag: DW_TAG_subprogram116# DWARF-NEXT: DW_IDX_die_offset: 0x00000023117# DWARF-NEXT: DW_IDX_parent: <parent not indexed>118# DWARF-NEXT: DW_IDX_compile_unit: 0x01119# DWARF-NEXT: }120# DWARF-NEXT: }121# DWARF-NEXT: ]122# DWARF-NEXT: Bucket 2 [123# DWARF-NEXT: EMPTY124# DWARF-NEXT: ]125# DWARF-NEXT: Bucket 3 [126# DWARF-NEXT: Name 4 {127# DWARF-NEXT: Hash: 0xB888030128# DWARF-NEXT: String: 0x00000116 "int"129# DWARF-NEXT: Entry @ 0xb7 {130# DWARF-NEXT: Abbrev: 0x3131# DWARF-NEXT: Tag: DW_TAG_base_type132# DWARF-NEXT: DW_IDX_die_offset: 0x0000003e133# DWARF-NEXT: DW_IDX_parent: <parent not indexed>134# DWARF-NEXT: DW_IDX_compile_unit: 0x01135# DWARF-NEXT: }136# DWARF-NEXT: }137# DWARF-NEXT: ]138# DWARF-NEXT: Bucket 4 [139# DWARF-NEXT: Name 5 {140# DWARF-NEXT: Hash: 0x59779C141# DWARF-NEXT: String: 0x0000007d "f1"142# DWARF-NEXT: Entry @ 0xa3 {143# DWARF-NEXT: Abbrev: 0x2144# DWARF-NEXT: Tag: DW_TAG_subprogram145# DWARF-NEXT: DW_IDX_die_offset: 0x00000023146# DWARF-NEXT: DW_IDX_parent: <parent not indexed>147# DWARF-NEXT: DW_IDX_compile_unit: 0x00148# DWARF-NEXT: }149# DWARF-NEXT: }150# DWARF-NEXT: ]151 152#--- a.s153 .text154 .globl _Z2f12t1 # -- Begin function _Z2f12t1155 .p2align 4, 0x90156 .type _Z2f12t1,@function157_Z2f12t1: # @_Z2f12t1158.Lfunc_begin0:159 .cfi_startproc160# %bb.0: # %entry161 pushq %rbp162 .cfi_def_cfa_offset 16163 .cfi_offset %rbp, -16164 movq %rsp, %rbp165 .cfi_def_cfa_register %rbp166.Ltmp0:167 popq %rbp168 .cfi_def_cfa %rsp, 8169 retq170.Ltmp1:171.Lfunc_end0:172 .size _Z2f12t1, .Lfunc_end0-_Z2f12t1173 .cfi_endproc174 # -- End function175 .section .debug_abbrev,"",@progbits176 .byte 0 # EOM(1)177 .byte 0 # EOM(2)178 .byte 0 # EOM(3)179 .section .debug_info,"",@progbits180.Lcu_begin0:181 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit182.Ldebug_info_start0:183 .short 5 # DWARF version number184 .byte 1 # DWARF Unit Type185 .byte 8 # Address Size (in bytes)186 .long .debug_abbrev # Offset Into Abbrev. Section187.Ldebug_info_end0:188 .section .debug_str_offsets,"",@progbits189 .long 28 # Length of String Offsets Set190 .short 5191 .short 0192.Lstr_offsets_base0:193 .section .debug_str,"MS",@progbits,1194.Linfo_string0:195 .asciz "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" # string offset=0196.Linfo_string1:197 .asciz "a.cpp" # string offset=104198.Linfo_string2:199 .asciz "/proc/self/cwd" # string offset=110200.Linfo_string3:201 .asciz "f1" # string offset=125202.Linfo_string4:203 .asciz "_Z2f12t1" # string offset=128204.Linfo_string5:205 .asciz "t1" # string offset=137206.Laddr_table_base0:207 .quad .Lfunc_begin0208.Ldebug_addr_end0:209 .section .debug_names,"",@progbits210 .long .Lnames_end0-.Lnames_start0 # Header: unit length211.Lnames_start0:212 .short 5 # Header: version213 .short 0 # Header: padding214 .long 1 # Header: compilation unit count215 .long 0 # Header: local type unit count216 .long 0 # Header: foreign type unit count217 .long 3 # Header: bucket count218 .long 3 # Header: name count219 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size220 .long 8 # Header: augmentation string size221 .ascii "LLVM0700" # Header: augmentation string222 .long .Lcu_begin0 # Compilation unit 0223 .long 0 # Bucket 0224 .long 1 # Bucket 1225 .long 3 # Bucket 2226 .long 5863324 # Hash in Bucket 1227 .long 5863786 # Hash in Bucket 1228 .long 1398125246 # Hash in Bucket 2229 .long .Linfo_string3 # String in Bucket 1: f1230 .long .Linfo_string5 # String in Bucket 1: t1231 .long .Linfo_string4 # String in Bucket 2: _Z2f12t1232 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 1233 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1234 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 2235.Lnames_abbrev_start0:236 .byte 1 # Abbrev code237 .byte 46 # DW_TAG_subprogram238 .byte 3 # DW_IDX_die_offset239 .byte 19 # DW_FORM_ref4240 .byte 4 # DW_IDX_parent241 .byte 25 # DW_FORM_flag_present242 .byte 0 # End of abbrev243 .byte 0 # End of abbrev244 .byte 2 # Abbrev code245 .byte 19 # DW_TAG_structure_type246 .byte 3 # DW_IDX_die_offset247 .byte 19 # DW_FORM_ref4248 .byte 4 # DW_IDX_parent249 .byte 25 # DW_FORM_flag_present250 .byte 0 # End of abbrev251 .byte 0 # End of abbrev252 .byte 0 # End of abbrev list253.Lnames_abbrev_end0:254.Lnames_entries0:255.Lnames0:256.L1:257 .byte 1 # Abbreviation code258 .long 35 # DW_IDX_die_offset259 .byte 0 # DW_IDX_parent260 # End of list: f1261.Lnames2:262.L0:263 .byte 2 # Abbreviation code264 .long 58 # DW_IDX_die_offset265 .byte 0 # DW_IDX_parent266 # End of list: t1267.Lnames1:268 .byte 1 # Abbreviation code269 .long 35 # DW_IDX_die_offset270 .byte 0 # DW_IDX_parent271 # End of list: _Z2f12t1272 .p2align 2, 0x0273.Lnames_end0:274 .ident "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)"275 .section ".note.GNU-stack","",@progbits276 .addrsig277 .section .debug_line,"",@progbits278.Lline_table_start0:279 280#--- b.s281# Generated with:282# - clang++ -g -O0 -gpubnames -fdebug-compilation-dir='/proc/self/cwd' \283# -S b.cpp -o b.s284 285# b.cpp contents:286 287# struct t1 { };288# int main() {289# t1 v1;290# }291#292 293 .text294 .globl main # -- Begin function main295 .p2align 4, 0x90296 .type main,@function297main: # @main298.Lfunc_begin0:299 .cfi_startproc300# %bb.0: # %entry301 pushq %rbp302 .cfi_def_cfa_offset 16303 .cfi_offset %rbp, -16304 movq %rsp, %rbp305 .cfi_def_cfa_register %rbp306.Ltmp0:307 xorl %eax, %eax308 popq %rbp309 .cfi_def_cfa %rsp, 8310 retq311.Ltmp1:312.Lfunc_end0:313 .size main, .Lfunc_end0-main314 .cfi_endproc315 # -- End function316 .section .debug_abbrev,"",@progbits317 .byte 0 # EOM(1)318 .byte 0 # EOM(2)319 .byte 0 # EOM(3)320 .section .debug_info,"",@progbits321.Lcu_begin0:322 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit323.Ldebug_info_start0:324 .short 5 # DWARF version number325 .byte 1 # DWARF Unit Type326 .byte 8 # Address Size (in bytes)327 .long .debug_abbrev # Offset Into Abbrev. Section328.Ldebug_info_end0:329 .section .debug_str_offsets,"",@progbits330 .long 32 # Length of String Offsets Set331 .short 5332 .short 0333.Lstr_offsets_base0:334 .section .debug_str,"MS",@progbits,1335.Linfo_string0:336 .asciz "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" # string offset=0337.Linfo_string1:338 .asciz "b.cpp" # string offset=104339.Linfo_string2:340 .asciz "/proc/self/cwd" # string offset=110341.Linfo_string3:342 .asciz "main" # string offset=125343.Linfo_string4:344 .asciz "int" # string offset=130345.Linfo_string5:346 .asciz "v1" # string offset=134347.Linfo_string6:348 .asciz "t1" # string offset=137349.Laddr_table_base0:350 .quad .Lfunc_begin0351.Ldebug_addr_end0:352 .section .debug_names,"",@progbits353 .long .Lnames_end0-.Lnames_start0 # Header: unit length354.Lnames_start0:355 .short 5 # Header: version356 .short 0 # Header: padding357 .long 1 # Header: compilation unit count358 .long 0 # Header: local type unit count359 .long 0 # Header: foreign type unit count360 .long 3 # Header: bucket count361 .long 3 # Header: name count362 .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size363 .long 8 # Header: augmentation string size364 .ascii "LLVM0700" # Header: augmentation string365 .long .Lcu_begin0 # Compilation unit 0366 .long 0 # Bucket 0367 .long 1 # Bucket 1368 .long 3 # Bucket 2369 .long 5863786 # Hash in Bucket 1370 .long 2090499946 # Hash in Bucket 1371 .long 193495088 # Hash in Bucket 2372 .long .Linfo_string6 # String in Bucket 1: t1373 .long .Linfo_string3 # String in Bucket 1: main374 .long .Linfo_string4 # String in Bucket 2: int375 .long .Lnames2-.Lnames_entries0 # Offset in Bucket 1376 .long .Lnames0-.Lnames_entries0 # Offset in Bucket 1377 .long .Lnames1-.Lnames_entries0 # Offset in Bucket 2378.Lnames_abbrev_start0:379 .byte 1 # Abbrev code380 .byte 19 # DW_TAG_structure_type381 .byte 3 # DW_IDX_die_offset382 .byte 19 # DW_FORM_ref4383 .byte 4 # DW_IDX_parent384 .byte 25 # DW_FORM_flag_present385 .byte 0 # End of abbrev386 .byte 0 # End of abbrev387 .byte 2 # Abbrev code388 .byte 46 # DW_TAG_subprogram389 .byte 3 # DW_IDX_die_offset390 .byte 19 # DW_FORM_ref4391 .byte 4 # DW_IDX_parent392 .byte 25 # DW_FORM_flag_present393 .byte 0 # End of abbrev394 .byte 0 # End of abbrev395 .byte 3 # Abbrev code396 .byte 36 # DW_TAG_base_type397 .byte 3 # DW_IDX_die_offset398 .byte 19 # DW_FORM_ref4399 .byte 4 # DW_IDX_parent400 .byte 25 # DW_FORM_flag_present401 .byte 0 # End of abbrev402 .byte 0 # End of abbrev403 .byte 0 # End of abbrev list404.Lnames_abbrev_end0:405.Lnames_entries0:406.Lnames2:407.L1:408 .byte 1 # Abbreviation code409 .long 66 # DW_IDX_die_offset410 .byte 0 # DW_IDX_parent411 # End of list: t1412.Lnames0:413.L2:414 .byte 2 # Abbreviation code415 .long 35 # DW_IDX_die_offset416 .byte 0 # DW_IDX_parent417 # End of list: main418.Lnames1:419.L0:420 .byte 3 # Abbreviation code421 .long 62 # DW_IDX_die_offset422 .byte 0 # DW_IDX_parent423 # End of list: int424 .p2align 2, 0x0425.Lnames_end0:426 .ident "clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)"427 .section ".note.GNU-stack","",@progbits428 .addrsig429 .section .debug_line,"",@progbits430.Lline_table_start0:431