Skip to content

Commit 0d1b21e

Browse files
committed
add new test for warning, update existing test to not fail with the warning
1 parent 027279a commit 0d1b21e

File tree

2 files changed

+136
-1
lines changed

2 files changed

+136
-1
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
# REQUIRES: x86
2+
3+
# RUN: rm -rf %t && split-file %s %t && cd %t
4+
# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux input.s -o input.o
5+
# RUN: ld.lld --gdb-index input.o -o output.exe 2>&1 | FileCheck %s --check-prefix=WARNING --implicit-check-not=warning:
6+
7+
# WARNING: warning: input.o: file contains debug info but is missing .debug_gnu_pubnames or .debug_gnu_pubtypes sections required by --gdb-index. Compile the file using -gsplit-dwarf or -ggnu-pubnames to generate these sections.
8+
9+
# The input file was generated by compiling 'void _start() {}' with
10+
# clang -g -O2 -S and stripping out some unneeded parts.
11+
12+
#--- input.s
13+
14+
.file "test.c"
15+
.text
16+
.globl _start # -- Begin function _start
17+
.p2align 4
18+
.type _start,@function
19+
_start: # @_start
20+
.Lfunc_begin0:
21+
.cfi_startproc
22+
nop
23+
.Lfunc_end0:
24+
.size _start, .Lfunc_end0-_start
25+
.cfi_endproc
26+
# -- End function
27+
.section .debug_abbrev,"",@progbits
28+
.byte 1 # Abbreviation Code
29+
.byte 17 # DW_TAG_compile_unit
30+
.byte 1 # DW_CHILDREN_yes
31+
.byte 37 # DW_AT_producer
32+
.byte 37 # DW_FORM_strx1
33+
.byte 19 # DW_AT_language
34+
.byte 5 # DW_FORM_data2
35+
.byte 3 # DW_AT_name
36+
.byte 37 # DW_FORM_strx1
37+
.byte 114 # DW_AT_str_offsets_base
38+
.byte 23 # DW_FORM_sec_offset
39+
.byte 16 # DW_AT_stmt_list
40+
.byte 23 # DW_FORM_sec_offset
41+
.byte 27 # DW_AT_comp_dir
42+
.byte 37 # DW_FORM_strx1
43+
.byte 17 # DW_AT_low_pc
44+
.byte 27 # DW_FORM_addrx
45+
.byte 18 # DW_AT_high_pc
46+
.byte 6 # DW_FORM_data4
47+
.byte 115 # DW_AT_addr_base
48+
.byte 23 # DW_FORM_sec_offset
49+
.byte 0 # EOM(1)
50+
.byte 0 # EOM(2)
51+
.byte 2 # Abbreviation Code
52+
.byte 46 # DW_TAG_subprogram
53+
.byte 0 # DW_CHILDREN_no
54+
.byte 17 # DW_AT_low_pc
55+
.byte 27 # DW_FORM_addrx
56+
.byte 18 # DW_AT_high_pc
57+
.byte 6 # DW_FORM_data4
58+
.byte 64 # DW_AT_frame_base
59+
.byte 24 # DW_FORM_exprloc
60+
.byte 122 # DW_AT_call_all_calls
61+
.byte 25 # DW_FORM_flag_present
62+
.byte 3 # DW_AT_name
63+
.byte 37 # DW_FORM_strx1
64+
.byte 58 # DW_AT_decl_file
65+
.byte 11 # DW_FORM_data1
66+
.byte 59 # DW_AT_decl_line
67+
.byte 11 # DW_FORM_data1
68+
.byte 63 # DW_AT_external
69+
.byte 25 # DW_FORM_flag_present
70+
.byte 0 # EOM(1)
71+
.byte 0 # EOM(2)
72+
.byte 0 # EOM(3)
73+
.section .debug_info,"",@progbits
74+
.Lcu_begin0:
75+
.long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
76+
.Ldebug_info_start0:
77+
.short 5 # DWARF version number
78+
.byte 1 # DWARF Unit Type
79+
.byte 8 # Address Size (in bytes)
80+
.long .debug_abbrev # Offset Into Abbrev. Section
81+
.byte 1 # Abbrev [1] 0xc:0x23 DW_TAG_compile_unit
82+
.byte 0 # DW_AT_producer
83+
.short 29 # DW_AT_language
84+
.byte 1 # DW_AT_name
85+
.long .Lstr_offsets_base0 # DW_AT_str_offsets_base
86+
.long .Lline_table_start0 # DW_AT_stmt_list
87+
.byte 2 # DW_AT_comp_dir
88+
.byte 0 # DW_AT_low_pc
89+
.long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
90+
.long .Laddr_table_base0 # DW_AT_addr_base
91+
.byte 2 # Abbrev [2] 0x23:0xb DW_TAG_subprogram
92+
.byte 0 # DW_AT_low_pc
93+
.long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
94+
.byte 1 # DW_AT_frame_base
95+
.byte 87
96+
# DW_AT_call_all_calls
97+
.byte 3 # DW_AT_name
98+
.byte 0 # DW_AT_decl_file
99+
.byte 1 # DW_AT_decl_line
100+
# DW_AT_external
101+
.byte 0 # End Of Children Mark
102+
.Ldebug_info_end0:
103+
.section .debug_str_offsets,"",@progbits
104+
.long 20 # Length of String Offsets Set
105+
.short 5
106+
.short 0
107+
.Lstr_offsets_base0:
108+
.section .debug_str,"MS",@progbits,1
109+
.Linfo_string0:
110+
.asciz "clang version 22.0.0git (027279a7ef2bedffcd0d23f605fc0e135ad77e37)"
111+
.Linfo_string1:
112+
.asciz "test.c"
113+
.Linfo_string2:
114+
.asciz ""
115+
.Linfo_string3:
116+
.asciz "_start"
117+
.section .debug_str_offsets,"",@progbits
118+
.long .Linfo_string0
119+
.long .Linfo_string1
120+
.long .Linfo_string2
121+
.long .Linfo_string3
122+
.section .debug_addr,"",@progbits
123+
.long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution
124+
.Ldebug_addr_start0:
125+
.short 5 # DWARF version number
126+
.byte 8 # Address size
127+
.byte 0 # Segment selector size
128+
.Laddr_table_base0:
129+
.quad .Lfunc_begin0
130+
.Ldebug_addr_end0:
131+
.ident "clang version 22.0.0git (027279a7ef2bedffcd0d23f605fc0e135ad77e37)"
132+
.section ".note.GNU-stack","",@progbits
133+
.addrsig
134+
.section .debug_line,"",@progbits
135+
.Lline_table_start0:

lld/test/ELF/gdb-index-multiple-cu-2.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# REQUIRES: x86
22
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
33
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/gdb-index-multiple-cu-2.s -o %t1.o
4-
# RUN: ld.lld --gdb-index %t.o %t1.o -o %t 2>&1 | count 0
4+
# RUN: ld.lld --gdb-index %t.o %t1.o -o %t 2>&1 | sed '/missing .debug_gnu_pubnames/d' | count 0
55
# RUN: llvm-dwarfdump -gdb-index %t | FileCheck %s
66

77
# %t.o has 2 CUs while %t1 has 1, thus _start in %t1.o should have cuIndex 2.

0 commit comments

Comments
 (0)