xref: /llvm-project/lld/test/ELF/debug-names-die-offset-form-flag-present.s (revision 16711b431b843dd2143d38fdf6b0591dfb1783e0)
1# This file was generated by:
2# clang++ -g -O0 -S -fdebug-compilation-dir='/proc/self/cwd' -gpubnames a.cpp
3
4# Then manually changing the first .debug_names abbrev, so that the
5# DW_IDX_die_offset uses DW_FORM_flag_present (invalid) & the DW_IDX_parent
6# uses DW_FORM_ref4. Also updated the sizes of the values in the entry
7# that uses the abbrev, to match the sizes of the forms.
8
9# Contents of a.cpp
10# int main (int argc, char **argv) { }
11
12# REQUIRES: x86
13# RUN: llvm-mc -filetype=obj -triple=x86_64 %s -o %t1.o
14# RUN: not ld.lld --debug-names %t1.o -o /dev/null 2>&1 \
15# RUN:   | FileCheck -DFILE=%t1.o --implicit-check-not=error: %s
16
17# CHECK: error: [[FILE]]:(.debug_names): unrecognized form encoding 25 in abbrev table
18
19	.text
20	.globl	main                            # -- Begin function main
21	.p2align	4, 0x90
22	.type	main,@function
23main:                                   # @main
24.Lfunc_begin0:
25	.cfi_startproc
26# %bb.0:                                # %entry
27	pushq	%rbp
28	.cfi_def_cfa_offset 16
29	.cfi_offset %rbp, -16
30	movq	%rsp, %rbp
31	.cfi_def_cfa_register %rbp
32	movl	%edi, -4(%rbp)
33	movq	%rsi, -16(%rbp)
34.Ltmp0:
35	xorl	%eax, %eax
36	popq	%rbp
37	.cfi_def_cfa %rsp, 8
38	retq
39.Ltmp1:
40.Lfunc_end0:
41	.size	main, .Lfunc_end0-main
42	.cfi_endproc
43                                        # -- End function
44	.section	.debug_abbrev,"",@progbits
45	.byte	0                               # EOM(1)
46	.byte	0                               # EOM(2)
47	.byte	0                               # EOM(3)
48	.section	.debug_info,"",@progbits
49.Lcu_begin0:
50	.long	.Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
51.Ldebug_info_start0:
52	.short	5                               # DWARF version number
53	.byte	1                               # DWARF Unit Type
54	.byte	8                               # Address Size (in bytes)
55	.long	.debug_abbrev                   # Offset Into Abbrev. Section
56.Ldebug_info_end0:
57	.section	.debug_str_offsets,"",@progbits
58	.long	36                              # Length of String Offsets Set
59	.short	5
60	.short	0
61.Lstr_offsets_base0:
62	.section	.debug_str,"MS",@progbits,1
63.Linfo_string0:
64	.asciz	"clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)" # string offset=0
65.Linfo_string1:
66	.asciz	"a.cpp"                         # string offset=104
67.Linfo_string2:
68	.asciz	"/proc/self/cwd"                # string offset=110
69.Linfo_string3:
70	.asciz	"main"                          # string offset=125
71.Linfo_string4:
72	.asciz	"int"                           # string offset=130
73.Linfo_string5:
74	.asciz	"argc"                          # string offset=134
75.Linfo_string6:
76	.asciz	"argv"                          # string offset=139
77.Linfo_string7:
78	.asciz	"char"                          # string offset=144
79.Laddr_table_base0:
80	.quad	.Lfunc_begin0
81.Ldebug_addr_end0:
82	.section	.debug_names,"",@progbits
83	.long	.Lnames_end0-.Lnames_start0     # Header: unit length
84.Lnames_start0:
85	.short	5                               # Header: version
86	.short	0                               # Header: padding
87	.long	1                               # Header: compilation unit count
88	.long	0                               # Header: local type unit count
89	.long	0                               # Header: foreign type unit count
90	.long	3                               # Header: bucket count
91	.long	3                               # Header: name count
92	.long	.Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size
93	.long	8                               # Header: augmentation string size
94	.ascii	"LLVM0700"                      # Header: augmentation string
95	.long	.Lcu_begin0                     # Compilation unit 0
96	.long	0                               # Bucket 0
97	.long	1                               # Bucket 1
98	.long	2                               # Bucket 2
99	.long	2090499946                      # Hash in Bucket 1
100	.long	193495088                       # Hash in Bucket 2
101	.long	2090147939                      # Hash in Bucket 2
102	.long	.Linfo_string3                  # String in Bucket 1: main
103	.long	.Linfo_string4                  # String in Bucket 2: int
104	.long	.Linfo_string7                  # String in Bucket 2: char
105	.long	.Lnames0-.Lnames_entries0       # Offset in Bucket 1
106	.long	.Lnames1-.Lnames_entries0       # Offset in Bucket 2
107	.long	.Lnames2-.Lnames_entries0       # Offset in Bucket 2
108.Lnames_abbrev_start0:
109	.byte	1                               # Abbrev code
110	.byte	46                              # DW_TAG_subprogram
111	.byte	3                               # DW_IDX_die_offset
112	.byte	25                              # DW_FORM_flag_present
113	.byte	4                               # DW_IDX_parent
114	.byte	19                              # DW_FORM_ref4
115	.byte	0                               # End of abbrev
116	.byte	0                               # End of abbrev
117	.byte	2                               # Abbrev code
118	.byte	36                              # DW_TAG_base_type
119	.byte	3                               # DW_IDX_die_offset
120	.byte	19                              # DW_FORM_ref4
121	.byte	4                               # DW_IDX_parent
122	.byte	25                              # DW_FORM_flag_present
123	.byte	0                               # End of abbrev
124	.byte	0                               # End of abbrev
125	.byte	0                               # End of abbrev list
126.Lnames_abbrev_end0:
127.Lnames_entries0:
128.Lnames0:
129.L1:
130	.byte	1                               # Abbreviation code
131	.byte	35                              # DW_IDX_die_offset
132	.long	0                               # DW_IDX_parent
133                                        # End of list: main
134.Lnames1:
135.L0:
136	.byte	2                               # Abbreviation code
137	.long	73                              # DW_IDX_die_offset
138	.byte	0                               # DW_IDX_parent
139                                        # End of list: int
140.Lnames2:
141.L2:
142	.byte	2                               # Abbreviation code
143	.long	87                              # DW_IDX_die_offset
144	.byte	0                               # DW_IDX_parent
145                                        # End of list: char
146	.p2align	2, 0x0
147.Lnames_end0:
148	.ident	"clang version 19.0.0git (git@github.com:llvm/llvm-project.git 53b14cd9ce2b57da73d173fc876d2e9e199f5640)"
149	.section	".note.GNU-stack","",@progbits
150	.addrsig
151	.section	.debug_line,"",@progbits
152.Lline_table_start0:
153