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.
29 // This is a simple file which defines the standard symbols like
37 const Define_symbol_in_section in_section
[] =
40 "__preinit_array_start", // name
41 ".preinit_array", // output_section
44 elfcpp::STT_NOTYPE
, // type
45 elfcpp::STB_GLOBAL
, // binding
46 elfcpp::STV_HIDDEN
, // visibility
48 false, // offset_is_from_end
52 "__preinit_array_end", // name
53 ".preinit_array", // output_section
56 elfcpp::STT_NOTYPE
, // type
57 elfcpp::STB_GLOBAL
, // binding
58 elfcpp::STV_HIDDEN
, // visibility
60 true, // offset_is_from_end
64 "__init_array_start", // name
65 ".init_array", // output_section
68 elfcpp::STT_NOTYPE
, // type
69 elfcpp::STB_GLOBAL
, // binding
70 elfcpp::STV_HIDDEN
, // visibility
72 false, // offset_is_from_end
76 "__init_array_end", // name
77 ".init_array", // output_section
80 elfcpp::STT_NOTYPE
, // type
81 elfcpp::STB_GLOBAL
, // binding
82 elfcpp::STV_HIDDEN
, // visibility
84 true, // offset_is_from_end
88 "__fini_array_start", // name
89 ".fini_array", // output_section
92 elfcpp::STT_NOTYPE
, // type
93 elfcpp::STB_GLOBAL
, // binding
94 elfcpp::STV_HIDDEN
, // visibility
96 false, // offset_is_from_end
100 "__fini_array_end", // name
101 ".fini_array", // output_section
104 elfcpp::STT_NOTYPE
, // type
105 elfcpp::STB_GLOBAL
, // binding
106 elfcpp::STV_HIDDEN
, // visibility
108 true, // offset_is_from_end
112 "__rel_iplt_start", // name
113 ".rel.iplt", // output_section
116 elfcpp::STT_NOTYPE
, // type
117 elfcpp::STB_GLOBAL
, // binding
118 elfcpp::STV_HIDDEN
, // visibility
120 false, // offset_is_from_end
124 "__rel_iplt_end", // name
125 ".rel.iplt", // output_section
128 elfcpp::STT_NOTYPE
, // type
129 elfcpp::STB_GLOBAL
, // binding
130 elfcpp::STV_HIDDEN
, // visibility
132 true, // offset_is_from_end
136 "__rela_iplt_start", // name
137 ".rela.iplt", // output_section
140 elfcpp::STT_NOTYPE
, // type
141 elfcpp::STB_GLOBAL
, // binding
142 elfcpp::STV_HIDDEN
, // visibility
144 false, // offset_is_from_end
148 "__rela_iplt_end", // name
149 ".rela.iplt", // output_section
152 elfcpp::STT_NOTYPE
, // type
153 elfcpp::STB_GLOBAL
, // binding
154 elfcpp::STV_HIDDEN
, // visibility
156 true, // offset_is_from_end
161 ".stack", // output_section
164 elfcpp::STT_NOTYPE
, // type
165 elfcpp::STB_GLOBAL
, // binding
166 elfcpp::STV_DEFAULT
, // visibility
168 false, // offset_is_from_end
173 const int in_section_count
= sizeof in_section
/ sizeof in_section
[0];
175 const Define_symbol_in_segment in_segment
[] =
178 "__executable_start", // name
179 elfcpp::PT_LOAD
, // segment_type
180 elfcpp::PF(0), // segment_flags_set
181 elfcpp::PF(0), // segment_flags_clear
184 elfcpp::STT_NOTYPE
, // type
185 elfcpp::STB_GLOBAL
, // binding
186 elfcpp::STV_DEFAULT
, // visibility
188 Symbol::SEGMENT_START
, // offset_from_base
193 elfcpp::PT_LOAD
, // segment_type
194 elfcpp::PF_X
, // segment_flags_set
195 elfcpp::PF_W
, // segment_flags_clear
198 elfcpp::STT_NOTYPE
, // type
199 elfcpp::STB_GLOBAL
, // binding
200 elfcpp::STV_DEFAULT
, // visibility
202 Symbol::SEGMENT_END
, // offset_from_base
207 elfcpp::PT_LOAD
, // segment_type
208 elfcpp::PF_X
, // segment_flags_set
209 elfcpp::PF_W
, // segment_flags_clear
212 elfcpp::STT_NOTYPE
, // type
213 elfcpp::STB_GLOBAL
, // binding
214 elfcpp::STV_DEFAULT
, // visibility
216 Symbol::SEGMENT_END
, // offset_from_base
221 elfcpp::PT_LOAD
, // segment_type
222 elfcpp::PF_X
, // segment_flags_set
223 elfcpp::PF_W
, // segment_flags_clear
226 elfcpp::STT_NOTYPE
, // type
227 elfcpp::STB_GLOBAL
, // binding
228 elfcpp::STV_DEFAULT
, // visibility
230 Symbol::SEGMENT_END
, // offset_from_base
235 elfcpp::PT_LOAD
, // segment_type
236 elfcpp::PF_W
, // segment_flags_set
237 elfcpp::PF(0), // segment_flags_clear
240 elfcpp::STT_NOTYPE
, // type
241 elfcpp::STB_GLOBAL
, // binding
242 elfcpp::STV_DEFAULT
, // visibility
244 Symbol::SEGMENT_BSS
, // offset_from_base
249 elfcpp::PT_LOAD
, // segment_type
250 elfcpp::PF_W
, // segment_flags_set
251 elfcpp::PF(0), // segment_flags_clear
254 elfcpp::STT_NOTYPE
, // type
255 elfcpp::STB_GLOBAL
, // binding
256 elfcpp::STV_DEFAULT
, // visibility
258 Symbol::SEGMENT_BSS
, // offset_from_base
262 "__bss_start", // name
263 elfcpp::PT_LOAD
, // segment_type
264 elfcpp::PF_W
, // segment_flags_set
265 elfcpp::PF(0), // segment_flags_clear
268 elfcpp::STT_NOTYPE
, // type
269 elfcpp::STB_GLOBAL
, // binding
270 elfcpp::STV_DEFAULT
, // visibility
272 Symbol::SEGMENT_BSS
, // offset_from_base
277 elfcpp::PT_LOAD
, // segment_type
278 elfcpp::PF_W
, // segment_flags_set
279 elfcpp::PF(0), // segment_flags_clear
282 elfcpp::STT_NOTYPE
, // type
283 elfcpp::STB_GLOBAL
, // binding
284 elfcpp::STV_DEFAULT
, // visibility
286 Symbol::SEGMENT_END
, // offset_from_base
291 elfcpp::PT_LOAD
, // segment_type
292 elfcpp::PF_W
, // segment_flags_set
293 elfcpp::PF(0), // segment_flags_clear
296 elfcpp::STT_NOTYPE
, // type
297 elfcpp::STB_GLOBAL
, // binding
298 elfcpp::STV_DEFAULT
, // visibility
300 Symbol::SEGMENT_END
, // offset_from_base
305 const int in_segment_count
= sizeof in_segment
/ sizeof in_segment
[0];
307 } // End anonymous namespace.
313 define_standard_symbols(Symbol_table
* symtab
, const Layout
* layout
)
315 bool saw_sections_clause
= layout
->script_options()->saw_sections_clause();
316 symtab
->define_symbols(layout
, in_section_count
, in_section
,
317 saw_sections_clause
);
318 symtab
->define_symbols(layout
, in_segment_count
, in_segment
,
319 saw_sections_clause
);
322 } // End namespace gold.