2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
3 # RUN: ld.lld --gdb-index %t.o -o %t 2>&1 | count 0
4 # RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s
6 # cuIndexAndAttrs of _start:
7 # attributes << 24 | cuIndex = 48 << 24 | 0 = 0x30000000
8 # cuIndexAndAttrs of foo:
9 # attributes << 24 | cuIndex = 48 << 24 | 1 = 0x30000001
11 # CHECK-DAG: String name: _start, CU vector index: 0
12 # CHECK-DAG: String name: foo, CU vector index: 1
13 # CHECK: Constant pool
14 # CHECK-NEXT: 0(0x0): 0x30000000
15 # CHECK-NEXT: 1(0x8): 0x30000001
21 .section .debug_abbrev,"",@progbits
22 .byte 1 # Abbreviation Code
23 .byte 17 # DW_TAG_compile_unit
24 .byte 1 # DW_CHILDREN_yes
25 .ascii "\264B" # DW_AT_GNU_pubnames
26 .byte 25 # DW_FORM_flag_present
29 .byte 2 # Abbreviation Code
30 .byte 46 # DW_TAG_subprogram
31 .byte 0 # DW_CHILDREN_no
33 .byte 8 # DW_FORM_string
38 .section .debug_info,"",@progbits
40 .long .Lcu_end0 - .Lcu_begin0 - 4
41 .short 4 # DWARF version number
42 .long 0 # Offset Into Abbrev. Section
43 .byte 8 # Address Size
45 .byte 1 # Abbrev [1] DW_TAG_compile_unit
46 .byte 2 # Abbrev [2] DW_TAG_subprogram
47 .asciz "_start" # DW_AT_name
52 .long .Lcu_end1 - .Lcu_begin1 - 4
53 .short 4 # DWARF version number
54 .long 0 # Offset Into Abbrev. Section
55 .byte 8 # Address Size
57 .byte 1 # Abbrev [1] DW_TAG_compile_unit
58 .byte 2 # Abbrev [2] DW_TAG_subprogram
59 .asciz "foo" # DW_AT_name
63 # Swap sets to test the case where pubnames are in a
64 # different order than the CUs they refer to.
65 .section .debug_gnu_pubnames,"",@progbits
67 .long .LpubNames_end1 - .LpubNames_begin1
70 .long .Lcu_begin1 # CU Offset
71 .long .Lcu_end1 - .Lcu_begin1
72 .long .Ldie1 - .Lcu_begin1
73 .byte 48 # Attributes: FUNCTION, EXTERNAL
74 .asciz "foo" # External Name
79 .long .LpubNames_end0 - .LpubNames_begin0
82 .long .Lcu_begin0 # CU Offset
83 .long .Lcu_end0 - .Lcu_begin0
84 .long .Ldie0 - .Lcu_begin0
85 .byte 48 # Attributes: FUNCTION, EXTERNAL
86 .asciz "_start" # External Name