1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux -o %t %s
3# RUN: ld.lld --gdb-index --gc-sections -o %t2 %t
4# RUN: llvm-dwarfdump -gdb-index %t2 | FileCheck %s
5
6# CHECK: Address area offset = 0x28, has 1 entries:
7# CHECK-NEXT:    Low/High address = [0x201000, 0x201001) (Size: 0x1), CU id = 0
8
9# Generated with: (clang r302976)
10# echo "void _start() {} void dead() {}" | \
11# clang -Os -g -S -ffunction-sections -o gdb-index-gc-sections.s -x c - -Xclang -fdebug-compilation-dir -Xclang .
12
13	.text
14	.file	"-"
15	.section	.text._start,"ax",@progbits
16	.globl	_start
17	.type	_start,@function
18_start:                                 # @_start
19.Lfunc_begin0:
20	.file	1 "<stdin>"
21	.loc	1 1 0                   # <stdin>:1:0
22	.cfi_startproc
23# BB#0:                                 # %entry
24	.loc	1 1 16 prologue_end     # <stdin>:1:16
25	retq
26.Ltmp0:
27.Lfunc_end0:
28	.size	_start, .Lfunc_end0-_start
29	.cfi_endproc
30
31	.section	.text.dead,"ax",@progbits
32	.globl	dead
33	.type	dead,@function
34dead:                                   # @dead
35.Lfunc_begin1:
36	.loc	1 1 0                   # <stdin>:1:0
37	.cfi_startproc
38# BB#0:                                 # %entry
39	.loc	1 1 31 prologue_end     # <stdin>:1:31
40	retq
41.Ltmp1:
42.Lfunc_end1:
43	.size	dead, .Lfunc_end1-dead
44	.cfi_endproc
45
46	.section	.debug_str,"MS",@progbits,1
47.Linfo_string0:
48	.asciz	"clang version 5.0.0 "  # string offset=0
49.Linfo_string1:
50	.asciz	"-"                     # string offset=21
51.Linfo_string2:
52	.asciz	"."                     # string offset=23
53.Linfo_string3:
54	.asciz	"_start"                # string offset=25
55.Linfo_string4:
56	.asciz	"dead"                  # string offset=32
57	.section	.debug_loc,"",@progbits
58	.section	.debug_abbrev,"",@progbits
59	.byte	1                       # Abbreviation Code
60	.byte	17                      # DW_TAG_compile_unit
61	.byte	1                       # DW_CHILDREN_yes
62	.byte	37                      # DW_AT_producer
63	.byte	14                      # DW_FORM_strp
64	.byte	19                      # DW_AT_language
65	.byte	5                       # DW_FORM_data2
66	.byte	3                       # DW_AT_name
67	.byte	14                      # DW_FORM_strp
68	.byte	16                      # DW_AT_stmt_list
69	.byte	23                      # DW_FORM_sec_offset
70	.byte	27                      # DW_AT_comp_dir
71	.byte	14                      # DW_FORM_strp
72	.byte	17                      # DW_AT_low_pc
73	.byte	1                       # DW_FORM_addr
74	.byte	85                      # DW_AT_ranges
75	.byte	23                      # DW_FORM_sec_offset
76	.byte	0                       # EOM(1)
77	.byte	0                       # EOM(2)
78	.byte	2                       # Abbreviation Code
79	.byte	46                      # DW_TAG_subprogram
80	.byte	0                       # DW_CHILDREN_no
81	.byte	17                      # DW_AT_low_pc
82	.byte	1                       # DW_FORM_addr
83	.byte	18                      # DW_AT_high_pc
84	.byte	6                       # DW_FORM_data4
85	.byte	64                      # DW_AT_frame_base
86	.byte	24                      # DW_FORM_exprloc
87	.byte	3                       # DW_AT_name
88	.byte	14                      # DW_FORM_strp
89	.byte	58                      # DW_AT_decl_file
90	.byte	11                      # DW_FORM_data1
91	.byte	59                      # DW_AT_decl_line
92	.byte	11                      # DW_FORM_data1
93	.byte	63                      # DW_AT_external
94	.byte	25                      # DW_FORM_flag_present
95	.byte	0                       # EOM(1)
96	.byte	0                       # EOM(2)
97	.byte	0                       # EOM(3)
98	.section	.debug_info,"",@progbits
99.Lcu_begin0:
100	.long	81                      # Length of Unit
101	.short	4                       # DWARF version number
102	.long	.debug_abbrev           # Offset Into Abbrev. Section
103	.byte	8                       # Address Size (in bytes)
104	.byte	1                       # Abbrev [1] 0xb:0x4a DW_TAG_compile_unit
105	.long	.Linfo_string0          # DW_AT_producer
106	.short	12                      # DW_AT_language
107	.long	.Linfo_string1          # DW_AT_name
108	.long	.Lline_table_start0     # DW_AT_stmt_list
109	.long	.Linfo_string2          # DW_AT_comp_dir
110	.quad	0                       # DW_AT_low_pc
111	.long	.Ldebug_ranges0         # DW_AT_ranges
112	.byte	2                       # Abbrev [2] 0x2a:0x15 DW_TAG_subprogram
113	.quad	.Lfunc_begin0           # DW_AT_low_pc
114	.long	.Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
115	.byte	1                       # DW_AT_frame_base
116	.byte	87
117	.long	.Linfo_string3          # DW_AT_name
118	.byte	1                       # DW_AT_decl_file
119	.byte	1                       # DW_AT_decl_line
120                                        # DW_AT_external
121	.byte	2                       # Abbrev [2] 0x3f:0x15 DW_TAG_subprogram
122	.quad	.Lfunc_begin1           # DW_AT_low_pc
123	.long	.Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
124	.byte	1                       # DW_AT_frame_base
125	.byte	87
126	.long	.Linfo_string4          # DW_AT_name
127	.byte	1                       # DW_AT_decl_file
128	.byte	1                       # DW_AT_decl_line
129                                        # DW_AT_external
130	.byte	0                       # End Of Children Mark
131	.section	.debug_ranges,"",@progbits
132.Ldebug_ranges0:
133	.quad	.Lfunc_begin0
134	.quad	.Lfunc_end0
135	.quad	.Lfunc_begin1
136	.quad	.Lfunc_end1
137	.quad	0
138	.quad	0
139	.section	.debug_macinfo,"",@progbits
140.Lcu_macro_begin0:
141	.byte	0                       # End Of Macro List Mark
142	.section	.debug_pubnames,"",@progbits
143	.long	.LpubNames_end0-.LpubNames_begin0 # Length of Public Names Info
144.LpubNames_begin0:
145	.short	2                       # DWARF Version
146	.long	.Lcu_begin0             # Offset of Compilation Unit Info
147	.long	85                      # Compilation Unit Length
148	.long	42                      # DIE offset
149	.asciz	"_start"                # External Name
150	.long	63                      # DIE offset
151	.asciz	"dead"                  # External Name
152	.long	0                       # End Mark
153.LpubNames_end0:
154
155	.ident	"clang version 5.0.0 "
156	.section	".note.GNU-stack","",@progbits
157	.section	.debug_line,"",@progbits
158.Lline_table_start0:
159