1 // target.h -- target support for gold -*- C++ -*-
3 // Copyright 2006, 2007, 2008, 2009, 2010 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 // The abstract class Target is the interface for target specific
24 // support. It defines abstract methods which each target must
25 // implement. Typically there will be one target per processor, but
26 // in some cases it may be necessary to have subclasses.
28 // For speed and consistency we want to use inline functions to handle
29 // relocation processing. So besides implementations of the abstract
30 // methods, each target is expected to define a template
31 // specialization of the relocation functions.
38 #include "parameters.h"
46 template<int size
, bool big_endian
>
48 template<int size
, bool big_endian
>
49 class Sized_relobj_file
;
50 class Relocatable_relocs
;
51 template<int size
, bool big_endian
>
53 class Reloc_symbol_changes
;
59 template<int size
, bool big_endian
>
60 class Output_data_got
;
65 // The abstract class for target specific handling.
73 // Virtual function which is set to return true by a target if
74 // it can use relocation types to determine if a function's
77 can_check_for_function_pointers() const
80 // This function is used in ICF (icf.cc). This is set to true by
81 // the target if a relocation to a merged section can be processed
82 // to retrieve the contents of the merged section.
84 can_icf_inline_merge_sections () const
87 // Whether a section called SECTION_NAME may have function pointers to
88 // sections not eligible for safe ICF folding.
90 section_may_have_icf_unsafe_pointers(const char* section_name
) const
92 // We recognize sections for normal vtables, construction vtables and
94 return (!is_prefix_of(".rodata._ZTV", section_name
)
95 && !is_prefix_of(".data.rel.ro._ZTV", section_name
)
96 && !is_prefix_of(".rodata._ZTC", section_name
)
97 && !is_prefix_of(".data.rel.ro._ZTC", section_name
)
98 && !is_prefix_of(".eh_frame", section_name
));
101 // Return the bit size that this target implements. This should
105 { return this->pti_
->size
; }
107 // Return whether this target is big-endian.
109 is_big_endian() const
110 { return this->pti_
->is_big_endian
; }
112 // Machine code to store in e_machine field of ELF header.
115 { return this->pti_
->machine_code
; }
117 // Processor specific flags to store in e_flags field of ELF header.
119 processor_specific_flags() const
120 { return this->processor_specific_flags_
; }
122 // Whether processor specific flags are set at least once.
124 are_processor_specific_flags_set() const
125 { return this->are_processor_specific_flags_set_
; }
127 // Whether this target has a specific make_symbol function.
129 has_make_symbol() const
130 { return this->pti_
->has_make_symbol
; }
132 // Whether this target has a specific resolve function.
135 { return this->pti_
->has_resolve
; }
137 // Whether this target has a specific code fill function.
139 has_code_fill() const
140 { return this->pti_
->has_code_fill
; }
142 // Return the default name of the dynamic linker.
144 dynamic_linker() const
145 { return this->pti_
->dynamic_linker
; }
147 // Return the default address to use for the text segment.
149 default_text_segment_address() const
150 { return this->pti_
->default_text_segment_address
; }
152 // Return the ABI specified page size.
156 if (parameters
->options().max_page_size() > 0)
157 return parameters
->options().max_page_size();
159 return this->pti_
->abi_pagesize
;
162 // Return the common page size used on actual systems.
164 common_pagesize() const
166 if (parameters
->options().common_page_size() > 0)
167 return std::min(parameters
->options().common_page_size(),
168 this->abi_pagesize());
170 return std::min(this->pti_
->common_pagesize
,
171 this->abi_pagesize());
174 // If we see some object files with .note.GNU-stack sections, and
175 // some objects files without them, this returns whether we should
176 // consider the object files without them to imply that the stack
177 // should be executable.
179 is_default_stack_executable() const
180 { return this->pti_
->is_default_stack_executable
; }
182 // Return a character which may appear as a prefix for a wrap
183 // symbol. If this character appears, we strip it when checking for
184 // wrapping and add it back when forming the final symbol name.
185 // This should be '\0' if not special prefix is required, which is
189 { return this->pti_
->wrap_char
; }
191 // Return the special section index which indicates a small common
192 // symbol. This will return SHN_UNDEF if there are no small common
195 small_common_shndx() const
196 { return this->pti_
->small_common_shndx
; }
198 // Return values to add to the section flags for the section holding
199 // small common symbols.
201 small_common_section_flags() const
203 gold_assert(this->pti_
->small_common_shndx
!= elfcpp::SHN_UNDEF
);
204 return this->pti_
->small_common_section_flags
;
207 // Return the special section index which indicates a large common
208 // symbol. This will return SHN_UNDEF if there are no large common
211 large_common_shndx() const
212 { return this->pti_
->large_common_shndx
; }
214 // Return values to add to the section flags for the section holding
215 // large common symbols.
217 large_common_section_flags() const
219 gold_assert(this->pti_
->large_common_shndx
!= elfcpp::SHN_UNDEF
);
220 return this->pti_
->large_common_section_flags
;
223 // This hook is called when an output section is created.
225 new_output_section(Output_section
* os
) const
226 { this->do_new_output_section(os
); }
228 // This is called to tell the target to complete any sections it is
229 // handling. After this all sections must have their final size.
231 finalize_sections(Layout
* layout
, const Input_objects
* input_objects
,
232 Symbol_table
* symtab
)
233 { return this->do_finalize_sections(layout
, input_objects
, symtab
); }
235 // Return the value to use for a global symbol which needs a special
236 // value in the dynamic symbol table. This will only be called if
237 // the backend first calls symbol->set_needs_dynsym_value().
239 dynsym_value(const Symbol
* sym
) const
240 { return this->do_dynsym_value(sym
); }
242 // Return a string to use to fill out a code section. This is
243 // basically one or more NOPS which must fill out the specified
246 code_fill(section_size_type length
) const
247 { return this->do_code_fill(length
); }
249 // Return whether SYM is known to be defined by the ABI. This is
250 // used to avoid inappropriate warnings about undefined symbols.
252 is_defined_by_abi(const Symbol
* sym
) const
253 { return this->do_is_defined_by_abi(sym
); }
255 // Adjust the output file header before it is written out. VIEW
256 // points to the header in external form. LEN is the length.
258 adjust_elf_header(unsigned char* view
, int len
) const
259 { return this->do_adjust_elf_header(view
, len
); }
261 // Return whether NAME is a local label name. This is used to implement the
262 // --discard-locals options.
264 is_local_label_name(const char* name
) const
265 { return this->do_is_local_label_name(name
); }
267 // Get the symbol index to use for a target specific reloc.
269 reloc_symbol_index(void* arg
, unsigned int type
) const
270 { return this->do_reloc_symbol_index(arg
, type
); }
272 // Get the addend to use for a target specific reloc.
274 reloc_addend(void* arg
, unsigned int type
, uint64_t addend
) const
275 { return this->do_reloc_addend(arg
, type
, addend
); }
277 // Return the PLT section to use for a global symbol. This is used
278 // for STT_GNU_IFUNC symbols.
280 plt_section_for_global(const Symbol
* sym
) const
281 { return this->do_plt_section_for_global(sym
); }
283 // Return the PLT section to use for a local symbol. This is used
284 // for STT_GNU_IFUNC symbols.
286 plt_section_for_local(const Relobj
* object
, unsigned int symndx
) const
287 { return this->do_plt_section_for_local(object
, symndx
); }
289 // Return true if a reference to SYM from a reloc of type R_TYPE
290 // means that the current function may call an object compiled
291 // without -fsplit-stack. SYM is known to be defined in an object
292 // compiled without -fsplit-stack.
294 is_call_to_non_split(const Symbol
* sym
, unsigned int r_type
) const
295 { return this->do_is_call_to_non_split(sym
, r_type
); }
297 // A function starts at OFFSET in section SHNDX in OBJECT. That
298 // function was compiled with -fsplit-stack, but it refers to a
299 // function which was compiled without -fsplit-stack. VIEW is a
300 // modifiable view of the section; VIEW_SIZE is the size of the
301 // view. The target has to adjust the function so that it allocates
304 calls_non_split(Relobj
* object
, unsigned int shndx
,
305 section_offset_type fnoffset
, section_size_type fnsize
,
306 unsigned char* view
, section_size_type view_size
,
307 std::string
* from
, std::string
* to
) const
309 this->do_calls_non_split(object
, shndx
, fnoffset
, fnsize
, view
, view_size
,
313 // Make an ELF object.
314 template<int size
, bool big_endian
>
316 make_elf_object(const std::string
& name
, Input_file
* input_file
,
317 off_t offset
, const elfcpp::Ehdr
<size
, big_endian
>& ehdr
)
318 { return this->do_make_elf_object(name
, input_file
, offset
, ehdr
); }
320 // Make an output section.
322 make_output_section(const char* name
, elfcpp::Elf_Word type
,
323 elfcpp::Elf_Xword flags
)
324 { return this->do_make_output_section(name
, type
, flags
); }
326 // Return true if target wants to perform relaxation.
330 // Run the dummy relaxation pass twice if relaxation debugging is enabled.
331 if (is_debugging_enabled(DEBUG_RELAXATION
))
334 return this->do_may_relax();
337 // Perform a relaxation pass. Return true if layout may be changed.
339 relax(int pass
, const Input_objects
* input_objects
, Symbol_table
* symtab
,
340 Layout
* layout
, const Task
* task
)
342 // Run the dummy relaxation pass twice if relaxation debugging is enabled.
343 if (is_debugging_enabled(DEBUG_RELAXATION
))
346 return this->do_relax(pass
, input_objects
, symtab
, layout
, task
);
349 // Return the target-specific name of attributes section. This is
350 // NULL if a target does not use attributes section or if it uses
351 // the default section name ".gnu.attributes".
353 attributes_section() const
354 { return this->pti_
->attributes_section
; }
356 // Return the vendor name of vendor attributes.
358 attributes_vendor() const
359 { return this->pti_
->attributes_vendor
; }
361 // Whether a section called NAME is an attribute section.
363 is_attributes_section(const char* name
) const
365 return ((this->pti_
->attributes_section
!= NULL
366 && strcmp(name
, this->pti_
->attributes_section
) == 0)
367 || strcmp(name
, ".gnu.attributes") == 0);
370 // Return a bit mask of argument types for attribute with TAG.
372 attribute_arg_type(int tag
) const
373 { return this->do_attribute_arg_type(tag
); }
375 // Return the attribute tag of the position NUM in the list of fixed
376 // attributes. Normally there is no reordering and
377 // attributes_order(NUM) == NUM.
379 attributes_order(int num
) const
380 { return this->do_attributes_order(num
); }
382 // When a target is selected as the default target, we call this method,
383 // which may be used for expensive, target-specific initialization.
385 select_as_default_target()
386 { this->do_select_as_default_target(); }
389 // This struct holds the constant information for a child class. We
390 // use a struct to avoid the overhead of virtual function calls for
391 // simple information.
394 // Address size (32 or 64).
396 // Whether the target is big endian.
398 // The code to store in the e_machine field of the ELF header.
399 elfcpp::EM machine_code
;
400 // Whether this target has a specific make_symbol function.
401 bool has_make_symbol
;
402 // Whether this target has a specific resolve function.
404 // Whether this target has a specific code fill function.
406 // Whether an object file with no .note.GNU-stack sections implies
407 // that the stack should be executable.
408 bool is_default_stack_executable
;
409 // Prefix character to strip when checking for wrapping.
411 // The default dynamic linker name.
412 const char* dynamic_linker
;
413 // The default text segment address.
414 uint64_t default_text_segment_address
;
415 // The ABI specified page size.
416 uint64_t abi_pagesize
;
417 // The common page size used by actual implementations.
418 uint64_t common_pagesize
;
419 // The special section index for small common symbols; SHN_UNDEF
421 elfcpp::Elf_Half small_common_shndx
;
422 // The special section index for large common symbols; SHN_UNDEF
424 elfcpp::Elf_Half large_common_shndx
;
425 // Section flags for small common section.
426 elfcpp::Elf_Xword small_common_section_flags
;
427 // Section flags for large common section.
428 elfcpp::Elf_Xword large_common_section_flags
;
429 // Name of attributes section if it is not ".gnu.attributes".
430 const char* attributes_section
;
431 // Vendor name of vendor attributes.
432 const char* attributes_vendor
;
435 Target(const Target_info
* pti
)
436 : pti_(pti
), processor_specific_flags_(0),
437 are_processor_specific_flags_set_(false)
440 // Virtual function which may be implemented by the child class.
442 do_new_output_section(Output_section
*) const
445 // Virtual function which may be implemented by the child class.
447 do_finalize_sections(Layout
*, const Input_objects
*, Symbol_table
*)
450 // Virtual function which may be implemented by the child class.
452 do_dynsym_value(const Symbol
*) const
453 { gold_unreachable(); }
455 // Virtual function which must be implemented by the child class if
458 do_code_fill(section_size_type
) const
459 { gold_unreachable(); }
461 // Virtual function which may be implemented by the child class.
463 do_is_defined_by_abi(const Symbol
*) const
466 // Adjust the output file header before it is written out. VIEW
467 // points to the header in external form. LEN is the length, and
468 // will be one of the values of elfcpp::Elf_sizes<size>::ehdr_size.
469 // By default, we do nothing.
471 do_adjust_elf_header(unsigned char*, int) const
474 // Virtual function which may be overridden by the child class.
476 do_is_local_label_name(const char*) const;
478 // Virtual function that must be overridden by a target which uses
479 // target specific relocations.
481 do_reloc_symbol_index(void*, unsigned int) const
482 { gold_unreachable(); }
484 // Virtual function that must be overridden by a target which uses
485 // target specific relocations.
487 do_reloc_addend(void*, unsigned int, uint64_t) const
488 { gold_unreachable(); }
490 // Virtual functions that must be overridden by a target that uses
491 // STT_GNU_IFUNC symbols.
493 do_plt_section_for_global(const Symbol
*) const
494 { gold_unreachable(); }
497 do_plt_section_for_local(const Relobj
*, unsigned int) const
498 { gold_unreachable(); }
500 // Virtual function which may be overridden by the child class. The
501 // default implementation is that any function not defined by the
502 // ABI is a call to a non-split function.
504 do_is_call_to_non_split(const Symbol
* sym
, unsigned int) const;
506 // Virtual function which may be overridden by the child class.
508 do_calls_non_split(Relobj
* object
, unsigned int, section_offset_type
,
509 section_size_type
, unsigned char*, section_size_type
,
510 std::string
*, std::string
*) const;
512 // make_elf_object hooks. There are four versions of these for
513 // different address sizes and endianness.
515 // Set processor specific flags.
517 set_processor_specific_flags(elfcpp::Elf_Word flags
)
519 this->processor_specific_flags_
= flags
;
520 this->are_processor_specific_flags_set_
= true;
523 #ifdef HAVE_TARGET_32_LITTLE
524 // Virtual functions which may be overridden by the child class.
526 do_make_elf_object(const std::string
&, Input_file
*, off_t
,
527 const elfcpp::Ehdr
<32, false>&);
530 #ifdef HAVE_TARGET_32_BIG
531 // Virtual functions which may be overridden by the child class.
533 do_make_elf_object(const std::string
&, Input_file
*, off_t
,
534 const elfcpp::Ehdr
<32, true>&);
537 #ifdef HAVE_TARGET_64_LITTLE
538 // Virtual functions which may be overridden by the child class.
540 do_make_elf_object(const std::string
&, Input_file
*, off_t
,
541 const elfcpp::Ehdr
<64, false>& ehdr
);
544 #ifdef HAVE_TARGET_64_BIG
545 // Virtual functions which may be overridden by the child class.
547 do_make_elf_object(const std::string
& name
, Input_file
* input_file
,
548 off_t offset
, const elfcpp::Ehdr
<64, true>& ehdr
);
551 // Virtual functions which may be overridden by the child class.
552 virtual Output_section
*
553 do_make_output_section(const char* name
, elfcpp::Elf_Word type
,
554 elfcpp::Elf_Xword flags
);
556 // Virtual function which may be overridden by the child class.
559 { return parameters
->options().relax(); }
561 // Virtual function which may be overridden by the child class.
563 do_relax(int, const Input_objects
*, Symbol_table
*, Layout
*, const Task
*)
566 // A function for targets to call. Return whether BYTES/LEN matches
567 // VIEW/VIEW_SIZE at OFFSET.
569 match_view(const unsigned char* view
, section_size_type view_size
,
570 section_offset_type offset
, const char* bytes
, size_t len
) const;
572 // Set the contents of a VIEW/VIEW_SIZE to nops starting at OFFSET
575 set_view_to_nop(unsigned char* view
, section_size_type view_size
,
576 section_offset_type offset
, size_t len
) const;
578 // This must be overridden by the child class if it has target-specific
579 // attributes subsection in the attribute section.
581 do_attribute_arg_type(int) const
582 { gold_unreachable(); }
584 // This may be overridden by the child class.
586 do_attributes_order(int num
) const
589 // This may be overridden by the child class.
591 do_select_as_default_target()
595 // The implementations of the four do_make_elf_object virtual functions are
596 // almost identical except for their sizes and endianness. We use a template.
597 // for their implementations.
598 template<int size
, bool big_endian
>
600 do_make_elf_object_implementation(const std::string
&, Input_file
*, off_t
,
601 const elfcpp::Ehdr
<size
, big_endian
>&);
603 Target(const Target
&);
604 Target
& operator=(const Target
&);
606 // The target information.
607 const Target_info
* pti_
;
608 // Processor-specific flags.
609 elfcpp::Elf_Word processor_specific_flags_
;
610 // Whether the processor-specific flags are set at least once.
611 bool are_processor_specific_flags_set_
;
614 // The abstract class for a specific size and endianness of target.
615 // Each actual target implementation class should derive from an
616 // instantiation of Sized_target.
618 template<int size
, bool big_endian
>
619 class Sized_target
: public Target
622 // Make a new symbol table entry for the target. This should be
623 // overridden by a target which needs additional information in the
624 // symbol table. This will only be called if has_make_symbol()
626 virtual Sized_symbol
<size
>*
628 { gold_unreachable(); }
630 // Resolve a symbol for the target. This should be overridden by a
631 // target which needs to take special action. TO is the
632 // pre-existing symbol. SYM is the new symbol, seen in OBJECT.
633 // VERSION is the version of SYM. This will only be called if
634 // has_resolve() returns true.
636 resolve(Symbol
*, const elfcpp::Sym
<size
, big_endian
>&, Object
*,
638 { gold_unreachable(); }
640 // Process the relocs for a section, and record information of the
641 // mapping from source to destination sections. This mapping is later
642 // used to determine unreferenced garbage sections. This procedure is
643 // only called during garbage collection.
645 gc_process_relocs(Symbol_table
* symtab
,
647 Sized_relobj_file
<size
, big_endian
>* object
,
648 unsigned int data_shndx
,
649 unsigned int sh_type
,
650 const unsigned char* prelocs
,
652 Output_section
* output_section
,
653 bool needs_special_offset_handling
,
654 size_t local_symbol_count
,
655 const unsigned char* plocal_symbols
) = 0;
657 // Scan the relocs for a section, and record any information
658 // required for the symbol. SYMTAB is the symbol table. OBJECT is
659 // the object in which the section appears. DATA_SHNDX is the
660 // section index that these relocs apply to. SH_TYPE is the type of
661 // the relocation section, SHT_REL or SHT_RELA. PRELOCS points to
662 // the relocation data. RELOC_COUNT is the number of relocs.
663 // LOCAL_SYMBOL_COUNT is the number of local symbols.
664 // OUTPUT_SECTION is the output section.
665 // NEEDS_SPECIAL_OFFSET_HANDLING is true if offsets to the output
666 // sections are not mapped as usual. PLOCAL_SYMBOLS points to the
667 // local symbol data from OBJECT. GLOBAL_SYMBOLS is the array of
668 // pointers to the global symbol table from OBJECT.
670 scan_relocs(Symbol_table
* symtab
,
672 Sized_relobj_file
<size
, big_endian
>* object
,
673 unsigned int data_shndx
,
674 unsigned int sh_type
,
675 const unsigned char* prelocs
,
677 Output_section
* output_section
,
678 bool needs_special_offset_handling
,
679 size_t local_symbol_count
,
680 const unsigned char* plocal_symbols
) = 0;
682 // Relocate section data. SH_TYPE is the type of the relocation
683 // section, SHT_REL or SHT_RELA. PRELOCS points to the relocation
684 // information. RELOC_COUNT is the number of relocs.
685 // OUTPUT_SECTION is the output section.
686 // NEEDS_SPECIAL_OFFSET_HANDLING is true if offsets must be mapped
687 // to correspond to the output section. VIEW is a view into the
688 // output file holding the section contents, VIEW_ADDRESS is the
689 // virtual address of the view, and VIEW_SIZE is the size of the
690 // view. If NEEDS_SPECIAL_OFFSET_HANDLING is true, the VIEW_xx
691 // parameters refer to the complete output section data, not just
692 // the input section data.
694 relocate_section(const Relocate_info
<size
, big_endian
>*,
695 unsigned int sh_type
,
696 const unsigned char* prelocs
,
698 Output_section
* output_section
,
699 bool needs_special_offset_handling
,
701 typename
elfcpp::Elf_types
<size
>::Elf_Addr view_address
,
702 section_size_type view_size
,
703 const Reloc_symbol_changes
*) = 0;
705 // Scan the relocs during a relocatable link. The parameters are
706 // like scan_relocs, with an additional Relocatable_relocs
707 // parameter, used to record the disposition of the relocs.
709 scan_relocatable_relocs(Symbol_table
* symtab
,
711 Sized_relobj_file
<size
, big_endian
>* object
,
712 unsigned int data_shndx
,
713 unsigned int sh_type
,
714 const unsigned char* prelocs
,
716 Output_section
* output_section
,
717 bool needs_special_offset_handling
,
718 size_t local_symbol_count
,
719 const unsigned char* plocal_symbols
,
720 Relocatable_relocs
*) = 0;
722 // Relocate a section during a relocatable link. The parameters are
723 // like relocate_section, with additional parameters for the view of
724 // the output reloc section.
726 relocate_for_relocatable(const Relocate_info
<size
, big_endian
>*,
727 unsigned int sh_type
,
728 const unsigned char* prelocs
,
730 Output_section
* output_section
,
731 off_t offset_in_output_section
,
732 const Relocatable_relocs
*,
734 typename
elfcpp::Elf_types
<size
>::Elf_Addr
736 section_size_type view_size
,
737 unsigned char* reloc_view
,
738 section_size_type reloc_view_size
) = 0;
740 // Perform target-specific processing in a relocatable link. This is
741 // only used if we use the relocation strategy RELOC_SPECIAL.
742 // RELINFO points to a Relocation_info structure. SH_TYPE is the relocation
743 // section type. PRELOC_IN points to the original relocation. RELNUM is
744 // the index number of the relocation in the relocation section.
745 // OUTPUT_SECTION is the output section to which the relocation is applied.
746 // OFFSET_IN_OUTPUT_SECTION is the offset of the relocation input section
747 // within the output section. VIEW points to the output view of the
748 // output section. VIEW_ADDRESS is output address of the view. VIEW_SIZE
749 // is the size of the output view and PRELOC_OUT points to the new
750 // relocation in the output object.
752 // A target only needs to override this if the generic code in
753 // target-reloc.h cannot handle some relocation types.
756 relocate_special_relocatable(const Relocate_info
<size
, big_endian
>*
758 unsigned int /* sh_type */,
759 const unsigned char* /* preloc_in */,
761 Output_section
* /* output_section */,
762 off_t
/* offset_in_output_section */,
763 unsigned char* /* view */,
764 typename
elfcpp::Elf_types
<size
>::Elf_Addr
766 section_size_type
/* view_size */,
767 unsigned char* /* preloc_out*/)
768 { gold_unreachable(); }
770 // Return the number of entries in the GOT. This is only used for
771 // laying out the incremental link info sections. A target needs
772 // to implement this to support incremental linking.
775 got_entry_count() const
776 { gold_unreachable(); }
778 // Return the number of entries in the PLT. This is only used for
779 // laying out the incremental link info sections. A target needs
780 // to implement this to support incremental linking.
783 plt_entry_count() const
784 { gold_unreachable(); }
786 // Return the offset of the first non-reserved PLT entry. This is
787 // only used for laying out the incremental link info sections.
788 // A target needs to implement this to support incremental linking.
791 first_plt_entry_offset() const
792 { gold_unreachable(); }
794 // Return the size of each PLT entry. This is only used for
795 // laying out the incremental link info sections. A target needs
796 // to implement this to support incremental linking.
799 plt_entry_size() const
800 { gold_unreachable(); }
802 // Create the GOT and PLT sections for an incremental update.
803 // A target needs to implement this to support incremental linking.
805 virtual Output_data_got
<size
, big_endian
>*
806 init_got_plt_for_update(Symbol_table
*,
808 unsigned int /* got_count */,
809 unsigned int /* plt_count */)
810 { gold_unreachable(); }
812 // Reserve a GOT entry for a local symbol, and regenerate any
813 // necessary dynamic relocations.
815 reserve_local_got_entry(unsigned int /* got_index */,
816 Sized_relobj
<size
, big_endian
>* /* obj */,
817 unsigned int /* r_sym */,
818 unsigned int /* got_type */)
819 { gold_unreachable(); }
821 // Reserve a GOT entry for a global symbol, and regenerate any
822 // necessary dynamic relocations.
824 reserve_global_got_entry(unsigned int /* got_index */, Symbol
* /* gsym */,
825 unsigned int /* got_type */)
826 { gold_unreachable(); }
828 // Register an existing PLT entry for a global symbol.
829 // A target needs to implement this to support incremental linking.
832 register_global_plt_entry(unsigned int /* plt_index */,
834 { gold_unreachable(); }
836 // Apply an incremental relocation.
839 apply_relocation(const Relocate_info
<size
, big_endian
>* /* relinfo */,
840 typename
elfcpp::Elf_types
<size
>::Elf_Addr
/* r_offset */,
841 unsigned int /* r_type */,
842 typename
elfcpp::Elf_types
<size
>::Elf_Swxword
/* r_addend */,
843 const Symbol
* /* gsym */,
844 unsigned char* /* view */,
845 typename
elfcpp::Elf_types
<size
>::Elf_Addr
/* address */,
846 section_size_type
/* view_size */)
847 { gold_unreachable(); }
850 Sized_target(const Target::Target_info
* pti
)
853 gold_assert(pti
->size
== size
);
854 gold_assert(pti
->is_big_endian
? big_endian
: !big_endian
);
858 } // End namespace gold.
860 #endif // !defined(GOLD_TARGET_H)