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.
28 // This is a simple file which defines the standard symbols like
36 const Define_symbol_in_section in_section[] =
39 "__preinit_array_start", // name
40 ".preinit_array", // output_section
43 elfcpp::STT_NOTYPE, // type
44 elfcpp::STB_GLOBAL, // binding
45 elfcpp::STV_HIDDEN, // visibility
47 false, // offset_is_from_end
51 "__preinit_array_end", // name
52 ".preinit_array", // output_section
55 elfcpp::STT_NOTYPE, // type
56 elfcpp::STB_GLOBAL, // binding
57 elfcpp::STV_HIDDEN, // visibility
59 true, // offset_is_from_end
63 "__init_array_start", // name
64 ".init_array", // output_section
67 elfcpp::STT_NOTYPE, // type
68 elfcpp::STB_GLOBAL, // binding
69 elfcpp::STV_HIDDEN, // visibility
71 false, // offset_is_from_end
75 "__init_array_end", // name
76 ".init_array", // output_section
79 elfcpp::STT_NOTYPE, // type
80 elfcpp::STB_GLOBAL, // binding
81 elfcpp::STV_HIDDEN, // visibility
83 true, // offset_is_from_end
87 "__fini_array_start", // name
88 ".fini_array", // output_section
91 elfcpp::STT_NOTYPE, // type
92 elfcpp::STB_GLOBAL, // binding
93 elfcpp::STV_HIDDEN, // visibility
95 false, // offset_is_from_end
99 "__fini_array_end", // name
100 ".fini_array", // output_section
103 elfcpp::STT_NOTYPE, // type
104 elfcpp::STB_GLOBAL, // binding
105 elfcpp::STV_HIDDEN, // visibility
107 true, // offset_is_from_end
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
123 elfcpp::STT_NOTYPE, // type
124 elfcpp::STB_GLOBAL, // binding
125 elfcpp::STV_DEFAULT, // visibility
127 Symbol::SEGMENT_START, // offset_from_base
132 elfcpp::PT_LOAD, // segment_type
133 elfcpp::PF_X, // segment_flags_set
134 elfcpp::PF_W, // segment_flags_clear
137 elfcpp::STT_NOTYPE, // type
138 elfcpp::STB_GLOBAL, // binding
139 elfcpp::STV_DEFAULT, // visibility
141 Symbol::SEGMENT_END, // offset_from_base
146 elfcpp::PT_LOAD, // segment_type
147 elfcpp::PF_X, // segment_flags_set
148 elfcpp::PF_W, // segment_flags_clear
151 elfcpp::STT_NOTYPE, // type
152 elfcpp::STB_GLOBAL, // binding
153 elfcpp::STV_DEFAULT, // visibility
155 Symbol::SEGMENT_END, // offset_from_base
160 elfcpp::PT_LOAD, // segment_type
161 elfcpp::PF_X, // segment_flags_set
162 elfcpp::PF_W, // segment_flags_clear
165 elfcpp::STT_NOTYPE, // type
166 elfcpp::STB_GLOBAL, // binding
167 elfcpp::STV_DEFAULT, // visibility
169 Symbol::SEGMENT_END, // offset_from_base
174 elfcpp::PT_LOAD, // segment_type
175 elfcpp::PF_W, // segment_flags_set
176 elfcpp::PF(0), // segment_flags_clear
179 elfcpp::STT_NOTYPE, // type
180 elfcpp::STB_GLOBAL, // binding
181 elfcpp::STV_DEFAULT, // visibility
183 Symbol::SEGMENT_BSS, // offset_from_base
188 elfcpp::PT_LOAD, // segment_type
189 elfcpp::PF_W, // segment_flags_set
190 elfcpp::PF(0), // segment_flags_clear
193 elfcpp::STT_NOTYPE, // type
194 elfcpp::STB_GLOBAL, // binding
195 elfcpp::STV_DEFAULT, // visibility
197 Symbol::SEGMENT_BSS, // offset_from_base
201 "__bss_start", // name
202 elfcpp::PT_LOAD, // segment_type
203 elfcpp::PF_W, // segment_flags_set
204 elfcpp::PF(0), // segment_flags_clear
207 elfcpp::STT_NOTYPE, // type
208 elfcpp::STB_GLOBAL, // binding
209 elfcpp::STV_DEFAULT, // visibility
211 Symbol::SEGMENT_BSS, // offset_from_base
216 elfcpp::PT_LOAD, // segment_type
217 elfcpp::PF_W, // segment_flags_set
218 elfcpp::PF(0), // segment_flags_clear
221 elfcpp::STT_NOTYPE, // type
222 elfcpp::STB_GLOBAL, // binding
223 elfcpp::STV_DEFAULT, // visibility
225 Symbol::SEGMENT_END, // offset_from_base
230 elfcpp::PT_LOAD, // segment_type
231 elfcpp::PF_W, // segment_flags_set
232 elfcpp::PF(0), // segment_flags_clear
235 elfcpp::STT_NOTYPE, // type
236 elfcpp::STB_GLOBAL, // binding
237 elfcpp::STV_DEFAULT, // visibility
239 Symbol::SEGMENT_END, // offset_from_base
244 const int in_segment_count = sizeof in_segment / sizeof in_segment[0];
246 } // End anonymous namespace.
252 define_standard_symbols(Symbol_table* symtab, const Layout* layout,
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.