Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lld / test / ELF / debug-line-obj.s
blobb4b627ca1431de8fb8c2f0446a39a9dc25ceaa73
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux -dwarf-version=5 %s -o %t.o
3 # RUN: not ld.lld %t.o -o /dev/null 2>&1 | FileCheck %s
5 # When compiling with -ffunction-sections, .debug_line may contain descriptions
6 # of locations from the different text sections. Until relocated such
7 # descriptions might contain overlapping offsets. Check LLD is able to report
8 # the error locations correctly in this case.
10 # CHECK: error: undefined symbol: foo()
11 # CHECK-NEXT: >>> referenced by test.cpp:2
12 # CHECK-NEXT: >>> {{.*}}.o:(bar())
13 # CHECK-NEXT: >>> referenced by test.cpp:3
14 # CHECK-NEXT: >>> {{.*}}.o:(baz())
16 # The code below is the reduced version of the output
17 # from the following invocation and source:
19 # // test.cpp:
20 # int foo();
21 # int bar() { return foo(); }
22 # int baz() { return foo(); }
24 # clang -gdwarf-5 -ffunction-sections test.cpp -o test.s -S
26 .text
27 .file "test.cpp"
28 .section .text._Z3barv,"ax",@progbits
29 .globl _Z3barv
30 .type _Z3barv,@function
31 _Z3barv:
32 .Lfunc_begin0:
33 .file 0 "/path" "test.cpp" md5 0x9ff11a8404ab4d032ee2dd4f5f8c4140
34 .loc 0 2 0 # test.cpp:2:0
35 .loc 0 2 20 prologue_end # test.cpp:2:20
36 callq _Z3foov
37 .loc 0 2 13 is_stmt 0 # test.cpp:2:13
38 .Lfunc_end0:
39 .size _Z3barv, .Lfunc_end0-_Z3barv
40 # -- End function
41 .section .text._Z3bazv,"ax",@progbits
42 .globl _Z3bazv # -- Begin function _Z3bazv
43 .type _Z3bazv,@function
44 _Z3bazv: # @_Z3bazv
45 .Lfunc_begin1:
46 .loc 0 3 0 is_stmt 1 # test.cpp:3:0
47 .loc 0 3 20 prologue_end # test.cpp:3:20
48 callq _Z3foov
49 .loc 0 3 13 is_stmt 0 # test.cpp:3:13
50 .Lfunc_end1:
51 .size _Z3bazv, .Lfunc_end1-_Z3bazv
53 .section .debug_str,"MS",@progbits,1
54 .Linfo_string0:
55 .asciz "stub"
57 .section .debug_str_offsets,"",@progbits
58 .long 8
59 .short 5
60 .short 0
61 .Lstr_offsets_base0:
62 .long .Linfo_string0
64 .section .debug_abbrev,"",@progbits
65 .byte 1 # Abbreviation Code
66 .byte 17 # DW_TAG_compile_unit
67 .byte 1 # DW_CHILDREN_yes
68 .byte 37 # DW_AT_producer
69 .byte 37 # DW_FORM_strx1
70 .byte 19 # DW_AT_language
71 .byte 5 # DW_FORM_data2
72 .byte 3 # DW_AT_name
73 .byte 37 # DW_FORM_strx1
74 .byte 114 # DW_AT_str_offsets_base
75 .byte 23 # DW_FORM_sec_offset
76 .byte 16 # DW_AT_stmt_list
77 .byte 23 # DW_FORM_sec_offset
78 .byte 27 # DW_AT_comp_dir
79 .byte 37 # DW_FORM_strx1
80 .byte 115 # DW_AT_addr_base
81 .byte 23 # DW_FORM_sec_offset
82 .byte 17 # DW_AT_low_pc
83 .byte 1 # DW_FORM_addr
84 .byte 85 # DW_AT_ranges
85 .byte 35 # DW_FORM_rnglistx
86 .byte 116 # DW_AT_rnglists_base
87 .byte 23 # DW_FORM_sec_offset
88 .byte 0 # EOM(1)
89 .byte 0 # EOM(2)
90 .byte 2 # Abbreviation Code
91 .byte 46 # DW_TAG_subprogram
92 .byte 0 # DW_CHILDREN_no
93 .byte 17 # DW_AT_low_pc
94 .byte 27 # DW_FORM_addrx
95 .byte 18 # DW_AT_high_pc
96 .byte 6 # DW_FORM_data4
97 .byte 64 # DW_AT_frame_base
98 .byte 24 # DW_FORM_exprloc
99 .byte 110 # DW_AT_linkage_name
100 .byte 37 # DW_FORM_strx1
101 .byte 3 # DW_AT_name
102 .byte 37 # DW_FORM_strx1
103 .byte 58 # DW_AT_decl_file
104 .byte 11 # DW_FORM_data1
105 .byte 59 # DW_AT_decl_line
106 .byte 11 # DW_FORM_data1
107 .byte 73 # DW_AT_type
108 .byte 19 # DW_FORM_ref4
109 .byte 63 # DW_AT_external
110 .byte 25 # DW_FORM_flag_present
111 .byte 0 # EOM(1)
112 .byte 0 # EOM(2)
113 .byte 3 # Abbreviation Code
114 .byte 36 # DW_TAG_base_type
115 .byte 0 # DW_CHILDREN_no
116 .byte 3 # DW_AT_name
117 .byte 37 # DW_FORM_strx1
118 .byte 62 # DW_AT_encoding
119 .byte 11 # DW_FORM_data1
120 .byte 11 # DW_AT_byte_size
121 .byte 11 # DW_FORM_data1
122 .byte 0 # EOM(1)
123 .byte 0 # EOM(2)
124 .byte 0 # EOM(3)
126 .section .debug_info,"",@progbits
127 .Lcu_begin0:
128 .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit
129 .Ldebug_info_start0:
130 .short 5 # DWARF version number
131 .byte 1 # DWARF Unit Type
132 .byte 8 # Address Size (in bytes)
133 .long .debug_abbrev # Offset Into Abbrev. Section
134 .byte 1 # Abbrev [1] 0xc:0x44 DW_TAG_compile_unit
135 .byte 0 # DW_AT_producer
136 .short 4 # DW_AT_language
137 .byte 0 # DW_AT_name
138 .long .Lstr_offsets_base0 # DW_AT_str_offsets_base
139 .long .Lline_table_start0 # DW_AT_stmt_list
140 .byte 2 # DW_AT_comp_dir
141 .long 0 # DW_AT_addr_base
142 .quad 0 # DW_AT_low_pc
143 .byte 0 # DW_AT_ranges
144 .long 0 # DW_AT_rnglists_base
145 .byte 2 # Abbrev [2] 0x2b:0x10 DW_TAG_subprogram
146 .byte 0 # DW_AT_low_pc
147 .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc
148 .byte 1 # DW_AT_frame_base
149 .byte 86
150 .byte 3 # DW_AT_linkage_name
151 .byte 0 # DW_AT_name
152 .byte 1 # DW_AT_decl_file
153 .byte 2 # DW_AT_decl_line
154 .long 75 # DW_AT_type
155 # DW_AT_external
156 .byte 2 # Abbrev [2] 0x3b:0x10 DW_TAG_subprogram
157 .byte 1 # DW_AT_low_pc
158 .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc
159 .byte 1 # DW_AT_frame_base
160 .byte 86
161 .byte 6 # DW_AT_linkage_name
162 .byte 0 # DW_AT_name
163 .byte 1 # DW_AT_decl_file
164 .byte 3 # DW_AT_decl_line
165 .long 75 # DW_AT_type
166 # DW_AT_external
167 .byte 3 # Abbrev [3] 0x4b:0x4 DW_TAG_base_type
168 .byte 0 # DW_AT_name
169 .byte 5 # DW_AT_encoding
170 .byte 4 # DW_AT_byte_size
171 .byte 0 # End Of Children Mark
172 .Ldebug_info_end0:
174 .section .debug_line,"",@progbits
175 .Lline_table_start0: