daily update
[binutils.git] / gold / defstd.cc
blob568ab4a7c09da29f62983c1ed01ca93d9aee71af
1 // defstd.cc -- define standard symbols for gold.
3 // Copyright 2006, 2007 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
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.
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.
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.
23 #include "gold.h"
25 #include "symtab.h"
26 #include "defstd.h"
28 // This is a simple file which defines the standard symbols like
29 // "_end".
31 namespace
34 using namespace gold;
36 const Define_symbol_in_section in_section[] =
39 "__preinit_array_start", // name
40 ".preinit_array", // output_section
41 0, // value
42 0, // size
43 elfcpp::STT_NOTYPE, // type
44 elfcpp::STB_GLOBAL, // binding
45 elfcpp::STV_HIDDEN, // visibility
46 0, // nonvis
47 false, // offset_is_from_end
48 true // only_if_ref
51 "__preinit_array_end", // name
52 ".preinit_array", // output_section
53 0, // value
54 0, // size
55 elfcpp::STT_NOTYPE, // type
56 elfcpp::STB_GLOBAL, // binding
57 elfcpp::STV_HIDDEN, // visibility
58 0, // nonvis
59 true, // offset_is_from_end
60 true // only_if_ref
63 "__init_array_start", // name
64 ".init_array", // output_section
65 0, // value
66 0, // size
67 elfcpp::STT_NOTYPE, // type
68 elfcpp::STB_GLOBAL, // binding
69 elfcpp::STV_HIDDEN, // visibility
70 0, // nonvis
71 false, // offset_is_from_end
72 true // only_if_ref
75 "__init_array_end", // name
76 ".init_array", // output_section
77 0, // value
78 0, // size
79 elfcpp::STT_NOTYPE, // type
80 elfcpp::STB_GLOBAL, // binding
81 elfcpp::STV_HIDDEN, // visibility
82 0, // nonvis
83 true, // offset_is_from_end
84 true // only_if_ref
87 "__fini_array_start", // name
88 ".fini_array", // output_section
89 0, // value
90 0, // size
91 elfcpp::STT_NOTYPE, // type
92 elfcpp::STB_GLOBAL, // binding
93 elfcpp::STV_HIDDEN, // visibility
94 0, // nonvis
95 false, // offset_is_from_end
96 true // only_if_ref
99 "__fini_array_end", // name
100 ".fini_array", // output_section
101 0, // value
102 0, // size
103 elfcpp::STT_NOTYPE, // type
104 elfcpp::STB_GLOBAL, // binding
105 elfcpp::STV_HIDDEN, // visibility
106 0, // nonvis
107 true, // offset_is_from_end
108 true // only_if_ref
112 const int in_section_count = sizeof in_section / sizeof in_section[0];
114 const Define_symbol_in_segment in_segment[] =
117 "__executable_start", // name
118 elfcpp::PT_LOAD, // segment_type
119 elfcpp::PF(0), // segment_flags_set
120 elfcpp::PF(0), // segment_flags_clear
121 0, // value
122 0, // size
123 elfcpp::STT_NOTYPE, // type
124 elfcpp::STB_GLOBAL, // binding
125 elfcpp::STV_DEFAULT, // visibility
126 0, // nonvis
127 Symbol::SEGMENT_START, // offset_from_base
128 true // only_if_ref
131 "etext", // name
132 elfcpp::PT_LOAD, // segment_type
133 elfcpp::PF_X, // segment_flags_set
134 elfcpp::PF_W, // segment_flags_clear
135 0, // value
136 0, // size
137 elfcpp::STT_NOTYPE, // type
138 elfcpp::STB_GLOBAL, // binding
139 elfcpp::STV_DEFAULT, // visibility
140 0, // nonvis
141 Symbol::SEGMENT_END, // offset_from_base
142 true // only_if_ref
145 "_etext", // name
146 elfcpp::PT_LOAD, // segment_type
147 elfcpp::PF_X, // segment_flags_set
148 elfcpp::PF_W, // segment_flags_clear
149 0, // value
150 0, // size
151 elfcpp::STT_NOTYPE, // type
152 elfcpp::STB_GLOBAL, // binding
153 elfcpp::STV_DEFAULT, // visibility
154 0, // nonvis
155 Symbol::SEGMENT_END, // offset_from_base
156 true // only_if_ref
159 "__etext", // name
160 elfcpp::PT_LOAD, // segment_type
161 elfcpp::PF_X, // segment_flags_set
162 elfcpp::PF_W, // segment_flags_clear
163 0, // value
164 0, // size
165 elfcpp::STT_NOTYPE, // type
166 elfcpp::STB_GLOBAL, // binding
167 elfcpp::STV_DEFAULT, // visibility
168 0, // nonvis
169 Symbol::SEGMENT_END, // offset_from_base
170 true // only_if_ref
173 "_edata", // name
174 elfcpp::PT_LOAD, // segment_type
175 elfcpp::PF_W, // segment_flags_set
176 elfcpp::PF(0), // segment_flags_clear
177 0, // value
178 0, // size
179 elfcpp::STT_NOTYPE, // type
180 elfcpp::STB_GLOBAL, // binding
181 elfcpp::STV_DEFAULT, // visibility
182 0, // nonvis
183 Symbol::SEGMENT_BSS, // offset_from_base
184 false // only_if_ref
187 "edata", // name
188 elfcpp::PT_LOAD, // segment_type
189 elfcpp::PF_W, // segment_flags_set
190 elfcpp::PF(0), // segment_flags_clear
191 0, // value
192 0, // size
193 elfcpp::STT_NOTYPE, // type
194 elfcpp::STB_GLOBAL, // binding
195 elfcpp::STV_DEFAULT, // visibility
196 0, // nonvis
197 Symbol::SEGMENT_BSS, // offset_from_base
198 true // only_if_ref
201 "__bss_start", // name
202 elfcpp::PT_LOAD, // segment_type
203 elfcpp::PF_W, // segment_flags_set
204 elfcpp::PF(0), // segment_flags_clear
205 0, // value
206 0, // size
207 elfcpp::STT_NOTYPE, // type
208 elfcpp::STB_GLOBAL, // binding
209 elfcpp::STV_DEFAULT, // visibility
210 0, // nonvis
211 Symbol::SEGMENT_BSS, // offset_from_base
212 false // only_if_ref
215 "_end", // name
216 elfcpp::PT_LOAD, // segment_type
217 elfcpp::PF_W, // segment_flags_set
218 elfcpp::PF(0), // segment_flags_clear
219 0, // value
220 0, // size
221 elfcpp::STT_NOTYPE, // type
222 elfcpp::STB_GLOBAL, // binding
223 elfcpp::STV_DEFAULT, // visibility
224 0, // nonvis
225 Symbol::SEGMENT_END, // offset_from_base
226 false // only_if_ref
229 "end", // name
230 elfcpp::PT_LOAD, // segment_type
231 elfcpp::PF_W, // segment_flags_set
232 elfcpp::PF(0), // segment_flags_clear
233 0, // value
234 0, // size
235 elfcpp::STT_NOTYPE, // type
236 elfcpp::STB_GLOBAL, // binding
237 elfcpp::STV_DEFAULT, // visibility
238 0, // nonvis
239 Symbol::SEGMENT_END, // offset_from_base
240 false // only_if_ref
244 const int in_segment_count = sizeof in_segment / sizeof in_segment[0];
246 } // End anonymous namespace.
248 namespace gold
251 void
252 define_standard_symbols(Symbol_table* symtab, const Layout* layout,
253 Target* target)
255 symtab->define_symbols(layout, target, in_section_count, in_section);
256 symtab->define_symbols(layout, target, in_segment_count, in_segment);
259 } // End namespace gold.