Commit | Line | Data |
---|---|---|
14bfc3f5 | 1 | // target.h -- target support for gold -*- C++ -*- |
bae7f79e | 2 | |
2c54b4f4 ILT |
3 | // Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
4 | // Free Software Foundation, Inc. | |
6cb15b7f ILT |
5 | // Written by Ian Lance Taylor <iant@google.com>. |
6 | ||
7 | // This file is part of gold. | |
8 | ||
9 | // This program is free software; you can redistribute it and/or modify | |
10 | // it under the terms of the GNU General Public License as published by | |
11 | // the Free Software Foundation; either version 3 of the License, or | |
12 | // (at your option) any later version. | |
13 | ||
14 | // This program is distributed in the hope that it will be useful, | |
15 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | // GNU General Public License for more details. | |
18 | ||
19 | // You should have received a copy of the GNU General Public License | |
20 | // along with this program; if not, write to the Free Software | |
21 | // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | |
22 | // MA 02110-1301, USA. | |
23 | ||
bae7f79e ILT |
24 | // The abstract class Target is the interface for target specific |
25 | // support. It defines abstract methods which each target must | |
26 | // implement. Typically there will be one target per processor, but | |
27 | // in some cases it may be necessary to have subclasses. | |
28 | ||
29 | // For speed and consistency we want to use inline functions to handle | |
30 | // relocation processing. So besides implementations of the abstract | |
31 | // methods, each target is expected to define a template | |
32 | // specialization of the relocation functions. | |
33 | ||
34 | #ifndef GOLD_TARGET_H | |
35 | #define GOLD_TARGET_H | |
36 | ||
14bfc3f5 | 37 | #include "elfcpp.h" |
8851ecca | 38 | #include "options.h" |
cd72c291 | 39 | #include "parameters.h" |
20e6d0d6 | 40 | #include "debug.h" |
14bfc3f5 | 41 | |
bae7f79e ILT |
42 | namespace gold |
43 | { | |
44 | ||
14bfc3f5 | 45 | class Object; |
364c7fa5 | 46 | class Relobj; |
61ba1cf9 | 47 | template<int size, bool big_endian> |
f6ce93d6 | 48 | class Sized_relobj; |
6fa2a40b CC |
49 | template<int size, bool big_endian> |
50 | class Sized_relobj_file; | |
6a74a719 | 51 | class Relocatable_relocs; |
92e059d8 | 52 | template<int size, bool big_endian> |
2c54b4f4 | 53 | struct Relocate_info; |
364c7fa5 | 54 | class Reloc_symbol_changes; |
f6ce93d6 ILT |
55 | class Symbol; |
56 | template<int size> | |
57 | class Sized_symbol; | |
58 | class Symbol_table; | |
7223e9ca | 59 | class Output_data; |
dd74ae06 | 60 | class Output_data_got_base; |
730cdc88 | 61 | class Output_section; |
d5b40221 | 62 | class Input_objects; |
f625ae50 | 63 | class Task; |
dc3714f3 | 64 | struct Symbol_location; |
14bfc3f5 ILT |
65 | |
66 | // The abstract class for target specific handling. | |
67 | ||
bae7f79e ILT |
68 | class Target |
69 | { | |
70 | public: | |
14bfc3f5 ILT |
71 | virtual ~Target() |
72 | { } | |
73 | ||
74 | // Return the bit size that this target implements. This should | |
75 | // return 32 or 64. | |
76 | int | |
77 | get_size() const | |
75f65a3e | 78 | { return this->pti_->size; } |
14bfc3f5 ILT |
79 | |
80 | // Return whether this target is big-endian. | |
81 | bool | |
82 | is_big_endian() const | |
75f65a3e | 83 | { return this->pti_->is_big_endian; } |
14bfc3f5 | 84 | |
61ba1cf9 ILT |
85 | // Machine code to store in e_machine field of ELF header. |
86 | elfcpp::EM | |
87 | machine_code() const | |
88 | { return this->pti_->machine_code; } | |
89 | ||
d5b40221 DK |
90 | // Processor specific flags to store in e_flags field of ELF header. |
91 | elfcpp::Elf_Word | |
92 | processor_specific_flags() const | |
93 | { return this->processor_specific_flags_; } | |
94 | ||
95 | // Whether processor specific flags are set at least once. | |
96 | bool | |
97 | are_processor_specific_flags_set() const | |
98 | { return this->are_processor_specific_flags_set_; } | |
99 | ||
14bfc3f5 ILT |
100 | // Whether this target has a specific make_symbol function. |
101 | bool | |
102 | has_make_symbol() const | |
75f65a3e | 103 | { return this->pti_->has_make_symbol; } |
14bfc3f5 ILT |
104 | |
105 | // Whether this target has a specific resolve function. | |
106 | bool | |
107 | has_resolve() const | |
75f65a3e ILT |
108 | { return this->pti_->has_resolve; } |
109 | ||
c51e6221 ILT |
110 | // Whether this target has a specific code fill function. |
111 | bool | |
112 | has_code_fill() const | |
113 | { return this->pti_->has_code_fill; } | |
114 | ||
dbe717ef ILT |
115 | // Return the default name of the dynamic linker. |
116 | const char* | |
117 | dynamic_linker() const | |
118 | { return this->pti_->dynamic_linker; } | |
119 | ||
75f65a3e ILT |
120 | // Return the default address to use for the text segment. |
121 | uint64_t | |
0c5e9c22 ILT |
122 | default_text_segment_address() const |
123 | { return this->pti_->default_text_segment_address; } | |
75f65a3e ILT |
124 | |
125 | // Return the ABI specified page size. | |
126 | uint64_t | |
127 | abi_pagesize() const | |
cd72c291 | 128 | { |
8851ecca ILT |
129 | if (parameters->options().max_page_size() > 0) |
130 | return parameters->options().max_page_size(); | |
cd72c291 ILT |
131 | else |
132 | return this->pti_->abi_pagesize; | |
133 | } | |
75f65a3e ILT |
134 | |
135 | // Return the common page size used on actual systems. | |
136 | uint64_t | |
137 | common_pagesize() const | |
cd72c291 | 138 | { |
8851ecca ILT |
139 | if (parameters->options().common_page_size() > 0) |
140 | return std::min(parameters->options().common_page_size(), | |
cd72c291 ILT |
141 | this->abi_pagesize()); |
142 | else | |
143 | return std::min(this->pti_->common_pagesize, | |
144 | this->abi_pagesize()); | |
145 | } | |
14bfc3f5 | 146 | |
2e702c99 RM |
147 | // Return whether PF_X segments must contain nothing but the contents of |
148 | // SHF_EXECINSTR sections (no non-executable data, no headers). | |
149 | bool | |
150 | isolate_execinstr() const | |
151 | { return this->pti_->isolate_execinstr; } | |
152 | ||
153 | uint64_t | |
154 | rosegment_gap() const | |
155 | { return this->pti_->rosegment_gap; } | |
156 | ||
35cdfc9a ILT |
157 | // If we see some object files with .note.GNU-stack sections, and |
158 | // some objects files without them, this returns whether we should | |
159 | // consider the object files without them to imply that the stack | |
160 | // should be executable. | |
161 | bool | |
162 | is_default_stack_executable() const | |
163 | { return this->pti_->is_default_stack_executable; } | |
164 | ||
0864d551 ILT |
165 | // Return a character which may appear as a prefix for a wrap |
166 | // symbol. If this character appears, we strip it when checking for | |
167 | // wrapping and add it back when forming the final symbol name. | |
168 | // This should be '\0' if not special prefix is required, which is | |
169 | // the normal case. | |
170 | char | |
171 | wrap_char() const | |
172 | { return this->pti_->wrap_char; } | |
173 | ||
8a5e3e08 ILT |
174 | // Return the special section index which indicates a small common |
175 | // symbol. This will return SHN_UNDEF if there are no small common | |
176 | // symbols. | |
177 | elfcpp::Elf_Half | |
178 | small_common_shndx() const | |
179 | { return this->pti_->small_common_shndx; } | |
180 | ||
181 | // Return values to add to the section flags for the section holding | |
182 | // small common symbols. | |
183 | elfcpp::Elf_Xword | |
184 | small_common_section_flags() const | |
185 | { | |
186 | gold_assert(this->pti_->small_common_shndx != elfcpp::SHN_UNDEF); | |
187 | return this->pti_->small_common_section_flags; | |
188 | } | |
189 | ||
190 | // Return the special section index which indicates a large common | |
191 | // symbol. This will return SHN_UNDEF if there are no large common | |
192 | // symbols. | |
193 | elfcpp::Elf_Half | |
194 | large_common_shndx() const | |
195 | { return this->pti_->large_common_shndx; } | |
196 | ||
197 | // Return values to add to the section flags for the section holding | |
198 | // large common symbols. | |
199 | elfcpp::Elf_Xword | |
200 | large_common_section_flags() const | |
201 | { | |
202 | gold_assert(this->pti_->large_common_shndx != elfcpp::SHN_UNDEF); | |
203 | return this->pti_->large_common_section_flags; | |
204 | } | |
205 | ||
206 | // This hook is called when an output section is created. | |
207 | void | |
208 | new_output_section(Output_section* os) const | |
209 | { this->do_new_output_section(os); } | |
210 | ||
5a6f7e2d ILT |
211 | // This is called to tell the target to complete any sections it is |
212 | // handling. After this all sections must have their final size. | |
213 | void | |
f59f41f3 DK |
214 | finalize_sections(Layout* layout, const Input_objects* input_objects, |
215 | Symbol_table* symtab) | |
216 | { return this->do_finalize_sections(layout, input_objects, symtab); } | |
5a6f7e2d | 217 | |
ab5c9e90 ILT |
218 | // Return the value to use for a global symbol which needs a special |
219 | // value in the dynamic symbol table. This will only be called if | |
220 | // the backend first calls symbol->set_needs_dynsym_value(). | |
221 | uint64_t | |
222 | dynsym_value(const Symbol* sym) const | |
223 | { return this->do_dynsym_value(sym); } | |
224 | ||
c51e6221 ILT |
225 | // Return a string to use to fill out a code section. This is |
226 | // basically one or more NOPS which must fill out the specified | |
227 | // length in bytes. | |
228 | std::string | |
8851ecca | 229 | code_fill(section_size_type length) const |
c51e6221 ILT |
230 | { return this->do_code_fill(length); } |
231 | ||
9a2d6984 ILT |
232 | // Return whether SYM is known to be defined by the ABI. This is |
233 | // used to avoid inappropriate warnings about undefined symbols. | |
234 | bool | |
9c2d0ef9 | 235 | is_defined_by_abi(const Symbol* sym) const |
9a2d6984 ILT |
236 | { return this->do_is_defined_by_abi(sym); } |
237 | ||
36959681 ILT |
238 | // Adjust the output file header before it is written out. VIEW |
239 | // points to the header in external form. LEN is the length. | |
240 | void | |
241 | adjust_elf_header(unsigned char* view, int len) const | |
242 | { return this->do_adjust_elf_header(view, len); } | |
243 | ||
9d5781f8 AM |
244 | // Return address and size to plug into eh_frame FDEs associated with a PLT. |
245 | void | |
246 | plt_fde_location(const Output_data* plt, unsigned char* oview, | |
247 | uint64_t* address, off_t* len) const | |
248 | { return this->do_plt_fde_location(plt, oview, address, len); } | |
249 | ||
bb04269c DK |
250 | // Return whether NAME is a local label name. This is used to implement the |
251 | // --discard-locals options. | |
252 | bool | |
253 | is_local_label_name(const char* name) const | |
254 | { return this->do_is_local_label_name(name); } | |
255 | ||
e291e7b9 ILT |
256 | // Get the symbol index to use for a target specific reloc. |
257 | unsigned int | |
258 | reloc_symbol_index(void* arg, unsigned int type) const | |
259 | { return this->do_reloc_symbol_index(arg, type); } | |
260 | ||
261 | // Get the addend to use for a target specific reloc. | |
262 | uint64_t | |
263 | reloc_addend(void* arg, unsigned int type, uint64_t addend) const | |
264 | { return this->do_reloc_addend(arg, type, addend); } | |
265 | ||
19fec8c1 | 266 | // Return the PLT address to use for a global symbol. |
67181c72 ILT |
267 | uint64_t |
268 | plt_address_for_global(const Symbol* sym) const | |
269 | { return this->do_plt_address_for_global(sym); } | |
270 | ||
19fec8c1 | 271 | // Return the PLT address to use for a local symbol. |
67181c72 ILT |
272 | uint64_t |
273 | plt_address_for_local(const Relobj* object, unsigned int symndx) const | |
274 | { return this->do_plt_address_for_local(object, symndx); } | |
7223e9ca | 275 | |
bd73a62d AM |
276 | // Return the offset to use for the GOT_INDX'th got entry which is |
277 | // for a local tls symbol specified by OBJECT, SYMNDX. | |
278 | int64_t | |
279 | tls_offset_for_local(const Relobj* object, | |
280 | unsigned int symndx, | |
281 | unsigned int got_indx) const | |
282 | { return do_tls_offset_for_local(object, symndx, got_indx); } | |
283 | ||
284 | // Return the offset to use for the GOT_INDX'th got entry which is | |
285 | // for global tls symbol GSYM. | |
286 | int64_t | |
287 | tls_offset_for_global(Symbol* gsym, unsigned int got_indx) const | |
288 | { return do_tls_offset_for_global(gsym, got_indx); } | |
289 | ||
dc3714f3 AM |
290 | // For targets that use function descriptors, if LOC is the location |
291 | // of a function, modify it to point at the function entry location. | |
292 | void | |
293 | function_location(Symbol_location* loc) const | |
294 | { return do_function_location(loc); } | |
295 | ||
b3ce541e ILT |
296 | // Return whether this target can use relocation types to determine |
297 | // if a function's address is taken. | |
298 | bool | |
299 | can_check_for_function_pointers() const | |
300 | { return this->do_can_check_for_function_pointers(); } | |
301 | ||
302 | // Return whether a relocation to a merged section can be processed | |
303 | // to retrieve the contents. | |
304 | bool | |
305 | can_icf_inline_merge_sections () const | |
306 | { return this->pti_->can_icf_inline_merge_sections; } | |
307 | ||
308 | // Whether a section called SECTION_NAME may have function pointers to | |
309 | // sections not eligible for safe ICF folding. | |
310 | virtual bool | |
311 | section_may_have_icf_unsafe_pointers(const char* section_name) const | |
312 | { return this->do_section_may_have_icf_unsafe_pointers(section_name); } | |
313 | ||
02d7cd44 ILT |
314 | // Return the base to use for the PC value in an FDE when it is |
315 | // encoded using DW_EH_PE_datarel. This does not appear to be | |
316 | // documented anywhere, but it is target specific. Any use of | |
317 | // DW_EH_PE_datarel in gcc requires defining a special macro | |
318 | // (ASM_MAYBE_OUTPUT_ENCODED_ADDR_RTX) to output the value. | |
319 | uint64_t | |
320 | ehframe_datarel_base() const | |
321 | { return this->do_ehframe_datarel_base(); } | |
322 | ||
b6848d3c ILT |
323 | // Return true if a reference to SYM from a reloc of type R_TYPE |
324 | // means that the current function may call an object compiled | |
325 | // without -fsplit-stack. SYM is known to be defined in an object | |
326 | // compiled without -fsplit-stack. | |
327 | bool | |
328 | is_call_to_non_split(const Symbol* sym, unsigned int r_type) const | |
329 | { return this->do_is_call_to_non_split(sym, r_type); } | |
330 | ||
364c7fa5 ILT |
331 | // A function starts at OFFSET in section SHNDX in OBJECT. That |
332 | // function was compiled with -fsplit-stack, but it refers to a | |
333 | // function which was compiled without -fsplit-stack. VIEW is a | |
334 | // modifiable view of the section; VIEW_SIZE is the size of the | |
335 | // view. The target has to adjust the function so that it allocates | |
336 | // enough stack. | |
337 | void | |
338 | calls_non_split(Relobj* object, unsigned int shndx, | |
339 | section_offset_type fnoffset, section_size_type fnsize, | |
340 | unsigned char* view, section_size_type view_size, | |
341 | std::string* from, std::string* to) const | |
342 | { | |
343 | this->do_calls_non_split(object, shndx, fnoffset, fnsize, view, view_size, | |
344 | from, to); | |
345 | } | |
346 | ||
f733487b DK |
347 | // Make an ELF object. |
348 | template<int size, bool big_endian> | |
349 | Object* | |
350 | make_elf_object(const std::string& name, Input_file* input_file, | |
351 | off_t offset, const elfcpp::Ehdr<size, big_endian>& ehdr) | |
352 | { return this->do_make_elf_object(name, input_file, offset, ehdr); } | |
353 | ||
c0a62865 DK |
354 | // Make an output section. |
355 | Output_section* | |
356 | make_output_section(const char* name, elfcpp::Elf_Word type, | |
357 | elfcpp::Elf_Xword flags) | |
358 | { return this->do_make_output_section(name, type, flags); } | |
359 | ||
20e6d0d6 DK |
360 | // Return true if target wants to perform relaxation. |
361 | bool | |
362 | may_relax() const | |
363 | { | |
364 | // Run the dummy relaxation pass twice if relaxation debugging is enabled. | |
365 | if (is_debugging_enabled(DEBUG_RELAXATION)) | |
366 | return true; | |
367 | ||
368 | return this->do_may_relax(); | |
369 | } | |
370 | ||
371 | // Perform a relaxation pass. Return true if layout may be changed. | |
372 | bool | |
c0a62865 | 373 | relax(int pass, const Input_objects* input_objects, Symbol_table* symtab, |
f625ae50 | 374 | Layout* layout, const Task* task) |
20e6d0d6 DK |
375 | { |
376 | // Run the dummy relaxation pass twice if relaxation debugging is enabled. | |
377 | if (is_debugging_enabled(DEBUG_RELAXATION)) | |
378 | return pass < 2; | |
379 | ||
f625ae50 | 380 | return this->do_relax(pass, input_objects, symtab, layout, task); |
2e702c99 | 381 | } |
20e6d0d6 | 382 | |
05a352e6 DK |
383 | // Return the target-specific name of attributes section. This is |
384 | // NULL if a target does not use attributes section or if it uses | |
385 | // the default section name ".gnu.attributes". | |
386 | const char* | |
387 | attributes_section() const | |
388 | { return this->pti_->attributes_section; } | |
389 | ||
390 | // Return the vendor name of vendor attributes. | |
391 | const char* | |
392 | attributes_vendor() const | |
393 | { return this->pti_->attributes_vendor; } | |
394 | ||
395 | // Whether a section called NAME is an attribute section. | |
396 | bool | |
397 | is_attributes_section(const char* name) const | |
398 | { | |
399 | return ((this->pti_->attributes_section != NULL | |
400 | && strcmp(name, this->pti_->attributes_section) == 0) | |
2e702c99 | 401 | || strcmp(name, ".gnu.attributes") == 0); |
05a352e6 DK |
402 | } |
403 | ||
404 | // Return a bit mask of argument types for attribute with TAG. | |
405 | int | |
406 | attribute_arg_type(int tag) const | |
407 | { return this->do_attribute_arg_type(tag); } | |
408 | ||
409 | // Return the attribute tag of the position NUM in the list of fixed | |
410 | // attributes. Normally there is no reordering and | |
411 | // attributes_order(NUM) == NUM. | |
412 | int | |
413 | attributes_order(int num) const | |
414 | { return this->do_attributes_order(num); } | |
415 | ||
0d31c79d DK |
416 | // When a target is selected as the default target, we call this method, |
417 | // which may be used for expensive, target-specific initialization. | |
418 | void | |
419 | select_as_default_target() | |
2e702c99 | 420 | { this->do_select_as_default_target(); } |
0d31c79d | 421 | |
200b2bb9 ILT |
422 | // Return the value to store in the EI_OSABI field in the ELF |
423 | // header. | |
424 | elfcpp::ELFOSABI | |
425 | osabi() const | |
426 | { return this->osabi_; } | |
427 | ||
428 | // Set the value to store in the EI_OSABI field in the ELF header. | |
429 | void | |
430 | set_osabi(elfcpp::ELFOSABI osabi) | |
431 | { this->osabi_ = osabi; } | |
432 | ||
647f1574 DK |
433 | // Define target-specific standard symbols. |
434 | void | |
435 | define_standard_symbols(Symbol_table* symtab, Layout* layout) | |
436 | { this->do_define_standard_symbols(symtab, layout); } | |
437 | ||
921b5322 AM |
438 | // Return the output section name to use given an input section |
439 | // name, or NULL if no target specific name mapping is required. | |
440 | // Set *PLEN to the length of the name if returning non-NULL. | |
441 | const char* | |
442 | output_section_name(const Relobj* relobj, | |
443 | const char* name, | |
444 | size_t* plen) const | |
445 | { return this->do_output_section_name(relobj, name, plen); } | |
446 | ||
e81fea4d AM |
447 | // Add any special sections for this symbol to the gc work list. |
448 | void | |
449 | gc_mark_symbol(Symbol_table* symtab, Symbol* sym) const | |
450 | { this->do_gc_mark_symbol(symtab, sym); } | |
451 | ||
14bfc3f5 | 452 | protected: |
75f65a3e ILT |
453 | // This struct holds the constant information for a child class. We |
454 | // use a struct to avoid the overhead of virtual function calls for | |
455 | // simple information. | |
456 | struct Target_info | |
457 | { | |
458 | // Address size (32 or 64). | |
459 | int size; | |
460 | // Whether the target is big endian. | |
461 | bool is_big_endian; | |
61ba1cf9 ILT |
462 | // The code to store in the e_machine field of the ELF header. |
463 | elfcpp::EM machine_code; | |
75f65a3e ILT |
464 | // Whether this target has a specific make_symbol function. |
465 | bool has_make_symbol; | |
466 | // Whether this target has a specific resolve function. | |
467 | bool has_resolve; | |
c51e6221 ILT |
468 | // Whether this target has a specific code fill function. |
469 | bool has_code_fill; | |
35cdfc9a ILT |
470 | // Whether an object file with no .note.GNU-stack sections implies |
471 | // that the stack should be executable. | |
472 | bool is_default_stack_executable; | |
b3ce541e ILT |
473 | // Whether a relocation to a merged section can be processed to |
474 | // retrieve the contents. | |
475 | bool can_icf_inline_merge_sections; | |
0864d551 ILT |
476 | // Prefix character to strip when checking for wrapping. |
477 | char wrap_char; | |
dbe717ef ILT |
478 | // The default dynamic linker name. |
479 | const char* dynamic_linker; | |
75f65a3e | 480 | // The default text segment address. |
0c5e9c22 | 481 | uint64_t default_text_segment_address; |
75f65a3e ILT |
482 | // The ABI specified page size. |
483 | uint64_t abi_pagesize; | |
484 | // The common page size used by actual implementations. | |
485 | uint64_t common_pagesize; | |
2e702c99 RM |
486 | // Whether PF_X segments must contain nothing but the contents of |
487 | // SHF_EXECINSTR sections (no non-executable data, no headers). | |
488 | bool isolate_execinstr; | |
489 | // If nonzero, distance from the text segment to the read-only segment. | |
490 | uint64_t rosegment_gap; | |
8a5e3e08 ILT |
491 | // The special section index for small common symbols; SHN_UNDEF |
492 | // if none. | |
493 | elfcpp::Elf_Half small_common_shndx; | |
494 | // The special section index for large common symbols; SHN_UNDEF | |
495 | // if none. | |
496 | elfcpp::Elf_Half large_common_shndx; | |
497 | // Section flags for small common section. | |
498 | elfcpp::Elf_Xword small_common_section_flags; | |
499 | // Section flags for large common section. | |
500 | elfcpp::Elf_Xword large_common_section_flags; | |
05a352e6 DK |
501 | // Name of attributes section if it is not ".gnu.attributes". |
502 | const char* attributes_section; | |
503 | // Vendor name of vendor attributes. | |
504 | const char* attributes_vendor; | |
75f65a3e ILT |
505 | }; |
506 | ||
507 | Target(const Target_info* pti) | |
d5b40221 | 508 | : pti_(pti), processor_specific_flags_(0), |
200b2bb9 | 509 | are_processor_specific_flags_set_(false), osabi_(elfcpp::ELFOSABI_NONE) |
14bfc3f5 ILT |
510 | { } |
511 | ||
8a5e3e08 ILT |
512 | // Virtual function which may be implemented by the child class. |
513 | virtual void | |
514 | do_new_output_section(Output_section*) const | |
515 | { } | |
516 | ||
5a6f7e2d ILT |
517 | // Virtual function which may be implemented by the child class. |
518 | virtual void | |
f59f41f3 | 519 | do_finalize_sections(Layout*, const Input_objects*, Symbol_table*) |
5a6f7e2d ILT |
520 | { } |
521 | ||
ab5c9e90 ILT |
522 | // Virtual function which may be implemented by the child class. |
523 | virtual uint64_t | |
524 | do_dynsym_value(const Symbol*) const | |
525 | { gold_unreachable(); } | |
526 | ||
c51e6221 ILT |
527 | // Virtual function which must be implemented by the child class if |
528 | // needed. | |
529 | virtual std::string | |
8851ecca | 530 | do_code_fill(section_size_type) const |
c51e6221 ILT |
531 | { gold_unreachable(); } |
532 | ||
9a2d6984 ILT |
533 | // Virtual function which may be implemented by the child class. |
534 | virtual bool | |
9c2d0ef9 | 535 | do_is_defined_by_abi(const Symbol*) const |
9a2d6984 ILT |
536 | { return false; } |
537 | ||
36959681 ILT |
538 | // Adjust the output file header before it is written out. VIEW |
539 | // points to the header in external form. LEN is the length, and | |
540 | // will be one of the values of elfcpp::Elf_sizes<size>::ehdr_size. | |
200b2bb9 ILT |
541 | // By default, we set the EI_OSABI field if requested (in |
542 | // Sized_target). | |
36959681 | 543 | virtual void |
200b2bb9 | 544 | do_adjust_elf_header(unsigned char*, int) const = 0; |
36959681 | 545 | |
9d5781f8 AM |
546 | // Return address and size to plug into eh_frame FDEs associated with a PLT. |
547 | virtual void | |
548 | do_plt_fde_location(const Output_data* plt, unsigned char* oview, | |
549 | uint64_t* address, off_t* len) const; | |
550 | ||
9b547ce6 | 551 | // Virtual function which may be overridden by the child class. |
bb04269c DK |
552 | virtual bool |
553 | do_is_local_label_name(const char*) const; | |
554 | ||
e291e7b9 ILT |
555 | // Virtual function that must be overridden by a target which uses |
556 | // target specific relocations. | |
557 | virtual unsigned int | |
558 | do_reloc_symbol_index(void*, unsigned int) const | |
559 | { gold_unreachable(); } | |
560 | ||
9b547ce6 | 561 | // Virtual function that must be overridden by a target which uses |
e291e7b9 ILT |
562 | // target specific relocations. |
563 | virtual uint64_t | |
564 | do_reloc_addend(void*, unsigned int, uint64_t) const | |
565 | { gold_unreachable(); } | |
566 | ||
7223e9ca ILT |
567 | // Virtual functions that must be overridden by a target that uses |
568 | // STT_GNU_IFUNC symbols. | |
67181c72 ILT |
569 | virtual uint64_t |
570 | do_plt_address_for_global(const Symbol*) const | |
7223e9ca ILT |
571 | { gold_unreachable(); } |
572 | ||
67181c72 ILT |
573 | virtual uint64_t |
574 | do_plt_address_for_local(const Relobj*, unsigned int) const | |
7223e9ca ILT |
575 | { gold_unreachable(); } |
576 | ||
bd73a62d AM |
577 | virtual int64_t |
578 | do_tls_offset_for_local(const Relobj*, unsigned int, unsigned int) const | |
579 | { gold_unreachable(); } | |
580 | ||
581 | virtual int64_t | |
582 | do_tls_offset_for_global(Symbol*, unsigned int) const | |
583 | { gold_unreachable(); } | |
584 | ||
dc3714f3 AM |
585 | virtual void |
586 | do_function_location(Symbol_location*) const = 0; | |
587 | ||
b3ce541e ILT |
588 | // Virtual function which may be overriden by the child class. |
589 | virtual bool | |
590 | do_can_check_for_function_pointers() const | |
591 | { return false; } | |
592 | ||
593 | // Virtual function which may be overridden by the child class. We | |
594 | // recognize some default sections for which we don't care whether | |
595 | // they have function pointers. | |
596 | virtual bool | |
597 | do_section_may_have_icf_unsafe_pointers(const char* section_name) const | |
598 | { | |
599 | // We recognize sections for normal vtables, construction vtables and | |
600 | // EH frames. | |
601 | return (!is_prefix_of(".rodata._ZTV", section_name) | |
602 | && !is_prefix_of(".data.rel.ro._ZTV", section_name) | |
603 | && !is_prefix_of(".rodata._ZTC", section_name) | |
604 | && !is_prefix_of(".data.rel.ro._ZTC", section_name) | |
605 | && !is_prefix_of(".eh_frame", section_name)); | |
606 | } | |
607 | ||
02d7cd44 ILT |
608 | virtual uint64_t |
609 | do_ehframe_datarel_base() const | |
610 | { gold_unreachable(); } | |
611 | ||
b6848d3c ILT |
612 | // Virtual function which may be overridden by the child class. The |
613 | // default implementation is that any function not defined by the | |
614 | // ABI is a call to a non-split function. | |
615 | virtual bool | |
616 | do_is_call_to_non_split(const Symbol* sym, unsigned int) const; | |
617 | ||
364c7fa5 ILT |
618 | // Virtual function which may be overridden by the child class. |
619 | virtual void | |
620 | do_calls_non_split(Relobj* object, unsigned int, section_offset_type, | |
621 | section_size_type, unsigned char*, section_size_type, | |
622 | std::string*, std::string*) const; | |
623 | ||
f733487b | 624 | // make_elf_object hooks. There are four versions of these for |
7296d933 | 625 | // different address sizes and endianness. |
364c7fa5 | 626 | |
d5b40221 DK |
627 | // Set processor specific flags. |
628 | void | |
629 | set_processor_specific_flags(elfcpp::Elf_Word flags) | |
630 | { | |
631 | this->processor_specific_flags_ = flags; | |
632 | this->are_processor_specific_flags_set_ = true; | |
633 | } | |
2e702c99 | 634 | |
f733487b | 635 | #ifdef HAVE_TARGET_32_LITTLE |
9b547ce6 | 636 | // Virtual functions which may be overridden by the child class. |
f733487b DK |
637 | virtual Object* |
638 | do_make_elf_object(const std::string&, Input_file*, off_t, | |
639 | const elfcpp::Ehdr<32, false>&); | |
640 | #endif | |
641 | ||
642 | #ifdef HAVE_TARGET_32_BIG | |
9b547ce6 | 643 | // Virtual functions which may be overridden by the child class. |
f733487b DK |
644 | virtual Object* |
645 | do_make_elf_object(const std::string&, Input_file*, off_t, | |
646 | const elfcpp::Ehdr<32, true>&); | |
647 | #endif | |
648 | ||
649 | #ifdef HAVE_TARGET_64_LITTLE | |
9b547ce6 | 650 | // Virtual functions which may be overridden by the child class. |
f733487b DK |
651 | virtual Object* |
652 | do_make_elf_object(const std::string&, Input_file*, off_t, | |
653 | const elfcpp::Ehdr<64, false>& ehdr); | |
654 | #endif | |
655 | ||
656 | #ifdef HAVE_TARGET_64_BIG | |
9b547ce6 | 657 | // Virtual functions which may be overridden by the child class. |
f733487b DK |
658 | virtual Object* |
659 | do_make_elf_object(const std::string& name, Input_file* input_file, | |
660 | off_t offset, const elfcpp::Ehdr<64, true>& ehdr); | |
661 | #endif | |
662 | ||
9b547ce6 | 663 | // Virtual functions which may be overridden by the child class. |
c0a62865 DK |
664 | virtual Output_section* |
665 | do_make_output_section(const char* name, elfcpp::Elf_Word type, | |
666 | elfcpp::Elf_Xword flags); | |
667 | ||
9b547ce6 | 668 | // Virtual function which may be overridden by the child class. |
20e6d0d6 DK |
669 | virtual bool |
670 | do_may_relax() const | |
671 | { return parameters->options().relax(); } | |
672 | ||
9b547ce6 | 673 | // Virtual function which may be overridden by the child class. |
20e6d0d6 | 674 | virtual bool |
f625ae50 | 675 | do_relax(int, const Input_objects*, Symbol_table*, Layout*, const Task*) |
20e6d0d6 DK |
676 | { return false; } |
677 | ||
364c7fa5 ILT |
678 | // A function for targets to call. Return whether BYTES/LEN matches |
679 | // VIEW/VIEW_SIZE at OFFSET. | |
680 | bool | |
681 | match_view(const unsigned char* view, section_size_type view_size, | |
682 | section_offset_type offset, const char* bytes, size_t len) const; | |
683 | ||
684 | // Set the contents of a VIEW/VIEW_SIZE to nops starting at OFFSET | |
685 | // for LEN bytes. | |
686 | void | |
687 | set_view_to_nop(unsigned char* view, section_size_type view_size, | |
688 | section_offset_type offset, size_t len) const; | |
689 | ||
9b547ce6 | 690 | // This must be overridden by the child class if it has target-specific |
2e702c99 | 691 | // attributes subsection in the attribute section. |
05a352e6 DK |
692 | virtual int |
693 | do_attribute_arg_type(int) const | |
694 | { gold_unreachable(); } | |
695 | ||
696 | // This may be overridden by the child class. | |
697 | virtual int | |
698 | do_attributes_order(int num) const | |
699 | { return num; } | |
700 | ||
0d31c79d DK |
701 | // This may be overridden by the child class. |
702 | virtual void | |
703 | do_select_as_default_target() | |
704 | { } | |
705 | ||
647f1574 DK |
706 | // This may be overridden by the child class. |
707 | virtual void | |
708 | do_define_standard_symbols(Symbol_table*, Layout*) | |
709 | { } | |
710 | ||
921b5322 AM |
711 | // This may be overridden by the child class. |
712 | virtual const char* | |
713 | do_output_section_name(const Relobj*, const char*, size_t*) const | |
714 | { return NULL; } | |
715 | ||
e81fea4d AM |
716 | // This may be overridden by the child class. |
717 | virtual void | |
718 | do_gc_mark_symbol(Symbol_table*, Symbol*) const | |
719 | { } | |
720 | ||
14bfc3f5 | 721 | private: |
f733487b | 722 | // The implementations of the four do_make_elf_object virtual functions are |
7296d933 | 723 | // almost identical except for their sizes and endianness. We use a template. |
f733487b DK |
724 | // for their implementations. |
725 | template<int size, bool big_endian> | |
726 | inline Object* | |
727 | do_make_elf_object_implementation(const std::string&, Input_file*, off_t, | |
728 | const elfcpp::Ehdr<size, big_endian>&); | |
729 | ||
14bfc3f5 ILT |
730 | Target(const Target&); |
731 | Target& operator=(const Target&); | |
732 | ||
75f65a3e ILT |
733 | // The target information. |
734 | const Target_info* pti_; | |
d5b40221 DK |
735 | // Processor-specific flags. |
736 | elfcpp::Elf_Word processor_specific_flags_; | |
737 | // Whether the processor-specific flags are set at least once. | |
738 | bool are_processor_specific_flags_set_; | |
200b2bb9 ILT |
739 | // If not ELFOSABI_NONE, the value to put in the EI_OSABI field of |
740 | // the ELF header. This is handled at this level because it is | |
741 | // OS-specific rather than processor-specific. | |
742 | elfcpp::ELFOSABI osabi_; | |
bae7f79e ILT |
743 | }; |
744 | ||
14bfc3f5 ILT |
745 | // The abstract class for a specific size and endianness of target. |
746 | // Each actual target implementation class should derive from an | |
747 | // instantiation of Sized_target. | |
748 | ||
749 | template<int size, bool big_endian> | |
750 | class Sized_target : public Target | |
751 | { | |
752 | public: | |
753 | // Make a new symbol table entry for the target. This should be | |
754 | // overridden by a target which needs additional information in the | |
755 | // symbol table. This will only be called if has_make_symbol() | |
756 | // returns true. | |
757 | virtual Sized_symbol<size>* | |
14b31740 | 758 | make_symbol() const |
a3ad94ed | 759 | { gold_unreachable(); } |
14bfc3f5 ILT |
760 | |
761 | // Resolve a symbol for the target. This should be overridden by a | |
762 | // target which needs to take special action. TO is the | |
763 | // pre-existing symbol. SYM is the new symbol, seen in OBJECT. | |
14b31740 ILT |
764 | // VERSION is the version of SYM. This will only be called if |
765 | // has_resolve() returns true. | |
14bfc3f5 | 766 | virtual void |
14b31740 ILT |
767 | resolve(Symbol*, const elfcpp::Sym<size, big_endian>&, Object*, |
768 | const char*) | |
a3ad94ed | 769 | { gold_unreachable(); } |
14bfc3f5 | 770 | |
6d03d481 ST |
771 | // Process the relocs for a section, and record information of the |
772 | // mapping from source to destination sections. This mapping is later | |
773 | // used to determine unreferenced garbage sections. This procedure is | |
774 | // only called during garbage collection. | |
775 | virtual void | |
ad0f2072 ILT |
776 | gc_process_relocs(Symbol_table* symtab, |
777 | Layout* layout, | |
6fa2a40b | 778 | Sized_relobj_file<size, big_endian>* object, |
ad0f2072 ILT |
779 | unsigned int data_shndx, |
780 | unsigned int sh_type, | |
781 | const unsigned char* prelocs, | |
782 | size_t reloc_count, | |
783 | Output_section* output_section, | |
784 | bool needs_special_offset_handling, | |
785 | size_t local_symbol_count, | |
786 | const unsigned char* plocal_symbols) = 0; | |
6d03d481 | 787 | |
92e059d8 | 788 | // Scan the relocs for a section, and record any information |
ad0f2072 ILT |
789 | // required for the symbol. SYMTAB is the symbol table. OBJECT is |
790 | // the object in which the section appears. DATA_SHNDX is the | |
791 | // section index that these relocs apply to. SH_TYPE is the type of | |
792 | // the relocation section, SHT_REL or SHT_RELA. PRELOCS points to | |
793 | // the relocation data. RELOC_COUNT is the number of relocs. | |
794 | // LOCAL_SYMBOL_COUNT is the number of local symbols. | |
795 | // OUTPUT_SECTION is the output section. | |
730cdc88 ILT |
796 | // NEEDS_SPECIAL_OFFSET_HANDLING is true if offsets to the output |
797 | // sections are not mapped as usual. PLOCAL_SYMBOLS points to the | |
798 | // local symbol data from OBJECT. GLOBAL_SYMBOLS is the array of | |
799 | // pointers to the global symbol table from OBJECT. | |
61ba1cf9 | 800 | virtual void |
ad0f2072 | 801 | scan_relocs(Symbol_table* symtab, |
ead1e424 | 802 | Layout* layout, |
6fa2a40b | 803 | Sized_relobj_file<size, big_endian>* object, |
a3ad94ed | 804 | unsigned int data_shndx, |
92e059d8 ILT |
805 | unsigned int sh_type, |
806 | const unsigned char* prelocs, | |
807 | size_t reloc_count, | |
730cdc88 ILT |
808 | Output_section* output_section, |
809 | bool needs_special_offset_handling, | |
92e059d8 | 810 | size_t local_symbol_count, |
730cdc88 | 811 | const unsigned char* plocal_symbols) = 0; |
92e059d8 ILT |
812 | |
813 | // Relocate section data. SH_TYPE is the type of the relocation | |
814 | // section, SHT_REL or SHT_RELA. PRELOCS points to the relocation | |
730cdc88 ILT |
815 | // information. RELOC_COUNT is the number of relocs. |
816 | // OUTPUT_SECTION is the output section. | |
817 | // NEEDS_SPECIAL_OFFSET_HANDLING is true if offsets must be mapped | |
818 | // to correspond to the output section. VIEW is a view into the | |
819 | // output file holding the section contents, VIEW_ADDRESS is the | |
820 | // virtual address of the view, and VIEW_SIZE is the size of the | |
821 | // view. If NEEDS_SPECIAL_OFFSET_HANDLING is true, the VIEW_xx | |
822 | // parameters refer to the complete output section data, not just | |
823 | // the input section data. | |
92e059d8 ILT |
824 | virtual void |
825 | relocate_section(const Relocate_info<size, big_endian>*, | |
826 | unsigned int sh_type, | |
827 | const unsigned char* prelocs, | |
828 | size_t reloc_count, | |
730cdc88 ILT |
829 | Output_section* output_section, |
830 | bool needs_special_offset_handling, | |
92e059d8 ILT |
831 | unsigned char* view, |
832 | typename elfcpp::Elf_types<size>::Elf_Addr view_address, | |
364c7fa5 ILT |
833 | section_size_type view_size, |
834 | const Reloc_symbol_changes*) = 0; | |
61ba1cf9 | 835 | |
6a74a719 ILT |
836 | // Scan the relocs during a relocatable link. The parameters are |
837 | // like scan_relocs, with an additional Relocatable_relocs | |
838 | // parameter, used to record the disposition of the relocs. | |
839 | virtual void | |
ad0f2072 | 840 | scan_relocatable_relocs(Symbol_table* symtab, |
6a74a719 | 841 | Layout* layout, |
6fa2a40b | 842 | Sized_relobj_file<size, big_endian>* object, |
6a74a719 ILT |
843 | unsigned int data_shndx, |
844 | unsigned int sh_type, | |
845 | const unsigned char* prelocs, | |
846 | size_t reloc_count, | |
847 | Output_section* output_section, | |
848 | bool needs_special_offset_handling, | |
849 | size_t local_symbol_count, | |
850 | const unsigned char* plocal_symbols, | |
851 | Relocatable_relocs*) = 0; | |
852 | ||
7404fe1b AM |
853 | // Emit relocations for a section during a relocatable link, and for |
854 | // --emit-relocs. The parameters are like relocate_section, with | |
855 | // additional parameters for the view of the output reloc section. | |
6a74a719 | 856 | virtual void |
7404fe1b AM |
857 | relocate_relocs(const Relocate_info<size, big_endian>*, |
858 | unsigned int sh_type, | |
859 | const unsigned char* prelocs, | |
860 | size_t reloc_count, | |
861 | Output_section* output_section, | |
62fe925a RM |
862 | typename elfcpp::Elf_types<size>::Elf_Off |
863 | offset_in_output_section, | |
7404fe1b AM |
864 | const Relocatable_relocs*, |
865 | unsigned char* view, | |
866 | typename elfcpp::Elf_types<size>::Elf_Addr view_address, | |
867 | section_size_type view_size, | |
868 | unsigned char* reloc_view, | |
869 | section_size_type reloc_view_size) = 0; | |
2e702c99 | 870 | |
5c388529 DK |
871 | // Perform target-specific processing in a relocatable link. This is |
872 | // only used if we use the relocation strategy RELOC_SPECIAL. | |
873 | // RELINFO points to a Relocation_info structure. SH_TYPE is the relocation | |
874 | // section type. PRELOC_IN points to the original relocation. RELNUM is | |
875 | // the index number of the relocation in the relocation section. | |
876 | // OUTPUT_SECTION is the output section to which the relocation is applied. | |
877 | // OFFSET_IN_OUTPUT_SECTION is the offset of the relocation input section | |
878 | // within the output section. VIEW points to the output view of the | |
879 | // output section. VIEW_ADDRESS is output address of the view. VIEW_SIZE | |
880 | // is the size of the output view and PRELOC_OUT points to the new | |
881 | // relocation in the output object. | |
882 | // | |
883 | // A target only needs to override this if the generic code in | |
884 | // target-reloc.h cannot handle some relocation types. | |
6a74a719 | 885 | |
5c388529 DK |
886 | virtual void |
887 | relocate_special_relocatable(const Relocate_info<size, big_endian>* | |
888 | /*relinfo */, | |
889 | unsigned int /* sh_type */, | |
890 | const unsigned char* /* preloc_in */, | |
891 | size_t /* relnum */, | |
892 | Output_section* /* output_section */, | |
62fe925a RM |
893 | typename elfcpp::Elf_types<size>::Elf_Off |
894 | /* offset_in_output_section */, | |
5c388529 DK |
895 | unsigned char* /* view */, |
896 | typename elfcpp::Elf_types<size>::Elf_Addr | |
897 | /* view_address */, | |
898 | section_size_type /* view_size */, | |
899 | unsigned char* /* preloc_out*/) | |
900 | { gold_unreachable(); } | |
2e702c99 | 901 | |
0e70b911 CC |
902 | // Return the number of entries in the GOT. This is only used for |
903 | // laying out the incremental link info sections. A target needs | |
904 | // to implement this to support incremental linking. | |
905 | ||
906 | virtual unsigned int | |
907 | got_entry_count() const | |
908 | { gold_unreachable(); } | |
909 | ||
910 | // Return the number of entries in the PLT. This is only used for | |
911 | // laying out the incremental link info sections. A target needs | |
912 | // to implement this to support incremental linking. | |
913 | ||
914 | virtual unsigned int | |
915 | plt_entry_count() const | |
916 | { gold_unreachable(); } | |
917 | ||
918 | // Return the offset of the first non-reserved PLT entry. This is | |
919 | // only used for laying out the incremental link info sections. | |
920 | // A target needs to implement this to support incremental linking. | |
921 | ||
922 | virtual unsigned int | |
923 | first_plt_entry_offset() const | |
924 | { gold_unreachable(); } | |
925 | ||
926 | // Return the size of each PLT entry. This is only used for | |
927 | // laying out the incremental link info sections. A target needs | |
928 | // to implement this to support incremental linking. | |
929 | ||
930 | virtual unsigned int | |
931 | plt_entry_size() const | |
932 | { gold_unreachable(); } | |
933 | ||
4829d394 CC |
934 | // Create the GOT and PLT sections for an incremental update. |
935 | // A target needs to implement this to support incremental linking. | |
936 | ||
dd74ae06 | 937 | virtual Output_data_got_base* |
4829d394 CC |
938 | init_got_plt_for_update(Symbol_table*, |
939 | Layout*, | |
940 | unsigned int /* got_count */, | |
941 | unsigned int /* plt_count */) | |
942 | { gold_unreachable(); } | |
943 | ||
6fa2a40b CC |
944 | // Reserve a GOT entry for a local symbol, and regenerate any |
945 | // necessary dynamic relocations. | |
946 | virtual void | |
947 | reserve_local_got_entry(unsigned int /* got_index */, | |
948 | Sized_relobj<size, big_endian>* /* obj */, | |
949 | unsigned int /* r_sym */, | |
950 | unsigned int /* got_type */) | |
951 | { gold_unreachable(); } | |
952 | ||
953 | // Reserve a GOT entry for a global symbol, and regenerate any | |
954 | // necessary dynamic relocations. | |
955 | virtual void | |
956 | reserve_global_got_entry(unsigned int /* got_index */, Symbol* /* gsym */, | |
957 | unsigned int /* got_type */) | |
958 | { gold_unreachable(); } | |
959 | ||
4829d394 CC |
960 | // Register an existing PLT entry for a global symbol. |
961 | // A target needs to implement this to support incremental linking. | |
962 | ||
963 | virtual void | |
67181c72 ILT |
964 | register_global_plt_entry(Symbol_table*, Layout*, |
965 | unsigned int /* plt_index */, | |
4829d394 CC |
966 | Symbol*) |
967 | { gold_unreachable(); } | |
968 | ||
26d3c67d CC |
969 | // Force a COPY relocation for a given symbol. |
970 | // A target needs to implement this to support incremental linking. | |
971 | ||
972 | virtual void | |
973 | emit_copy_reloc(Symbol_table*, Symbol*, Output_section*, off_t) | |
974 | { gold_unreachable(); } | |
975 | ||
94a3fc8b CC |
976 | // Apply an incremental relocation. |
977 | ||
978 | virtual void | |
979 | apply_relocation(const Relocate_info<size, big_endian>* /* relinfo */, | |
980 | typename elfcpp::Elf_types<size>::Elf_Addr /* r_offset */, | |
981 | unsigned int /* r_type */, | |
982 | typename elfcpp::Elf_types<size>::Elf_Swxword /* r_addend */, | |
983 | const Symbol* /* gsym */, | |
984 | unsigned char* /* view */, | |
985 | typename elfcpp::Elf_types<size>::Elf_Addr /* address */, | |
986 | section_size_type /* view_size */) | |
987 | { gold_unreachable(); } | |
988 | ||
e81fea4d AM |
989 | // Handle target specific gc actions when adding a gc reference from |
990 | // SRC_OBJ, SRC_SHNDX to a location specified by DST_OBJ, DST_SHNDX | |
991 | // and DST_OFF. | |
992 | void | |
993 | gc_add_reference(Symbol_table* symtab, | |
994 | Object* src_obj, | |
995 | unsigned int src_shndx, | |
996 | Object* dst_obj, | |
997 | unsigned int dst_shndx, | |
998 | typename elfcpp::Elf_types<size>::Elf_Addr dst_off) const | |
999 | { | |
1000 | this->do_gc_add_reference(symtab, src_obj, src_shndx, | |
1001 | dst_obj, dst_shndx, dst_off); | |
1002 | } | |
1003 | ||
14bfc3f5 | 1004 | protected: |
75f65a3e ILT |
1005 | Sized_target(const Target::Target_info* pti) |
1006 | : Target(pti) | |
1007 | { | |
a3ad94ed ILT |
1008 | gold_assert(pti->size == size); |
1009 | gold_assert(pti->is_big_endian ? big_endian : !big_endian); | |
75f65a3e | 1010 | } |
200b2bb9 ILT |
1011 | |
1012 | // Set the EI_OSABI field if requested. | |
1013 | virtual void | |
1014 | do_adjust_elf_header(unsigned char*, int) const; | |
e81fea4d AM |
1015 | |
1016 | // Handle target specific gc actions when adding a gc reference. | |
1017 | virtual void | |
1018 | do_gc_add_reference(Symbol_table*, Object*, unsigned int, | |
1019 | Object*, unsigned int, | |
1020 | typename elfcpp::Elf_types<size>::Elf_Addr) const | |
1021 | { } | |
dc3714f3 AM |
1022 | |
1023 | virtual void | |
1024 | do_function_location(Symbol_location*) const | |
1025 | { } | |
14bfc3f5 | 1026 | }; |
bae7f79e ILT |
1027 | |
1028 | } // End namespace gold. | |
1029 | ||
1030 | #endif // !defined(GOLD_TARGET_H) |