Don't generate .debug_line section if it isn't empty.
[external/binutils.git] / gas / testsuite / gas / elf / dwarf2-2.s
1 /* This testcase is derived from a similar test in GDB.
2
3    Copyright 2009 Free Software Foundation, Inc.
4
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17
18 /* This tests that gdb can read compressed sections.  The contents
19    are a basic assembly file, but the .debug_abbrev section has been
20    comrpessed using zlib.  */
21
22 /* Dummy function to provide debug information for.  */
23
24         .file "dwarf2-2.c"
25         .section .gnu.linkonce.t.foo,"axG",%progbits,foo,comdat
26         .globl _start
27 _start:
28         .int 0
29 .Lbegin_text1:
30         .globl func_cu1
31         .type func_cu1, %function
32 func_cu1:
33 .Lbegin_func_cu1:
34         .int 0
35 .Lend_func_cu1:
36         .size func_cu1, .-func_cu1
37 .Lend_text1:
38
39 /* Debug information */
40
41         .section .debug_info,"G",%progbits,foo,comdat
42 .Lcu1_begin:
43         /* CU header */
44         .4byte  .Lcu1_end - .Lcu1_start         /* Length of Compilation Unit */
45 .Lcu1_start:
46         .2byte  2                               /* DWARF Version */
47         .4byte  .Labbrev1_begin                 /* Offset into abbrev section */
48         .byte   4                               /* Pointer size */
49
50         /* CU die */
51         .uleb128 1                              /* Abbrev: DW_TAG_compile_unit */
52         .4byte  .Lline1_begin                   /* DW_AT_stmt_list */
53         .4byte  .Lend_text1                     /* DW_AT_high_pc */
54         .4byte  .Lbegin_text1                   /* DW_AT_low_pc */
55         .ascii  "file1.txt\0"                   /* DW_AT_name */
56         .ascii  "GNU C 3.3.3\0"                 /* DW_AT_producer */
57         .byte   1                               /* DW_AT_language (C) */
58
59         /* func_cu1 */
60         .uleb128        2                       /* Abbrev: DW_TAG_subprogram */
61         .byte           1                       /* DW_AT_external */
62         .byte           1                       /* DW_AT_decl_file */
63         .byte           2                       /* DW_AT_decl_line */
64         .ascii          "func_cu1\0"            /* DW_AT_name */
65         .4byte          .Ltype_int-.Lcu1_begin  /* DW_AT_type */
66         .4byte          .Lbegin_func_cu1        /* DW_AT_low_pc */
67         .4byte          .Lend_func_cu1          /* DW_AT_high_pc */
68         .byte           1                       /* DW_AT_frame_base: length */
69         .byte           0x55                    /* DW_AT_frame_base: DW_OP_reg5 */
70
71 .Ltype_int:
72         .uleb128        3                       /* Abbrev: DW_TAG_base_type */
73         .ascii          "int\0"                 /* DW_AT_name */
74         .byte           4                       /* DW_AT_byte_size */
75         .byte           5                       /* DW_AT_encoding */
76
77         .byte           0                       /* End of children of CU */
78
79 .Lcu1_end:
80
81 /* Line table */
82         .section .debug_line,"G",%progbits,foo,comdat
83 .Lline1_begin:
84         .4byte          .Lline1_end - .Lline1_start     /* Initial length */
85 .Lline1_start:
86         .2byte          2                       /* Version */
87         .4byte          .Lline1_lines - .Lline1_hdr     /* header_length */
88 .Lline1_hdr:
89         .byte           1                       /* Minimum insn length */
90         .byte           1                       /* default_is_stmt */
91         .byte           1                       /* line_base */
92         .byte           1                       /* line_range */
93         .byte           0x10                    /* opcode_base */
94
95         /* Standard lengths */
96         .byte           0
97         .byte           1
98         .byte           1
99         .byte           1
100         .byte           1
101         .byte           0
102         .byte           0
103         .byte           0
104         .byte           1
105         .byte           0
106         .byte           0
107         .byte           1
108         .byte           0
109         .byte           0
110         .byte           0
111
112         /* Include directories */
113         .byte           0
114
115         /* File names */
116         .ascii          "file1.txt\0"
117         .uleb128        0
118         .uleb128        0
119         .uleb128        0
120
121         .byte           0
122
123 .Lline1_lines:
124         .byte           0       /* DW_LNE_set_address */
125         .uleb128        5
126         .byte           2
127         .4byte          .Lbegin_func_cu1
128
129         .byte           3       /* DW_LNS_advance_line */
130         .sleb128        3       /* ... to 4 */
131
132         .byte           1       /* DW_LNS_copy */
133
134         .byte           1       /* DW_LNS_copy (second time as an end-of-prologue marker) */
135
136         .byte           0       /* DW_LNE_set_address */
137         .uleb128        5
138         .byte           2
139         .4byte          .Lend_func_cu1
140
141         .byte           0       /* DW_LNE_end_of_sequence */
142         .uleb128        1
143         .byte           1
144
145 .Lline1_end:
146
147 /* Abbrev table -- compressed */
148         .section .zdebug_abbrev,"G",%progbits,foo,comdat
149 .Labbrev1_begin:
150         .ascii          "ZLIB"
151         .4byte          0
152         .2byte          0
153         .byte           0
154         .byte           51
155         .byte           0x78
156         .byte           0x5e
157         .byte           0x63
158         .byte           0x14
159         .byte           0x64
160         .byte           0x14
161         .byte           0x60
162         .byte           0x13
163         .byte           0x62
164         .byte           0x14
165         .byte           0x64
166         .byte           0x64
167         .byte           0xe6
168         .byte           0x50
169         .byte           0xe5
170         .byte           0x10
171         .byte           0xe6
172         .byte           0x66
173         .byte           0x60
174         .byte           0x60
175         .byte           0xd2
176         .byte           0x63
177         .byte           0xb0
178         .byte           0xe7
179         .byte           0xb1
180         .byte           0xe2
181         .byte           0xb6
182         .byte           0xe6
183         .byte           0x66
184         .byte           0xe6
185         .byte           0xf0
186         .byte           0x14
187         .byte           0x16
188         .byte           0x64
189         .byte           0x14
190         .byte           0x62
191         .byte           0x74
192         .byte           0xe0
193         .byte           0x02
194         .byte           0x00
195         .byte           0x25
196         .byte           0x78
197         .byte           0x02
198         .byte           0x81
199         .byte           0x78
200         .byte           0x9c
201         .byte           0x63
202         .byte           0x60
203         .byte           0x60
204         .byte           0x56
205         .byte           0x61
206         .byte           0x60
207         .byte           0xe6
208         .byte           0xe0
209         .byte           0xe6
210         .byte           0xb6
211         .byte           0xe3
212         .byte           0x66
213         .byte           0x00
214         .byte           0x02
215         .byte           0x00
216         .byte           0x04
217         .byte           0x9c
218         .byte           0x00
219         .byte           0x92