1/* Copyright (C) 2015-2020 Free Software Foundation, Inc.
2
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License as published by
5   the Free Software Foundation; either version 3 of the License, or
6   (at your option) any later version.
7
8   This program is distributed in the hope that it will be useful,
9   but WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   GNU General Public License for more details.
12
13   You should have received a copy of the GNU General Public License
14   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
15
16/* This tests makes use of the .debug_ranges section, especially,
17   making sure that the base address encoding scheme is used.  */
18
19/* Dummy function to provide debug information for.  */
20
21	.text
22	.globl _start
23_start:
24	.4byte 0
25.Lbegin_text1:
26	.globl func_cu1
27	.type func_cu1, %function
28func_cu1:
29.Lbegin_func_cu1:
30	.4byte 0
31.Lend_func_cu1:
32	.size func_cu1, .-func_cu1
33.Lend_text1:
34
35.Lbegin_text2:
36	.globl func_cu2
37	.type func_cu2, %function
38func_cu2:
39.Lbegin_func_cu2:
40	.4byte 0
41.Lend_func_cu2:
42	.size func_cu2, .-func_cu2
43.Lend_text2:
44
45/* Debug information */
46
47	.section .debug_info
48.Lcu1_begin:
49	/* CU header */
50	.4byte	.Lcu1_end - .Lcu1_start		/* Length of Compilation Unit */
51.Lcu1_start:
52	.2byte	2				/* DWARF Version */
53	.4byte	.Labbrev1_begin			/* Offset into abbrev section */
54	.byte	4				/* Pointer size */
55
56	/* CU die */
57	.uleb128 1				/* Abbrev: DW_TAG_compile_unit */
58        .4byte  .Lrange1_begin
59	.ascii	"file1.c\0"			/* DW_AT_name */
60	.byte	1				/* DW_AT_language (C) */
61
62	/* func_cu1 */
63	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
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
69	/* func_cu1 */
70	.uleb128	2			/* Abbrev: DW_TAG_subprogram */
71	.ascii		"func_cu2\0"		/* DW_AT_name */
72	.4byte		.Ltype_int-.Lcu1_begin	/* DW_AT_type */
73	.4byte		.Lbegin_func_cu2	/* DW_AT_low_pc */
74	.4byte		.Lend_func_cu2		/* DW_AT_high_pc */
75
76.Ltype_int:
77	.uleb128	3			/* Abbrev: DW_TAG_base_type */
78	.ascii		"int\0"			/* DW_AT_name */
79	.byte		4			/* DW_AT_byte_size */
80	.byte		5			/* DW_AT_encoding */
81
82	.byte		0			/* End of children of CU */
83
84.Lcu1_end:
85
86        .section .debug_ranges
87.Lrange1_begin:
88        .4byte  0xffffffff                      /* base address marker */
89	.4byte	.Lbegin_text1                   /* base address */
90        .4byte  0                               /* start offset */
91	.4byte	.Lend_text1 - .Lbegin_text1     /* end offset */
92        .4byte  0xffffffff                      /* base address marker */
93	.4byte	.Lbegin_text2                   /* base address */
94        .4byte  0                               /* start offset */
95	.4byte	.Lend_text2 - .Lbegin_text2     /* end offset */
96        .4byte  0                               /* End marker (Part 1) */
97        .4byte  0                               /* End marker (Part 2) */
98
99	.section .debug_abbrev
100.Labbrev1_begin:
101	.uleb128	1			/* Abbrev code */
102	.uleb128	0x11			/* DW_TAG_compile_unit */
103	.byte		1			/* has_children */
104        .uleb128	0x55			/* DW_AT_ranges */
105	.uleb128	0x17			/* DW_FORM_sec_offset */
106	.uleb128	0x3			/* DW_AT_name */
107	.uleb128	0x8			/* DW_FORM_string */
108	.uleb128	0x13			/* DW_AT_language */
109	.uleb128	0xb			/* DW_FORM_data1 */
110	.byte		0x0			/* Terminator */
111	.byte		0x0			/* Terminator */
112
113	.uleb128	2			/* Abbrev code */
114	.uleb128	0x2e			/* DW_TAG_subprogram */
115	.byte		0			/* has_children */
116	.uleb128	0x3			/* DW_AT_name */
117	.uleb128	0x8			/* DW_FORM_string */
118	.uleb128	0x49			/* DW_AT_type */
119	.uleb128	0x13			/* DW_FORM_ref4 */
120	.uleb128	0x11			/* DW_AT_low_pc */
121	.uleb128	0x1			/* DW_FORM_addr */
122	.uleb128	0x12			/* DW_AT_high_pc */
123	.uleb128	0x1			/* DW_FORM_addr */
124	.byte		0x0			/* Terminator */
125	.byte		0x0			/* Terminator */
126
127	.uleb128	3			/* Abbrev code */
128	.uleb128	0x24			/* DW_TAG_base_type */
129	.byte		0			/* has_children */
130	.uleb128	0x3			/* DW_AT_name */
131	.uleb128	0x8			/* DW_FORM_string */
132	.uleb128	0xb			/* DW_AT_byte_size */
133	.uleb128	0xb			/* DW_FORM_data1 */
134	.uleb128	0x3e			/* DW_AT_encoding */
135	.uleb128	0xb			/* DW_FORM_data1 */
136	.byte		0x0			/* Terminator */
137	.byte		0x0			/* Terminator */
138
139	.byte		0x0			/* Terminator */
140	.byte		0x0			/* Terminator */
141