bfd/
[deliverable/binutils-gdb.git] / gold / defstd.cc
CommitLineData
ead1e424
ILT
1// defstd.cc -- define standard symbols for gold.
2
6cb15b7f
ILT
3// Copyright 2006, 2007 Free Software Foundation, Inc.
4// Written by Ian Lance Taylor <iant@google.com>.
5
6// This file is part of gold.
7
8// This program is free software; you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation; either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21// MA 02110-1301, USA.
22
ead1e424
ILT
23#include "gold.h"
24
25#include "symtab.h"
a445fddf 26#include "layout.h"
ead1e424
ILT
27#include "defstd.h"
28
29// This is a simple file which defines the standard symbols like
30// "_end".
31
32namespace
33{
34
35using namespace gold;
36
37const Define_symbol_in_section in_section[] =
38{
39 {
40 "__preinit_array_start", // name
41 ".preinit_array", // output_section
42 0, // value
43 0, // size
44 elfcpp::STT_NOTYPE, // type
45 elfcpp::STB_GLOBAL, // binding
46 elfcpp::STV_HIDDEN, // visibility
47 0, // nonvis
48 false, // offset_is_from_end
49 true // only_if_ref
50 },
51 {
52 "__preinit_array_end", // name
53 ".preinit_array", // output_section
54 0, // value
55 0, // size
56 elfcpp::STT_NOTYPE, // type
57 elfcpp::STB_GLOBAL, // binding
58 elfcpp::STV_HIDDEN, // visibility
59 0, // nonvis
60 true, // offset_is_from_end
61 true // only_if_ref
62 },
63 {
64 "__init_array_start", // name
65 ".init_array", // output_section
66 0, // value
67 0, // size
68 elfcpp::STT_NOTYPE, // type
69 elfcpp::STB_GLOBAL, // binding
70 elfcpp::STV_HIDDEN, // visibility
71 0, // nonvis
72 false, // offset_is_from_end
73 true // only_if_ref
74 },
75 {
76 "__init_array_end", // name
77 ".init_array", // output_section
78 0, // value
79 0, // size
80 elfcpp::STT_NOTYPE, // type
81 elfcpp::STB_GLOBAL, // binding
82 elfcpp::STV_HIDDEN, // visibility
83 0, // nonvis
84 true, // offset_is_from_end
85 true // only_if_ref
86 },
87 {
88 "__fini_array_start", // name
89 ".fini_array", // output_section
90 0, // value
91 0, // size
92 elfcpp::STT_NOTYPE, // type
93 elfcpp::STB_GLOBAL, // binding
94 elfcpp::STV_HIDDEN, // visibility
95 0, // nonvis
96 false, // offset_is_from_end
97 true // only_if_ref
98 },
99 {
100 "__fini_array_end", // name
101 ".fini_array", // output_section
102 0, // value
103 0, // size
104 elfcpp::STT_NOTYPE, // type
105 elfcpp::STB_GLOBAL, // binding
106 elfcpp::STV_HIDDEN, // visibility
107 0, // nonvis
108 true, // offset_is_from_end
109 true // only_if_ref
110 }
111};
112
113const int in_section_count = sizeof in_section / sizeof in_section[0];
114
115const Define_symbol_in_segment in_segment[] =
116{
f6ce93d6
ILT
117 {
118 "__executable_start", // name
119 elfcpp::PT_LOAD, // segment_type
120 elfcpp::PF(0), // segment_flags_set
121 elfcpp::PF(0), // segment_flags_clear
122 0, // value
123 0, // size
124 elfcpp::STT_NOTYPE, // type
125 elfcpp::STB_GLOBAL, // binding
126 elfcpp::STV_DEFAULT, // visibility
127 0, // nonvis
128 Symbol::SEGMENT_START, // offset_from_base
129 true // only_if_ref
130 },
131 {
132 "etext", // name
133 elfcpp::PT_LOAD, // segment_type
134 elfcpp::PF_X, // segment_flags_set
135 elfcpp::PF_W, // segment_flags_clear
136 0, // value
137 0, // size
138 elfcpp::STT_NOTYPE, // type
139 elfcpp::STB_GLOBAL, // binding
140 elfcpp::STV_DEFAULT, // visibility
141 0, // nonvis
142 Symbol::SEGMENT_END, // offset_from_base
143 true // only_if_ref
144 },
145 {
146 "_etext", // name
147 elfcpp::PT_LOAD, // segment_type
148 elfcpp::PF_X, // segment_flags_set
149 elfcpp::PF_W, // segment_flags_clear
150 0, // value
151 0, // size
152 elfcpp::STT_NOTYPE, // type
153 elfcpp::STB_GLOBAL, // binding
154 elfcpp::STV_DEFAULT, // visibility
155 0, // nonvis
156 Symbol::SEGMENT_END, // offset_from_base
157 true // only_if_ref
158 },
159 {
160 "__etext", // name
161 elfcpp::PT_LOAD, // segment_type
162 elfcpp::PF_X, // segment_flags_set
163 elfcpp::PF_W, // segment_flags_clear
164 0, // value
165 0, // size
166 elfcpp::STT_NOTYPE, // type
167 elfcpp::STB_GLOBAL, // binding
168 elfcpp::STV_DEFAULT, // visibility
169 0, // nonvis
170 Symbol::SEGMENT_END, // offset_from_base
171 true // only_if_ref
172 },
173 {
174 "_edata", // name
175 elfcpp::PT_LOAD, // segment_type
04df9a57 176 elfcpp::PF_W, // segment_flags_set
f6ce93d6
ILT
177 elfcpp::PF(0), // segment_flags_clear
178 0, // value
179 0, // size
180 elfcpp::STT_NOTYPE, // type
181 elfcpp::STB_GLOBAL, // binding
182 elfcpp::STV_DEFAULT, // visibility
183 0, // nonvis
184 Symbol::SEGMENT_BSS, // offset_from_base
185 false // only_if_ref
186 },
187 {
188 "edata", // name
189 elfcpp::PT_LOAD, // segment_type
04df9a57 190 elfcpp::PF_W, // segment_flags_set
f6ce93d6
ILT
191 elfcpp::PF(0), // segment_flags_clear
192 0, // value
193 0, // size
194 elfcpp::STT_NOTYPE, // type
195 elfcpp::STB_GLOBAL, // binding
196 elfcpp::STV_DEFAULT, // visibility
197 0, // nonvis
198 Symbol::SEGMENT_BSS, // offset_from_base
199 true // only_if_ref
200 },
201 {
202 "__bss_start", // name
203 elfcpp::PT_LOAD, // segment_type
04df9a57 204 elfcpp::PF_W, // segment_flags_set
f6ce93d6
ILT
205 elfcpp::PF(0), // segment_flags_clear
206 0, // value
207 0, // size
208 elfcpp::STT_NOTYPE, // type
209 elfcpp::STB_GLOBAL, // binding
210 elfcpp::STV_DEFAULT, // visibility
211 0, // nonvis
212 Symbol::SEGMENT_BSS, // offset_from_base
213 false // only_if_ref
214 },
ead1e424
ILT
215 {
216 "_end", // name
217 elfcpp::PT_LOAD, // segment_type
04df9a57 218 elfcpp::PF_W, // segment_flags_set
f6ce93d6
ILT
219 elfcpp::PF(0), // segment_flags_clear
220 0, // value
221 0, // size
222 elfcpp::STT_NOTYPE, // type
223 elfcpp::STB_GLOBAL, // binding
224 elfcpp::STV_DEFAULT, // visibility
225 0, // nonvis
04df9a57 226 Symbol::SEGMENT_END, // offset_from_base
f6ce93d6
ILT
227 false // only_if_ref
228 },
229 {
230 "end", // name
231 elfcpp::PT_LOAD, // segment_type
04df9a57 232 elfcpp::PF_W, // segment_flags_set
ead1e424
ILT
233 elfcpp::PF(0), // segment_flags_clear
234 0, // value
235 0, // size
236 elfcpp::STT_NOTYPE, // type
237 elfcpp::STB_GLOBAL, // binding
238 elfcpp::STV_DEFAULT, // visibility
239 0, // nonvis
04df9a57 240 Symbol::SEGMENT_END, // offset_from_base
ead1e424
ILT
241 false // only_if_ref
242 }
243};
244
245const int in_segment_count = sizeof in_segment / sizeof in_segment[0];
246
247} // End anonymous namespace.
248
249namespace gold
250{
251
252void
9b07f471 253define_standard_symbols(Symbol_table* symtab, const Layout* layout)
ead1e424 254{
a445fddf
ILT
255 bool saw_sections_clause = layout->script_options()->saw_sections_clause();
256 symtab->define_symbols(layout, in_section_count, in_section,
257 saw_sections_clause);
258 symtab->define_symbols(layout, in_segment_count, in_segment,
259 saw_sections_clause);
ead1e424
ILT
260}
261
262} // End namespace gold.
This page took 0.089612 seconds and 4 git commands to generate.