1 // tilegx.cc -- tilegx target support for gold.
3 // Copyright (C) 2012-2019 Free Software Foundation, Inc.
4 // Written by Jiong Wang (jiwang@tilera.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 #include "parameters.h"
36 #include "copy-relocs.h"
38 #include "target-reloc.h"
39 #include "target-select.h"
44 // the first got entry reserved
45 const int32_t TILEGX_GOT_RESERVE_COUNT
= 1;
47 // the first two .got.plt entry reserved
48 const int32_t TILEGX_GOTPLT_RESERVE_COUNT
= 2;
50 // 1. for both 64/32 bit mode, the instruction bundle is always 64bit.
51 // 2. thus .plt section should always be aligned to 64 bit.
52 const int32_t TILEGX_INST_BUNDLE_SIZE
= 64;
59 // A class to handle the PLT data.
60 // This is an abstract base class that handles most of the linker details
61 // but does not know the actual contents of PLT entries. The derived
62 // classes below fill in those details.
64 template<int size
, bool big_endian
>
65 class Output_data_plt_tilegx
: public Output_section_data
68 typedef Output_data_reloc
<elfcpp::SHT_RELA
, true,size
, big_endian
>
71 Output_data_plt_tilegx(Layout
* layout
, uint64_t addralign
,
72 Output_data_got
<size
, big_endian
>* got
,
73 Output_data_space
* got_plt
,
74 Output_data_space
* got_irelative
)
75 : Output_section_data(addralign
), layout_(layout
),
76 irelative_rel_(NULL
), got_(got
), got_plt_(got_plt
),
77 got_irelative_(got_irelative
), count_(0),
78 irelative_count_(0), free_list_()
79 { this->init(layout
); }
81 Output_data_plt_tilegx(Layout
* layout
, uint64_t plt_entry_size
,
82 Output_data_got
<size
, big_endian
>* got
,
83 Output_data_space
* got_plt
,
84 Output_data_space
* got_irelative
,
85 unsigned int plt_count
)
86 : Output_section_data((plt_count
+ 1) * plt_entry_size
,
87 TILEGX_INST_BUNDLE_SIZE
, false),
88 layout_(layout
), irelative_rel_(NULL
), got_(got
),
89 got_plt_(got_plt
), got_irelative_(got_irelative
), count_(plt_count
),
90 irelative_count_(0), free_list_()
94 // Initialize the free list and reserve the first entry.
95 this->free_list_
.init((plt_count
+ 1) * plt_entry_size
, false);
96 this->free_list_
.remove(0, plt_entry_size
);
99 // Initialize the PLT section.
101 init(Layout
* layout
);
103 // Add an entry to the PLT.
105 add_entry(Symbol_table
*, Layout
*, Symbol
* gsym
);
107 // Add an entry to the PLT for a local STT_GNU_IFUNC symbol.
109 add_local_ifunc_entry(Symbol_table
*, Layout
*,
110 Sized_relobj_file
<size
, big_endian
>*, unsigned int);
112 // Add the relocation for a PLT entry.
114 add_relocation(Symbol_table
*, Layout
*, Symbol
*, unsigned int);
116 // Return the .rela.plt section data.
119 { return this->rel_
; }
121 // Return where the IRELATIVE relocations should go in the PLT
124 rela_irelative(Symbol_table
*, Layout
*);
126 // Return whether we created a section for IRELATIVE relocations.
128 has_irelative_section() const
129 { return this->irelative_rel_
!= NULL
; }
131 // Return the number of PLT entries.
134 { return this->count_
+ this->irelative_count_
; }
136 // Return the offset of the first non-reserved PLT entry.
138 first_plt_entry_offset()
139 { return this->get_plt_entry_size(); }
141 // Return the size of a PLT entry.
143 get_plt_entry_size() const
144 { return plt_entry_size
; }
146 // Reserve a slot in the PLT for an existing symbol in an incremental update.
148 reserve_slot(unsigned int plt_index
)
150 this->free_list_
.remove((plt_index
+ 1) * this->get_plt_entry_size(),
151 (plt_index
+ 2) * this->get_plt_entry_size());
154 // Return the PLT address to use for a global symbol.
156 address_for_global(const Symbol
*);
158 // Return the PLT address to use for a local symbol.
160 address_for_local(const Relobj
*, unsigned int symndx
);
163 // Fill in the first PLT entry.
165 fill_first_plt_entry(unsigned char*);
167 // Fill in a normal PLT entry. Returns the offset into the entry that
168 // should be the initial GOT slot value.
170 fill_plt_entry(unsigned char*,
171 typename
elfcpp::Elf_types
<size
>::Elf_Addr
,
173 typename
elfcpp::Elf_types
<size
>::Elf_Addr
,
174 unsigned int, unsigned int);
177 do_adjust_output_section(Output_section
* os
);
179 // Write to a map file.
181 do_print_to_mapfile(Mapfile
* mapfile
) const
182 { mapfile
->print_output_data(this, _("** PLT")); }
185 // Set the final size.
187 set_final_data_size();
189 // Write out the PLT data.
191 do_write(Output_file
*);
193 // A pointer to the Layout class, so that we can find the .dynamic
194 // section when we write out the GOT PLT section.
196 // The reloc section.
198 // The IRELATIVE relocs, if necessary. These must follow the
199 // regular PLT relocations.
200 Reloc_section
* irelative_rel_
;
202 Output_data_got
<size
, big_endian
>* got_
;
203 // The .got.plt section.
204 Output_data_space
* got_plt_
;
205 // The part of the .got.plt section used for IRELATIVE relocs.
206 Output_data_space
* got_irelative_
;
207 // The number of PLT entries.
209 // Number of PLT entries with R_TILEGX_IRELATIVE relocs. These
210 // follow the regular PLT entries.
211 unsigned int irelative_count_
;
212 // List of available regions within the section, for incremental
214 Free_list free_list_
;
215 // The size of an entry in the PLT.
216 static const int plt_entry_size
= 40;
217 // The first entry in the PLT.
218 static const unsigned char first_plt_entry
[plt_entry_size
];
219 // Other entries in the PLT for an executable.
220 static const unsigned char plt_entry
[plt_entry_size
];
223 // The tilegx target class.
225 // http://www.tilera.com/scm
226 // TLS info comes from
227 // http://people.redhat.com/drepper/tls.pdf
229 template<int size
, bool big_endian
>
230 class Target_tilegx
: public Sized_target
<size
, big_endian
>
234 typedef Output_data_reloc
<elfcpp::SHT_RELA
, true, size
, big_endian
>
237 Target_tilegx(const Target::Target_info
* info
= &tilegx_info
)
238 : Sized_target
<size
, big_endian
>(info
),
239 got_(NULL
), plt_(NULL
), got_plt_(NULL
), got_irelative_(NULL
),
240 global_offset_table_(NULL
), tilegx_dynamic_(NULL
), rela_dyn_(NULL
),
241 rela_irelative_(NULL
), copy_relocs_(elfcpp::R_TILEGX_COPY
),
242 got_mod_index_offset_(-1U),
243 tls_get_addr_sym_defined_(false)
246 // Scan the relocations to look for symbol adjustments.
248 gc_process_relocs(Symbol_table
* symtab
,
250 Sized_relobj_file
<size
, big_endian
>* object
,
251 unsigned int data_shndx
,
252 unsigned int sh_type
,
253 const unsigned char* prelocs
,
255 Output_section
* output_section
,
256 bool needs_special_offset_handling
,
257 size_t local_symbol_count
,
258 const unsigned char* plocal_symbols
);
260 // Scan the relocations to look for symbol adjustments.
262 scan_relocs(Symbol_table
* symtab
,
264 Sized_relobj_file
<size
, big_endian
>* object
,
265 unsigned int data_shndx
,
266 unsigned int sh_type
,
267 const unsigned char* prelocs
,
269 Output_section
* output_section
,
270 bool needs_special_offset_handling
,
271 size_t local_symbol_count
,
272 const unsigned char* plocal_symbols
);
274 // Finalize the sections.
276 do_finalize_sections(Layout
*, const Input_objects
*, Symbol_table
*);
278 // Return the value to use for a dynamic which requires special
281 do_dynsym_value(const Symbol
*) const;
283 // Relocate a section.
285 relocate_section(const Relocate_info
<size
, big_endian
>*,
286 unsigned int sh_type
,
287 const unsigned char* prelocs
,
289 Output_section
* output_section
,
290 bool needs_special_offset_handling
,
292 typename
elfcpp::Elf_types
<size
>::Elf_Addr view_address
,
293 section_size_type view_size
,
294 const Reloc_symbol_changes
*);
296 // Scan the relocs during a relocatable link.
298 scan_relocatable_relocs(Symbol_table
* symtab
,
300 Sized_relobj_file
<size
, big_endian
>* object
,
301 unsigned int data_shndx
,
302 unsigned int sh_type
,
303 const unsigned char* prelocs
,
305 Output_section
* output_section
,
306 bool needs_special_offset_handling
,
307 size_t local_symbol_count
,
308 const unsigned char* plocal_symbols
,
309 Relocatable_relocs
*);
311 // Scan the relocs for --emit-relocs.
313 emit_relocs_scan(Symbol_table
* symtab
,
315 Sized_relobj_file
<size
, big_endian
>* object
,
316 unsigned int data_shndx
,
317 unsigned int sh_type
,
318 const unsigned char* prelocs
,
320 Output_section
* output_section
,
321 bool needs_special_offset_handling
,
322 size_t local_symbol_count
,
323 const unsigned char* plocal_syms
,
324 Relocatable_relocs
* rr
);
326 // Relocate a section during a relocatable link.
329 const Relocate_info
<size
, big_endian
>*,
330 unsigned int sh_type
,
331 const unsigned char* prelocs
,
333 Output_section
* output_section
,
334 typename
elfcpp::Elf_types
<size
>::Elf_Off offset_in_output_section
,
336 typename
elfcpp::Elf_types
<size
>::Elf_Addr view_address
,
337 section_size_type view_size
,
338 unsigned char* reloc_view
,
339 section_size_type reloc_view_size
);
341 // Return whether SYM is defined by the ABI.
343 do_is_defined_by_abi(const Symbol
* sym
) const
344 { return strcmp(sym
->name(), "__tls_get_addr") == 0; }
346 // define tilegx specific symbols
348 do_define_standard_symbols(Symbol_table
*, Layout
*);
350 // Return the PLT section.
352 do_plt_address_for_global(const Symbol
* gsym
) const
353 { return this->plt_section()->address_for_global(gsym
); }
356 do_plt_address_for_local(const Relobj
* relobj
, unsigned int symndx
) const
357 { return this->plt_section()->address_for_local(relobj
, symndx
); }
359 // This function should be defined in targets that can use relocation
360 // types to determine (implemented in local_reloc_may_be_function_pointer
361 // and global_reloc_may_be_function_pointer)
362 // if a function's pointer is taken. ICF uses this in safe mode to only
363 // fold those functions whose pointer is defintely not taken. For tilegx
364 // pie binaries, safe ICF cannot be done by looking at relocation types.
366 do_can_check_for_function_pointers() const
369 // Return the base for a DW_EH_PE_datarel encoding.
371 do_ehframe_datarel_base() const;
373 // Return whether there is a GOT section.
375 has_got_section() const
376 { return this->got_
!= NULL
; }
378 // Return the size of the GOT section.
382 gold_assert(this->got_
!= NULL
);
383 return this->got_
->data_size();
386 // Return the number of entries in the GOT.
388 got_entry_count() const
390 if (this->got_
== NULL
)
392 return this->got_size() / (size
/ 8);
395 // Return the number of entries in the PLT.
397 plt_entry_count() const;
399 // Return the offset of the first non-reserved PLT entry.
401 first_plt_entry_offset() const;
403 // Return the size of each PLT entry.
405 plt_entry_size() const;
407 // Create the GOT section for an incremental update.
408 Output_data_got_base
*
409 init_got_plt_for_update(Symbol_table
* symtab
,
411 unsigned int got_count
,
412 unsigned int plt_count
);
414 // Reserve a GOT entry for a local symbol, and regenerate any
415 // necessary dynamic relocations.
417 reserve_local_got_entry(unsigned int got_index
,
418 Sized_relobj
<size
, big_endian
>* obj
,
420 unsigned int got_type
);
422 // Reserve a GOT entry for a global symbol, and regenerate any
423 // necessary dynamic relocations.
425 reserve_global_got_entry(unsigned int got_index
, Symbol
* gsym
,
426 unsigned int got_type
);
428 // Register an existing PLT entry for a global symbol.
430 register_global_plt_entry(Symbol_table
*, Layout
*, unsigned int plt_index
,
433 // Force a COPY relocation for a given symbol.
435 emit_copy_reloc(Symbol_table
*, Symbol
*, Output_section
*, off_t
);
437 // Apply an incremental relocation.
439 apply_relocation(const Relocate_info
<size
, big_endian
>* relinfo
,
440 typename
elfcpp::Elf_types
<size
>::Elf_Addr r_offset
,
442 typename
elfcpp::Elf_types
<size
>::Elf_Swxword r_addend
,
445 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
446 section_size_type view_size
);
449 // The class which scans relocations.
454 : issued_non_pic_error_(false)
458 get_reference_flags(unsigned int r_type
);
461 local(Symbol_table
* symtab
, Layout
* layout
, Target_tilegx
* target
,
462 Sized_relobj_file
<size
, big_endian
>* object
,
463 unsigned int data_shndx
,
464 Output_section
* output_section
,
465 const elfcpp::Rela
<size
, big_endian
>& reloc
, unsigned int r_type
,
466 const elfcpp::Sym
<size
, big_endian
>& lsym
,
470 global(Symbol_table
* symtab
, Layout
* layout
, Target_tilegx
* target
,
471 Sized_relobj_file
<size
, big_endian
>* object
,
472 unsigned int data_shndx
,
473 Output_section
* output_section
,
474 const elfcpp::Rela
<size
, big_endian
>& reloc
, unsigned int r_type
,
478 local_reloc_may_be_function_pointer(Symbol_table
* symtab
, Layout
* layout
,
479 Target_tilegx
* target
,
480 Sized_relobj_file
<size
, big_endian
>* object
,
481 unsigned int data_shndx
,
482 Output_section
* output_section
,
483 const elfcpp::Rela
<size
, big_endian
>& reloc
,
485 const elfcpp::Sym
<size
, big_endian
>& lsym
);
488 global_reloc_may_be_function_pointer(Symbol_table
* symtab
, Layout
* layout
,
489 Target_tilegx
* target
,
490 Sized_relobj_file
<size
, big_endian
>* object
,
491 unsigned int data_shndx
,
492 Output_section
* output_section
,
493 const elfcpp::Rela
<size
, big_endian
>& reloc
,
499 unsupported_reloc_local(Sized_relobj_file
<size
, big_endian
>*,
500 unsigned int r_type
);
503 unsupported_reloc_global(Sized_relobj_file
<size
, big_endian
>*,
504 unsigned int r_type
, Symbol
*);
507 check_non_pic(Relobj
*, unsigned int r_type
);
510 possible_function_pointer_reloc(unsigned int r_type
);
513 reloc_needs_plt_for_ifunc(Sized_relobj_file
<size
, big_endian
>*,
514 unsigned int r_type
);
516 // Whether we have issued an error about a non-PIC compilation.
517 bool issued_non_pic_error_
;
520 // The class which implements relocation.
531 // Do a relocation. Return false if the caller should not issue
532 // any warnings about this relocation.
534 relocate(const Relocate_info
<size
, big_endian
>*, unsigned int,
535 Target_tilegx
*, Output_section
*, size_t, const unsigned char*,
536 const Sized_symbol
<size
>*, const Symbol_value
<size
>*,
537 unsigned char*, typename
elfcpp::Elf_types
<size
>::Elf_Addr
,
541 // Adjust TLS relocation type based on the options and whether this
542 // is a local symbol.
543 static tls::Tls_optimization
544 optimize_tls_reloc(bool is_final
, int r_type
);
546 // Get the GOT section, creating it if necessary.
547 Output_data_got
<size
, big_endian
>*
548 got_section(Symbol_table
*, Layout
*);
550 // Get the GOT PLT section.
552 got_plt_section() const
554 gold_assert(this->got_plt_
!= NULL
);
555 return this->got_plt_
;
558 // Create the PLT section.
560 make_plt_section(Symbol_table
* symtab
, Layout
* layout
);
562 // Create a PLT entry for a global symbol.
564 make_plt_entry(Symbol_table
*, Layout
*, Symbol
*);
566 // Create a PLT entry for a local STT_GNU_IFUNC symbol.
568 make_local_ifunc_plt_entry(Symbol_table
*, Layout
*,
569 Sized_relobj_file
<size
, big_endian
>* relobj
,
570 unsigned int local_sym_index
);
572 // Create a GOT entry for the TLS module index.
574 got_mod_index_entry(Symbol_table
* symtab
, Layout
* layout
,
575 Sized_relobj_file
<size
, big_endian
>* object
);
577 // Get the PLT section.
578 Output_data_plt_tilegx
<size
, big_endian
>*
581 gold_assert(this->plt_
!= NULL
);
585 // Get the dynamic reloc section, creating it if necessary.
587 rela_dyn_section(Layout
*);
589 // Get the section to use for IRELATIVE relocations.
591 rela_irelative_section(Layout
*);
593 // Add a potential copy relocation.
595 copy_reloc(Symbol_table
* symtab
, Layout
* layout
,
596 Sized_relobj_file
<size
, big_endian
>* object
,
597 unsigned int shndx
, Output_section
* output_section
,
598 Symbol
* sym
, const elfcpp::Rela
<size
, big_endian
>& reloc
)
600 unsigned int r_type
= elfcpp::elf_r_type
<size
>(reloc
.get_r_info());
601 this->copy_relocs_
.copy_reloc(symtab
, layout
,
602 symtab
->get_sized_symbol
<size
>(sym
),
603 object
, shndx
, output_section
,
604 r_type
, reloc
.get_r_offset(),
605 reloc
.get_r_addend(),
606 this->rela_dyn_section(layout
));
609 // Information about this specific target which we pass to the
610 // general Target structure.
611 static const Target::Target_info tilegx_info
;
613 // The types of GOT entries needed for this platform.
614 // These values are exposed to the ABI in an incremental link.
615 // Do not renumber existing values without changing the version
616 // number of the .gnu_incremental_inputs section.
619 GOT_TYPE_STANDARD
= 0, // GOT entry for a regular symbol
620 GOT_TYPE_TLS_OFFSET
= 1, // GOT entry for TLS offset
621 GOT_TYPE_TLS_PAIR
= 2, // GOT entry for TLS module/offset pair
622 GOT_TYPE_TLS_DESC
= 3 // GOT entry for TLS_DESC pair
625 // This type is used as the argument to the target specific
626 // relocation routines. The only target specific reloc is
627 // R_X86_64_TLSDESC against a local symbol.
630 Tlsdesc_info(Sized_relobj_file
<size
, big_endian
>* a_object
,
631 unsigned int a_r_sym
)
632 : object(a_object
), r_sym(a_r_sym
)
635 // The object in which the local symbol is defined.
636 Sized_relobj_file
<size
, big_endian
>* object
;
637 // The local symbol index in the object.
642 Output_data_got
<size
, big_endian
>* got_
;
644 Output_data_plt_tilegx
<size
, big_endian
>* plt_
;
645 // The GOT PLT section.
646 Output_data_space
* got_plt_
;
647 // The GOT section for IRELATIVE relocations.
648 Output_data_space
* got_irelative_
;
649 // The _GLOBAL_OFFSET_TABLE_ symbol.
650 Symbol
* global_offset_table_
;
651 // The _TILEGX_DYNAMIC_ symbol.
652 Symbol
* tilegx_dynamic_
;
653 // The dynamic reloc section.
654 Reloc_section
* rela_dyn_
;
655 // The section to use for IRELATIVE relocs.
656 Reloc_section
* rela_irelative_
;
657 // Relocs saved to avoid a COPY reloc.
658 Copy_relocs
<elfcpp::SHT_RELA
, size
, big_endian
> copy_relocs_
;
659 // Offset of the GOT entry for the TLS module index.
660 unsigned int got_mod_index_offset_
;
661 // True if the _tls_get_addr symbol has been defined.
662 bool tls_get_addr_sym_defined_
;
666 const Target::Target_info Target_tilegx
<64, false>::tilegx_info
=
669 false, // is_big_endian
670 elfcpp::EM_TILEGX
, // machine_code
671 false, // has_make_symbol
672 false, // has_resolve
673 false, // has_code_fill
674 true, // is_default_stack_executable
675 false, // can_icf_inline_merge_sections
677 "/lib/ld.so.1", // program interpreter
678 0x10000, // default_text_segment_address
679 0x10000, // abi_pagesize (overridable by -z max-page-size)
680 0x10000, // common_pagesize (overridable by -z common-page-size)
681 false, // isolate_execinstr
683 elfcpp::SHN_UNDEF
, // small_common_shndx
684 elfcpp::SHN_UNDEF
, // large_common_shndx
685 0, // small_common_section_flags
686 0, // large_common_section_flags
687 NULL
, // attributes_section
688 NULL
, // attributes_vendor
689 "_start", // entry_symbol_name
690 32, // hash_entry_size
691 elfcpp::SHT_PROGBITS
, // unwind_section_type
695 const Target::Target_info Target_tilegx
<32, false>::tilegx_info
=
698 false, // is_big_endian
699 elfcpp::EM_TILEGX
, // machine_code
700 false, // has_make_symbol
701 false, // has_resolve
702 false, // has_code_fill
703 true, // is_default_stack_executable
704 false, // can_icf_inline_merge_sections
706 "/lib32/ld.so.1", // program interpreter
707 0x10000, // default_text_segment_address
708 0x10000, // abi_pagesize (overridable by -z max-page-size)
709 0x10000, // common_pagesize (overridable by -z common-page-size)
710 false, // isolate_execinstr
712 elfcpp::SHN_UNDEF
, // small_common_shndx
713 elfcpp::SHN_UNDEF
, // large_common_shndx
714 0, // small_common_section_flags
715 0, // large_common_section_flags
716 NULL
, // attributes_section
717 NULL
, // attributes_vendor
718 "_start", // entry_symbol_name
719 32, // hash_entry_size
720 elfcpp::SHT_PROGBITS
, // unwind_section_type
724 const Target::Target_info Target_tilegx
<64, true>::tilegx_info
=
727 true, // is_big_endian
728 elfcpp::EM_TILEGX
, // machine_code
729 false, // has_make_symbol
730 false, // has_resolve
731 false, // has_code_fill
732 true, // is_default_stack_executable
733 false, // can_icf_inline_merge_sections
735 "/lib/ld.so.1", // program interpreter
736 0x10000, // default_text_segment_address
737 0x10000, // abi_pagesize (overridable by -z max-page-size)
738 0x10000, // common_pagesize (overridable by -z common-page-size)
739 false, // isolate_execinstr
741 elfcpp::SHN_UNDEF
, // small_common_shndx
742 elfcpp::SHN_UNDEF
, // large_common_shndx
743 0, // small_common_section_flags
744 0, // large_common_section_flags
745 NULL
, // attributes_section
746 NULL
, // attributes_vendor
747 "_start", // entry_symbol_name
748 32, // hash_entry_size
749 elfcpp::SHT_PROGBITS
, // unwind_section_type
753 const Target::Target_info Target_tilegx
<32, true>::tilegx_info
=
756 true, // is_big_endian
757 elfcpp::EM_TILEGX
, // machine_code
758 false, // has_make_symbol
759 false, // has_resolve
760 false, // has_code_fill
761 true, // is_default_stack_executable
762 false, // can_icf_inline_merge_sections
764 "/lib32/ld.so.1", // program interpreter
765 0x10000, // default_text_segment_address
766 0x10000, // abi_pagesize (overridable by -z max-page-size)
767 0x10000, // common_pagesize (overridable by -z common-page-size)
768 false, // isolate_execinstr
770 elfcpp::SHN_UNDEF
, // small_common_shndx
771 elfcpp::SHN_UNDEF
, // large_common_shndx
772 0, // small_common_section_flags
773 0, // large_common_section_flags
774 NULL
, // attributes_section
775 NULL
, // attributes_vendor
776 "_start", // entry_symbol_name
777 32, // hash_entry_size
778 elfcpp::SHT_PROGBITS
, // unwind_section_type
781 // tilegx relocation handlers
782 template<int size
, bool big_endian
>
783 class Tilegx_relocate_functions
786 // overflow check will be supported later
789 STATUS_OKAY
, // No error during relocation.
790 STATUS_OVERFLOW
, // Relocation overflow.
791 STATUS_BAD_RELOC
// Relocation cannot be applied.
796 // right shift operand by this number of bits.
797 unsigned char srshift
;
799 // the offset to apply relocation.
800 unsigned char doffset
;
802 // set to 1 for pc-relative relocation.
803 unsigned char is_pcrel
;
805 // size in bits, or 0 if this table entry should be ignored.
808 // whether we need to check overflow.
809 unsigned char overflow
;
812 static const Tilegx_howto howto
[elfcpp::R_TILEGX_NUM
];
816 // Do a simple rela relocation
817 template<int valsize
>
819 rela(unsigned char* view
,
820 const Sized_relobj_file
<size
, big_endian
>* object
,
821 const Symbol_value
<size
>* psymval
,
822 typename
elfcpp::Swap
<size
, big_endian
>::Valtype addend
,
823 elfcpp::Elf_Xword srshift
, elfcpp::Elf_Xword doffset
,
824 elfcpp::Elf_Xword bitmask
)
826 typedef typename
elfcpp::Swap
<valsize
, big_endian
>::Valtype Valtype
;
827 Valtype
* wv
= reinterpret_cast<Valtype
*>(view
);
828 Valtype val
= elfcpp::Swap
<valsize
, big_endian
>::readval(wv
);
831 reloc
= Bits
<32>::sign_extend(psymval
->value(object
, addend
)) >> srshift
;
833 reloc
= psymval
->value(object
, addend
) >> srshift
;
835 elfcpp::Elf_Xword dst_mask
= bitmask
<< doffset
;
840 elfcpp::Swap
<valsize
, big_endian
>::writeval(wv
, val
| (reloc
<<doffset
));
843 // Do a simple rela relocation
844 template<int valsize
>
846 rela_ua(unsigned char* view
,
847 const Sized_relobj_file
<size
, big_endian
>* object
,
848 const Symbol_value
<size
>* psymval
,
849 typename
elfcpp::Swap
<size
, big_endian
>::Valtype addend
,
850 elfcpp::Elf_Xword srshift
, elfcpp::Elf_Xword doffset
,
851 elfcpp::Elf_Xword bitmask
)
853 typedef typename
elfcpp::Swap_unaligned
<valsize
, big_endian
>::Valtype
855 unsigned char* wv
= view
;
856 Valtype val
= elfcpp::Swap_unaligned
<valsize
, big_endian
>::readval(wv
);
859 reloc
= Bits
<32>::sign_extend(psymval
->value(object
, addend
)) >> srshift
;
861 reloc
= psymval
->value(object
, addend
) >> srshift
;
863 elfcpp::Elf_Xword dst_mask
= bitmask
<< doffset
;
868 elfcpp::Swap_unaligned
<valsize
, big_endian
>::writeval(wv
,
869 val
| (reloc
<<doffset
));
872 template<int valsize
>
874 rela(unsigned char* view
,
875 const Sized_relobj_file
<size
, big_endian
>* object
,
876 const Symbol_value
<size
>* psymval
,
877 typename
elfcpp::Swap
<size
, big_endian
>::Valtype addend
,
878 elfcpp::Elf_Xword srshift
, elfcpp::Elf_Xword doffset1
,
879 elfcpp::Elf_Xword bitmask1
, elfcpp::Elf_Xword doffset2
,
880 elfcpp::Elf_Xword bitmask2
)
882 typedef typename
elfcpp::Swap
<valsize
, big_endian
>::Valtype Valtype
;
883 Valtype
* wv
= reinterpret_cast<Valtype
*>(view
);
884 Valtype val
= elfcpp::Swap
<valsize
, big_endian
>::readval(wv
);
887 reloc
= Bits
<32>::sign_extend(psymval
->value(object
, addend
)) >> srshift
;
889 reloc
= psymval
->value(object
, addend
) >> srshift
;
891 elfcpp::Elf_Xword dst_mask
= (bitmask1
<< doffset1
)
892 | (bitmask2
<< doffset2
);
894 reloc
= ((reloc
& bitmask1
) << doffset1
)
895 | ((reloc
& bitmask2
) << doffset2
);
897 elfcpp::Swap
<valsize
, big_endian
>::writeval(wv
, val
| reloc
);
901 // Do a simple PC relative relocation with a Symbol_value with the
902 // addend in the relocation.
903 template<int valsize
>
905 pcrela(unsigned char* view
,
906 const Sized_relobj_file
<size
, big_endian
>* object
,
907 const Symbol_value
<size
>* psymval
,
908 typename
elfcpp::Swap
<size
, big_endian
>::Valtype addend
,
909 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
910 elfcpp::Elf_Xword srshift
, elfcpp::Elf_Xword doffset
,
911 elfcpp::Elf_Xword bitmask
)
914 typedef typename
elfcpp::Swap
<valsize
, big_endian
>::Valtype Valtype
;
915 Valtype
* wv
= reinterpret_cast<Valtype
*>(view
);
916 Valtype val
= elfcpp::Swap
<valsize
, big_endian
>::readval(wv
);
919 reloc
= Bits
<32>::sign_extend(psymval
->value(object
, addend
) - address
)
922 reloc
= (psymval
->value(object
, addend
) - address
) >> srshift
;
924 elfcpp::Elf_Xword dst_mask
= bitmask
<< doffset
;
928 elfcpp::Swap
<valsize
, big_endian
>::writeval(wv
, val
| (reloc
<<doffset
));
931 template<int valsize
>
933 pcrela_ua(unsigned char* view
,
934 const Sized_relobj_file
<size
, big_endian
>* object
,
935 const Symbol_value
<size
>* psymval
,
936 typename
elfcpp::Swap
<size
, big_endian
>::Valtype addend
,
937 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
938 elfcpp::Elf_Xword srshift
, elfcpp::Elf_Xword doffset
,
939 elfcpp::Elf_Xword bitmask
)
942 typedef typename
elfcpp::Swap_unaligned
<valsize
, big_endian
>::Valtype
944 unsigned char* wv
= view
;
947 reloc
= Bits
<32>::sign_extend(psymval
->value(object
, addend
) - address
)
950 reloc
= (psymval
->value(object
, addend
) - address
) >> srshift
;
954 elfcpp::Swap
<valsize
, big_endian
>::writeval(wv
, reloc
<< doffset
);
957 template<int valsize
>
959 pcrela(unsigned char* view
,
960 const Sized_relobj_file
<size
, big_endian
>* object
,
961 const Symbol_value
<size
>* psymval
,
962 typename
elfcpp::Swap
<size
, big_endian
>::Valtype addend
,
963 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
964 elfcpp::Elf_Xword srshift
, elfcpp::Elf_Xword doffset1
,
965 elfcpp::Elf_Xword bitmask1
, elfcpp::Elf_Xword doffset2
,
966 elfcpp::Elf_Xword bitmask2
)
969 typedef typename
elfcpp::Swap
<valsize
, big_endian
>::Valtype Valtype
;
970 Valtype
* wv
= reinterpret_cast<Valtype
*>(view
);
971 Valtype val
= elfcpp::Swap
<valsize
, big_endian
>::readval(wv
);
974 reloc
= Bits
<32>::sign_extend(psymval
->value(object
, addend
) - address
)
977 reloc
= (psymval
->value(object
, addend
) - address
) >> srshift
;
979 elfcpp::Elf_Xword dst_mask
= (bitmask1
<< doffset1
)
980 | (bitmask2
<< doffset2
);
982 reloc
= ((reloc
& bitmask1
) << doffset1
)
983 | ((reloc
& bitmask2
) << doffset2
);
985 elfcpp::Swap
<valsize
, big_endian
>::writeval(wv
, val
| reloc
);
988 typedef Tilegx_relocate_functions
<size
, big_endian
> This
;
989 typedef Relocate_functions
<size
, big_endian
> Base
;
994 abs64(unsigned char* view
,
995 const Sized_relobj_file
<size
, big_endian
>* object
,
996 const Symbol_value
<size
>* psymval
,
997 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
)
999 This::template rela_ua
<64>(view
, object
, psymval
, addend
, 0, 0,
1000 0xffffffffffffffffllu
);
1004 abs32(unsigned char* view
,
1005 const Sized_relobj_file
<size
, big_endian
>* object
,
1006 const Symbol_value
<size
>* psymval
,
1007 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
)
1009 This::template rela_ua
<32>(view
, object
, psymval
, addend
, 0, 0,
1014 abs16(unsigned char* view
,
1015 const Sized_relobj_file
<size
, big_endian
>* object
,
1016 const Symbol_value
<size
>* psymval
,
1017 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
)
1019 This::template rela_ua
<16>(view
, object
, psymval
, addend
, 0, 0,
1024 pc_abs64(unsigned char* view
,
1025 const Sized_relobj_file
<size
, big_endian
>* object
,
1026 const Symbol_value
<size
>* psymval
,
1027 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
,
1028 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
)
1030 This::template pcrela_ua
<64>(view
, object
, psymval
, addend
, address
, 0, 0,
1031 0xffffffffffffffffllu
);
1035 pc_abs32(unsigned char* view
,
1036 const Sized_relobj_file
<size
, big_endian
>* object
,
1037 const Symbol_value
<size
>* psymval
,
1038 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
,
1039 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
)
1041 This::template pcrela_ua
<32>(view
, object
, psymval
, addend
, address
, 0, 0,
1046 pc_abs16(unsigned char* view
,
1047 const Sized_relobj_file
<size
, big_endian
>* object
,
1048 const Symbol_value
<size
>* psymval
,
1049 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
,
1050 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
)
1052 This::template pcrela_ua
<16>(view
, object
, psymval
, addend
, address
, 0, 0,
1057 imm_x_general(unsigned char* view
,
1058 const Sized_relobj_file
<size
, big_endian
>* object
,
1059 const Symbol_value
<size
>* psymval
,
1060 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
,
1061 Tilegx_howto
&r_howto
)
1063 This::template rela
<64>(view
, object
, psymval
, addend
,
1064 (elfcpp::Elf_Xword
)(r_howto
.srshift
),
1065 (elfcpp::Elf_Xword
)(r_howto
.doffset
),
1066 (elfcpp::Elf_Xword
)((1 << r_howto
.bsize
) - 1));
1070 imm_x_pcrel_general(unsigned char* view
,
1071 const Sized_relobj_file
<size
, big_endian
>* object
,
1072 const Symbol_value
<size
>* psymval
,
1073 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
,
1074 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
1075 Tilegx_howto
&r_howto
)
1077 This::template pcrela
<64>(view
, object
, psymval
, addend
, address
,
1078 (elfcpp::Elf_Xword
)(r_howto
.srshift
),
1079 (elfcpp::Elf_Xword
)(r_howto
.doffset
),
1080 (elfcpp::Elf_Xword
)((1 << r_howto
.bsize
) - 1));
1084 imm_x_two_part_general(unsigned char* view
,
1085 const Sized_relobj_file
<size
, big_endian
>* object
,
1086 const Symbol_value
<size
>* psymval
,
1087 typename
elfcpp::Elf_types
<size
>::Elf_Addr addend
,
1088 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
1089 unsigned int r_type
)
1092 elfcpp::Elf_Xword doffset1
= 0llu;
1093 elfcpp::Elf_Xword doffset2
= 0llu;
1094 elfcpp::Elf_Xword dmask1
= 0llu;
1095 elfcpp::Elf_Xword dmask2
= 0llu;
1096 elfcpp::Elf_Xword rshift
= 0llu;
1097 unsigned int pc_rel
= 0;
1101 case elfcpp::R_TILEGX_BROFF_X1
:
1105 dmask2
= 0x1ffc0llu
;
1109 case elfcpp::R_TILEGX_DEST_IMM8_X1
:
1119 This::template pcrela
<64>(view
, object
, psymval
, addend
, address
,
1120 rshift
, doffset1
, dmask1
, doffset2
, dmask2
);
1122 This::template rela
<64>(view
, object
, psymval
, addend
, rshift
,
1123 doffset1
, dmask1
, doffset2
, dmask2
);
1128 tls_relax(unsigned char* view
, unsigned int r_type
,
1129 tls::Tls_optimization opt_t
)
1132 const uint64_t TILEGX_X_MOVE_R0_R0
= 0x283bf8005107f000llu
;
1133 const uint64_t TILEGX_Y_MOVE_R0_R0
= 0xae05f800540bf000llu
;
1134 const uint64_t TILEGX_X_LD
= 0x286ae80000000000llu
;
1135 const uint64_t TILEGX_X_LD4S
= 0x286a980000000000llu
;
1136 const uint64_t TILEGX_X1_FULL_MASK
= 0x3fffffff80000000llu
;
1137 const uint64_t TILEGX_X0_RRR_MASK
= 0x000000007ffc0000llu
;
1138 const uint64_t TILEGX_X1_RRR_MASK
= 0x3ffe000000000000llu
;
1139 const uint64_t TILEGX_Y0_RRR_MASK
= 0x00000000780c0000llu
;
1140 const uint64_t TILEGX_Y1_RRR_MASK
= 0x3c06000000000000llu
;
1141 const uint64_t TILEGX_X0_RRR_SRCB_MASK
= 0x000000007ffff000llu
;
1142 const uint64_t TILEGX_X1_RRR_SRCB_MASK
= 0x3ffff80000000000llu
;
1143 const uint64_t TILEGX_Y0_RRR_SRCB_MASK
= 0x00000000780ff000llu
;
1144 const uint64_t TILEGX_Y1_RRR_SRCB_MASK
= 0x3c07f80000000000llu
;
1145 const uint64_t TILEGX_X_ADD_R0_R0_TP
= 0x2807a800500f5000llu
;
1146 const uint64_t TILEGX_Y_ADD_R0_R0_TP
= 0x9a13a8002c275000llu
;
1147 const uint64_t TILEGX_X_ADDX_R0_R0_TP
= 0x2805a800500b5000llu
;
1148 const uint64_t TILEGX_Y_ADDX_R0_R0_TP
= 0x9a01a8002c035000llu
;
1150 const uint64_t R_TILEGX_IMM8_X0_TLS_ADD_MASK
=
1151 (TILEGX_X0_RRR_MASK
| (0x3Fllu
<< 12));
1153 const uint64_t R_TILEGX_IMM8_X1_TLS_ADD_MASK
=
1154 (TILEGX_X1_RRR_MASK
| (0x3Fllu
<< 43));
1156 const uint64_t R_TILEGX_IMM8_Y0_TLS_ADD_MASK
=
1157 (TILEGX_Y0_RRR_MASK
| (0x3Fllu
<< 12));
1159 const uint64_t R_TILEGX_IMM8_Y1_TLS_ADD_MASK
=
1160 (TILEGX_Y1_RRR_MASK
| (0x3Fllu
<< 43));
1162 const uint64_t R_TILEGX_IMM8_X0_TLS_ADD_LE_MASK
=
1163 (TILEGX_X0_RRR_SRCB_MASK
| (0x3Fllu
<< 6));
1165 const uint64_t R_TILEGX_IMM8_X1_TLS_ADD_LE_MASK
=
1166 (TILEGX_X1_RRR_SRCB_MASK
| (0x3Fllu
<< 37));
1168 const uint64_t R_TILEGX_IMM8_Y0_TLS_ADD_LE_MASK
=
1169 (TILEGX_Y0_RRR_SRCB_MASK
| (0x3Fllu
<< 6));
1171 const uint64_t R_TILEGX_IMM8_Y1_TLS_ADD_LE_MASK
=
1172 (TILEGX_Y1_RRR_SRCB_MASK
| (0x3Fllu
<< 37));
1174 typedef typename
elfcpp::Swap
<64, big_endian
>::Valtype Valtype
;
1175 Valtype
* wv
= reinterpret_cast<Valtype
*>(view
);
1176 Valtype val
= elfcpp::Swap
<64, big_endian
>::readval(wv
);
1181 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
1182 if (opt_t
== tls::TLSOPT_NONE
) {
1183 // GD/IE: 1. copy dest operand into the second source operand
1184 // 2. change the opcode to "add"
1185 reloc
= (val
& 0x3Fllu
) << 12; // featch the dest reg
1186 reloc
|= ((size
== 32
1187 ? TILEGX_X_ADDX_R0_R0_TP
1188 : TILEGX_X_ADD_R0_R0_TP
)
1189 & TILEGX_X0_RRR_MASK
); // change opcode
1190 val
&= ~R_TILEGX_IMM8_X0_TLS_ADD_MASK
;
1191 } else if (opt_t
== tls::TLSOPT_TO_LE
) {
1192 // LE: 1. copy dest operand into the first source operand
1193 // 2. change the opcode to "move"
1194 reloc
= (val
& 0x3Fllu
) << 6;
1195 reloc
|= (TILEGX_X_MOVE_R0_R0
& TILEGX_X0_RRR_SRCB_MASK
);
1196 val
&= ~R_TILEGX_IMM8_X0_TLS_ADD_LE_MASK
;
1200 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
1201 if (opt_t
== tls::TLSOPT_NONE
) {
1202 reloc
= (val
& (0x3Fllu
<< 31)) << 12;
1203 reloc
|= ((size
== 32
1204 ? TILEGX_X_ADDX_R0_R0_TP
1205 : TILEGX_X_ADD_R0_R0_TP
)
1206 & TILEGX_X1_RRR_MASK
);
1207 val
&= ~R_TILEGX_IMM8_X1_TLS_ADD_MASK
;
1208 } else if (opt_t
== tls::TLSOPT_TO_LE
) {
1209 reloc
= (val
& (0x3Fllu
<< 31)) << 6;
1210 reloc
|= (TILEGX_X_MOVE_R0_R0
& TILEGX_X1_RRR_SRCB_MASK
);
1211 val
&= ~R_TILEGX_IMM8_X1_TLS_ADD_LE_MASK
;
1215 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
1216 if (opt_t
== tls::TLSOPT_NONE
) {
1217 reloc
= (val
& 0x3Fllu
) << 12;
1218 reloc
|= ((size
== 32
1219 ? TILEGX_Y_ADDX_R0_R0_TP
1220 : TILEGX_Y_ADD_R0_R0_TP
)
1221 & TILEGX_Y0_RRR_MASK
);
1222 val
&= ~R_TILEGX_IMM8_Y0_TLS_ADD_MASK
;
1223 } else if (opt_t
== tls::TLSOPT_TO_LE
) {
1224 reloc
= (val
& 0x3Fllu
) << 6;
1225 reloc
|= (TILEGX_Y_MOVE_R0_R0
& TILEGX_Y0_RRR_SRCB_MASK
);
1226 val
&= ~R_TILEGX_IMM8_Y0_TLS_ADD_LE_MASK
;
1230 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
1231 if (opt_t
== tls::TLSOPT_NONE
) {
1232 reloc
= (val
& (0x3Fllu
<< 31)) << 12;
1233 reloc
|= ((size
== 32
1234 ? TILEGX_Y_ADDX_R0_R0_TP
1235 : TILEGX_Y_ADD_R0_R0_TP
)
1236 & TILEGX_Y1_RRR_MASK
);
1237 val
&= ~R_TILEGX_IMM8_Y1_TLS_ADD_MASK
;
1238 } else if (opt_t
== tls::TLSOPT_TO_LE
) {
1239 reloc
= (val
& (0x3Fllu
<< 31)) << 6;
1240 reloc
|= (TILEGX_Y_MOVE_R0_R0
& TILEGX_Y1_RRR_SRCB_MASK
);
1241 val
&= ~R_TILEGX_IMM8_Y1_TLS_ADD_LE_MASK
;
1245 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
1246 if (opt_t
== tls::TLSOPT_NONE
) {
1247 // GD see comments for optimize_tls_reloc
1248 reloc
= TILEGX_X_MOVE_R0_R0
& TILEGX_X0_RRR_SRCB_MASK
;
1249 val
&= ~TILEGX_X0_RRR_SRCB_MASK
;
1250 } else if (opt_t
== tls::TLSOPT_TO_IE
1251 || opt_t
== tls::TLSOPT_TO_LE
) {
1254 ? TILEGX_X_ADDX_R0_R0_TP
1255 : TILEGX_X_ADD_R0_R0_TP
)
1256 & TILEGX_X0_RRR_SRCB_MASK
;
1257 val
&= ~TILEGX_X0_RRR_SRCB_MASK
;
1260 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
1261 if (opt_t
== tls::TLSOPT_NONE
) {
1262 reloc
= TILEGX_X_MOVE_R0_R0
& TILEGX_X1_RRR_SRCB_MASK
;
1263 val
&= ~TILEGX_X1_RRR_SRCB_MASK
;
1264 } else if (opt_t
== tls::TLSOPT_TO_IE
1265 || opt_t
== tls::TLSOPT_TO_LE
) {
1267 ? TILEGX_X_ADDX_R0_R0_TP
1268 : TILEGX_X_ADD_R0_R0_TP
)
1269 & TILEGX_X1_RRR_SRCB_MASK
;
1270 val
&= ~TILEGX_X1_RRR_SRCB_MASK
;
1273 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
1274 if (opt_t
== tls::TLSOPT_NONE
) {
1275 reloc
= TILEGX_Y_MOVE_R0_R0
& TILEGX_Y0_RRR_SRCB_MASK
;
1276 val
&= ~TILEGX_Y0_RRR_SRCB_MASK
;
1277 } else if (opt_t
== tls::TLSOPT_TO_IE
1278 || opt_t
== tls::TLSOPT_TO_LE
) {
1280 ? TILEGX_Y_ADDX_R0_R0_TP
1281 : TILEGX_Y_ADD_R0_R0_TP
)
1282 & TILEGX_Y0_RRR_SRCB_MASK
;
1283 val
&= ~TILEGX_Y0_RRR_SRCB_MASK
;
1286 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
1287 if (opt_t
== tls::TLSOPT_NONE
) {
1288 reloc
= TILEGX_Y_MOVE_R0_R0
& TILEGX_Y1_RRR_SRCB_MASK
;
1289 val
&= ~TILEGX_Y1_RRR_SRCB_MASK
;
1290 } else if (opt_t
== tls::TLSOPT_TO_IE
1291 || opt_t
== tls::TLSOPT_TO_LE
) {
1293 ? TILEGX_Y_ADDX_R0_R0_TP
1294 : TILEGX_Y_ADD_R0_R0_TP
)
1295 & TILEGX_Y1_RRR_SRCB_MASK
;
1296 val
&= ~TILEGX_Y1_RRR_SRCB_MASK
;
1299 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
1300 if (opt_t
== tls::TLSOPT_NONE
) {
1305 & TILEGX_X1_RRR_SRCB_MASK
;
1306 val
&= ~TILEGX_X1_RRR_SRCB_MASK
;
1307 } else if (opt_t
== tls::TLSOPT_TO_LE
) {
1309 reloc
= TILEGX_X_MOVE_R0_R0
& TILEGX_X1_RRR_SRCB_MASK
;
1310 val
&= ~TILEGX_X1_RRR_SRCB_MASK
;
1314 case elfcpp::R_TILEGX_TLS_GD_CALL
:
1315 if (opt_t
== tls::TLSOPT_TO_IE
) {
1319 : TILEGX_X_LD
) & TILEGX_X1_FULL_MASK
;
1320 val
&= ~TILEGX_X1_FULL_MASK
;
1321 } else if (opt_t
== tls::TLSOPT_TO_LE
) {
1323 reloc
= TILEGX_X_MOVE_R0_R0
& TILEGX_X1_FULL_MASK
;
1324 val
&= ~TILEGX_X1_FULL_MASK
;
1326 // should be handled in ::relocate
1333 elfcpp::Swap
<64, big_endian
>::writeval(wv
, val
| reloc
);
1338 const Tilegx_relocate_functions
<64, false>::Tilegx_howto
1339 Tilegx_relocate_functions
<64, false>::howto
[elfcpp::R_TILEGX_NUM
] =
1341 { 0, 0, 0, 0, 0}, // R_TILEGX_NONE
1342 { 0, 0, 0, 64, 0}, // R_TILEGX_64
1343 { 0, 0, 0, 32, 0}, // R_TILEGX_32
1344 { 0, 0, 0, 16, 0}, // R_TILEGX_16
1345 { 0, 0, 0, 8, 0}, // R_TILEGX_8
1346 { 0, 0, 1, 64, 0}, // R_TILEGX_64_PCREL
1347 { 0, 0, 1, 32, 0}, // R_TILEGX_32_PCREL
1348 { 0, 0, 1, 16, 0}, // R_TILEGX_16_PCREL
1349 { 0, 0, 1, 8, 0}, // R_TILEGX_8_PCREL
1350 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0
1351 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1
1352 { 32, 0, 0, 0, 0}, // R_TILEGX_HW2
1353 { 48, 0, 0, 0, 0}, // R_TILEGX_HW3
1354 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0_LAST
1355 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1_LAST
1356 { 32, 0, 0, 0, 0}, // R_TILEGX_HW2_LAST
1357 { 0, 0, 0, 0, 0}, // R_TILEGX_COPY
1358 { 0, 0, 0, 8, 0}, // R_TILEGX_GLOB_DAT
1359 { 0, 0, 0, 0, 0}, // R_TILEGX_JMP_SLOT
1360 { 0, 0, 0, 0, 0}, // R_TILEGX_RELATIVE
1361 { 3, 1, 1, 0, 0}, // R_TILEGX_BROFF_X1
1362 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1
1363 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1_PLT
1364 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X0
1365 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y0
1366 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X1
1367 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y1
1368 { 0, 1, 0, 8, 0}, // R_TILEGX_DEST_IMM8_X1
1369 { 0, 1, 0, 8, 0}, // R_TILEGX_MT_IMM14_X1
1370 { 0, 1, 0, 8, 0}, // R_TILEGX_MF_IMM14_X1
1371 { 0, 1, 0, 8, 0}, // R_TILEGX_MMSTART_X0
1372 { 0, 1, 0, 8, 0}, // R_TILEGX_MMEND_X0
1373 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X0
1374 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X1
1375 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y0
1376 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y1
1377 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0
1378 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0
1379 { 16, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW1
1380 { 16, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW1
1381 { 32, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW2
1382 { 32, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW2
1383 { 48, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW3
1384 { 48, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW3
1385 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST
1386 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST
1387 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST
1388 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST
1389 { 32, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST
1390 { 32, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST
1391 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PCREL
1392 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PCREL
1393 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PCREL
1394 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PCREL
1395 { 32, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PCREL
1396 { 32, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PCREL
1397 { 48, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW3_PCREL
1398 { 48, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW3_PCREL
1399 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PCREL
1400 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PCREL
1401 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PCREL
1402 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PCREL
1403 { 32, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PCREL
1404 { 32, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PCREL
1405 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_GOT
1406 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_GOT
1407 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PLT_PCREL
1408 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PLT_PCREL
1409 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PLT_PCREL
1410 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PLT_PCREL
1411 { 32, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PLT_PCREL
1412 { 32, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PLT_PCREL
1413 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_GOT
1414 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_GOT
1415 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_GOT
1416 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_GOT
1417 { 32, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_GOT
1418 { 32, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_GOT
1419 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_GD
1420 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_GD
1421 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_LE
1422 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_LE
1423 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
1424 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
1425 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
1426 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
1427 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
1428 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
1429 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
1430 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
1431 { 0, 0, 0, 0, 0}, // R_TILEGX_IRELATIVE
1432 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1433 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_IE
1434 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_IE
1435 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
1436 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
1437 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
1438 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
1439 { 32, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
1440 { 32, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
1441 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
1442 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
1443 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
1444 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
1445 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1446 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1447 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD64
1448 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF64
1449 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF64
1450 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD32
1451 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF32
1452 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF32
1453 { 3, 31, 1, 27, 0}, // R_TILEGX_TLS_GD_CALL
1454 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_GD_ADD
1455 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_GD_ADD
1456 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_GD_ADD
1457 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_GD_ADD
1458 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_IE_LOAD
1459 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_ADD
1460 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_ADD
1461 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_ADD
1462 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_ADD
1463 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTINHERIT
1464 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTENTRY
1468 const Tilegx_relocate_functions
<32, false>::Tilegx_howto
1469 Tilegx_relocate_functions
<32, false>::howto
[elfcpp::R_TILEGX_NUM
] =
1471 { 0, 0, 0, 0, 0}, // R_TILEGX_NONE
1472 { 0, 0, 0, 64, 0}, // R_TILEGX_64
1473 { 0, 0, 0, 32, 0}, // R_TILEGX_32
1474 { 0, 0, 0, 16, 0}, // R_TILEGX_16
1475 { 0, 0, 0, 8, 0}, // R_TILEGX_8
1476 { 0, 0, 1, 64, 0}, // R_TILEGX_64_PCREL
1477 { 0, 0, 1, 32, 0}, // R_TILEGX_32_PCREL
1478 { 0, 0, 1, 16, 0}, // R_TILEGX_16_PCREL
1479 { 0, 0, 1, 8, 0}, // R_TILEGX_8_PCREL
1480 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0
1481 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1
1482 { 31, 0, 0, 0, 0}, // R_TILEGX_HW2
1483 { 31, 0, 0, 0, 0}, // R_TILEGX_HW3
1484 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0_LAST
1485 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1_LAST
1486 { 31, 0, 0, 0, 0}, // R_TILEGX_HW2_LAST
1487 { 0, 0, 0, 0, 0}, // R_TILEGX_COPY
1488 { 0, 0, 0, 8, 0}, // R_TILEGX_GLOB_DAT
1489 { 0, 0, 0, 0, 0}, // R_TILEGX_JMP_SLOT
1490 { 0, 0, 0, 0, 0}, // R_TILEGX_RELATIVE
1491 { 3, 1, 1, 0, 0}, // R_TILEGX_BROFF_X1
1492 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1
1493 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1_PLT
1494 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X0
1495 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y0
1496 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X1
1497 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y1
1498 { 0, 1, 0, 8, 0}, // R_TILEGX_DEST_IMM8_X1
1499 { 0, 1, 0, 8, 0}, // R_TILEGX_MT_IMM14_X1
1500 { 0, 1, 0, 8, 0}, // R_TILEGX_MF_IMM14_X1
1501 { 0, 1, 0, 8, 0}, // R_TILEGX_MMSTART_X0
1502 { 0, 1, 0, 8, 0}, // R_TILEGX_MMEND_X0
1503 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X0
1504 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X1
1505 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y0
1506 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y1
1507 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0
1508 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0
1509 { 16, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW1
1510 { 16, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW1
1511 { 31, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW2
1512 { 31, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW2
1513 { 31, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW3
1514 { 31, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW3
1515 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST
1516 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST
1517 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST
1518 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST
1519 { 31, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST
1520 { 31, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST
1521 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PCREL
1522 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PCREL
1523 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PCREL
1524 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PCREL
1525 { 31, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PCREL
1526 { 31, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PCREL
1527 { 31, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW3_PCREL
1528 { 31, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW3_PCREL
1529 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PCREL
1530 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PCREL
1531 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PCREL
1532 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PCREL
1533 { 31, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PCREL
1534 { 31, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PCREL
1535 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_GOT
1536 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_GOT
1537 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PLT_PCREL
1538 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PLT_PCREL
1539 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PLT_PCREL
1540 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PLT_PCREL
1541 { 31, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PLT_PCREL
1542 { 31, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PLT_PCREL
1543 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_GOT
1544 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_GOT
1545 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_GOT
1546 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_GOT
1547 { 31, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_GOT
1548 { 31, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_GOT
1549 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_GD
1550 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_GD
1551 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_LE
1552 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_LE
1553 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
1554 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
1555 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
1556 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
1557 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
1558 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
1559 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
1560 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
1561 { 0, 0, 0, 0, 0}, // R_TILEGX_IRELATIVE
1562 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1563 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_IE
1564 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_IE
1565 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
1566 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
1567 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
1568 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
1569 { 31, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
1570 { 31, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
1571 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
1572 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
1573 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
1574 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
1575 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1576 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1577 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD64
1578 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF64
1579 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF64
1580 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD32
1581 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF32
1582 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF32
1583 { 3, 31, 1, 27, 0}, // R_TILEGX_TLS_GD_CALL
1584 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_GD_ADD
1585 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_GD_ADD
1586 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_GD_ADD
1587 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_GD_ADD
1588 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_IE_LOAD
1589 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_ADD
1590 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_ADD
1591 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_ADD
1592 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_ADD
1593 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTINHERIT
1594 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTENTRY
1598 const Tilegx_relocate_functions
<64, true>::Tilegx_howto
1599 Tilegx_relocate_functions
<64, true>::howto
[elfcpp::R_TILEGX_NUM
] =
1601 { 0, 0, 0, 0, 0}, // R_TILEGX_NONE
1602 { 0, 0, 0, 64, 0}, // R_TILEGX_64
1603 { 0, 0, 0, 32, 0}, // R_TILEGX_32
1604 { 0, 0, 0, 16, 0}, // R_TILEGX_16
1605 { 0, 0, 0, 8, 0}, // R_TILEGX_8
1606 { 0, 0, 1, 64, 0}, // R_TILEGX_64_PCREL
1607 { 0, 0, 1, 32, 0}, // R_TILEGX_32_PCREL
1608 { 0, 0, 1, 16, 0}, // R_TILEGX_16_PCREL
1609 { 0, 0, 1, 8, 0}, // R_TILEGX_8_PCREL
1610 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0
1611 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1
1612 { 32, 0, 0, 0, 0}, // R_TILEGX_HW2
1613 { 48, 0, 0, 0, 0}, // R_TILEGX_HW3
1614 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0_LAST
1615 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1_LAST
1616 { 32, 0, 0, 0, 0}, // R_TILEGX_HW2_LAST
1617 { 0, 0, 0, 0, 0}, // R_TILEGX_COPY
1618 { 0, 0, 0, 8, 0}, // R_TILEGX_GLOB_DAT
1619 { 0, 0, 0, 0, 0}, // R_TILEGX_JMP_SLOT
1620 { 0, 0, 0, 0, 0}, // R_TILEGX_RELATIVE
1621 { 3, 1, 1, 0, 0}, // R_TILEGX_BROFF_X1
1622 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1
1623 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1_PLT
1624 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X0
1625 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y0
1626 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X1
1627 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y1
1628 { 0, 1, 0, 8, 0}, // R_TILEGX_DEST_IMM8_X1
1629 { 0, 1, 0, 8, 0}, // R_TILEGX_MT_IMM14_X1
1630 { 0, 1, 0, 8, 0}, // R_TILEGX_MF_IMM14_X1
1631 { 0, 1, 0, 8, 0}, // R_TILEGX_MMSTART_X0
1632 { 0, 1, 0, 8, 0}, // R_TILEGX_MMEND_X0
1633 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X0
1634 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X1
1635 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y0
1636 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y1
1637 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0
1638 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0
1639 { 16, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW1
1640 { 16, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW1
1641 { 32, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW2
1642 { 32, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW2
1643 { 48, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW3
1644 { 48, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW3
1645 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST
1646 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST
1647 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST
1648 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST
1649 { 32, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST
1650 { 32, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST
1651 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PCREL
1652 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PCREL
1653 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PCREL
1654 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PCREL
1655 { 32, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PCREL
1656 { 32, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PCREL
1657 { 48, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW3_PCREL
1658 { 48, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW3_PCREL
1659 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PCREL
1660 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PCREL
1661 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PCREL
1662 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PCREL
1663 { 32, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PCREL
1664 { 32, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PCREL
1665 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_GOT
1666 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_GOT
1667 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PLT_PCREL
1668 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PLT_PCREL
1669 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PLT_PCREL
1670 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PLT_PCREL
1671 { 32, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PLT_PCREL
1672 { 32, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PLT_PCREL
1673 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_GOT
1674 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_GOT
1675 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_GOT
1676 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_GOT
1677 { 32, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_GOT
1678 { 32, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_GOT
1679 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_GD
1680 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_GD
1681 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_LE
1682 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_LE
1683 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
1684 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
1685 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
1686 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
1687 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
1688 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
1689 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
1690 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
1691 { 0, 0, 0, 0, 0}, // R_TILEGX_IRELATIVE
1692 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1693 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_IE
1694 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_IE
1695 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
1696 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
1697 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
1698 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
1699 { 32, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
1700 { 32, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
1701 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
1702 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
1703 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
1704 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
1705 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1706 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1707 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD64
1708 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF64
1709 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF64
1710 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD32
1711 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF32
1712 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF32
1713 { 3, 31, 1, 27, 0}, // R_TILEGX_TLS_GD_CALL
1714 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_GD_ADD
1715 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_GD_ADD
1716 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_GD_ADD
1717 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_GD_ADD
1718 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_IE_LOAD
1719 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_ADD
1720 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_ADD
1721 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_ADD
1722 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_ADD
1723 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTINHERIT
1724 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTENTRY
1728 const Tilegx_relocate_functions
<32, true>::Tilegx_howto
1729 Tilegx_relocate_functions
<32, true>::howto
[elfcpp::R_TILEGX_NUM
] =
1731 { 0, 0, 0, 0, 0}, // R_TILEGX_NONE
1732 { 0, 0, 0, 64, 0}, // R_TILEGX_64
1733 { 0, 0, 0, 32, 0}, // R_TILEGX_32
1734 { 0, 0, 0, 16, 0}, // R_TILEGX_16
1735 { 0, 0, 0, 8, 0}, // R_TILEGX_8
1736 { 0, 0, 1, 64, 0}, // R_TILEGX_64_PCREL
1737 { 0, 0, 1, 32, 0}, // R_TILEGX_32_PCREL
1738 { 0, 0, 1, 16, 0}, // R_TILEGX_16_PCREL
1739 { 0, 0, 1, 8, 0}, // R_TILEGX_8_PCREL
1740 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0
1741 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1
1742 { 31, 0, 0, 0, 0}, // R_TILEGX_HW2
1743 { 31, 0, 0, 0, 0}, // R_TILEGX_HW3
1744 { 0, 0, 0, 0, 0}, // R_TILEGX_HW0_LAST
1745 { 16, 0, 0, 0, 0}, // R_TILEGX_HW1_LAST
1746 { 31, 0, 0, 0, 0}, // R_TILEGX_HW2_LAST
1747 { 0, 0, 0, 0, 0}, // R_TILEGX_COPY
1748 { 0, 0, 0, 8, 0}, // R_TILEGX_GLOB_DAT
1749 { 0, 0, 0, 0, 0}, // R_TILEGX_JMP_SLOT
1750 { 0, 0, 0, 0, 0}, // R_TILEGX_RELATIVE
1751 { 3, 1, 1, 0, 0}, // R_TILEGX_BROFF_X1
1752 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1
1753 { 3, 31, 1, 27, 0}, // R_TILEGX_JUMPOFF_X1_PLT
1754 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X0
1755 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y0
1756 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_X1
1757 { 0, 1, 0, 8, 0}, // R_TILEGX_IMM8_Y1
1758 { 0, 1, 0, 8, 0}, // R_TILEGX_DEST_IMM8_X1
1759 { 0, 1, 0, 8, 0}, // R_TILEGX_MT_IMM14_X1
1760 { 0, 1, 0, 8, 0}, // R_TILEGX_MF_IMM14_X1
1761 { 0, 1, 0, 8, 0}, // R_TILEGX_MMSTART_X0
1762 { 0, 1, 0, 8, 0}, // R_TILEGX_MMEND_X0
1763 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X0
1764 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_X1
1765 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y0
1766 { 0, 1, 0, 8, 0}, // R_TILEGX_SHAMT_Y1
1767 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0
1768 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0
1769 { 16, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW1
1770 { 16, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW1
1771 { 31, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW2
1772 { 31, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW2
1773 { 31, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW3
1774 { 31, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW3
1775 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST
1776 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST
1777 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST
1778 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST
1779 { 31, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST
1780 { 31, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST
1781 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PCREL
1782 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PCREL
1783 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PCREL
1784 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PCREL
1785 { 31, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PCREL
1786 { 31, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PCREL
1787 { 31, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW3_PCREL
1788 { 31, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW3_PCREL
1789 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PCREL
1790 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PCREL
1791 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PCREL
1792 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PCREL
1793 { 31, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PCREL
1794 { 31, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PCREL
1795 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_GOT
1796 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_GOT
1797 { 0, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW0_PLT_PCREL
1798 { 0, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW0_PLT_PCREL
1799 { 16, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW1_PLT_PCREL
1800 { 16, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW1_PLT_PCREL
1801 { 31, 12, 1, 16, 0}, // R_TILEGX_IMM16_X0_HW2_PLT_PCREL
1802 { 31, 43, 1, 16, 0}, // R_TILEGX_IMM16_X1_HW2_PLT_PCREL
1803 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_GOT
1804 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_GOT
1805 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_GOT
1806 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_GOT
1807 { 31, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_GOT
1808 { 31, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_GOT
1809 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_GD
1810 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_GD
1811 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_LE
1812 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_LE
1813 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
1814 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
1815 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
1816 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
1817 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
1818 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
1819 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
1820 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
1821 { 0, 0, 0, 0, 0}, // R_TILEGX_IRELATIVE
1822 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1823 { 0, 12, 0, 16, 0}, // R_TILEGX_IMM16_X0_HW0_TLS_IE
1824 { 0, 43, 0, 16, 0}, // R_TILEGX_IMM16_X1_HW0_TLS_IE
1825 { 0, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
1826 { 0, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
1827 { 16, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
1828 { 16, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
1829 { 31, 12, 1, 16, 1}, // R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
1830 { 31, 43, 1, 16, 1}, // R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
1831 { 0, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
1832 { 0, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
1833 { 16, 12, 0, 16, 1}, // R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
1834 { 16, 43, 0, 16, 1}, // R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
1835 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1836 { 0, 0, 0, 0, 0}, // R_TILEGX_INVALID
1837 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD64
1838 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF64
1839 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF64
1840 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPMOD32
1841 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_DTPOFF32
1842 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_TPOFF32
1843 { 3, 31, 1, 27, 0}, // R_TILEGX_TLS_GD_CALL
1844 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_GD_ADD
1845 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_GD_ADD
1846 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_GD_ADD
1847 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_GD_ADD
1848 { 0, 0, 0, 0, 0}, // R_TILEGX_TLS_IE_LOAD
1849 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X0_TLS_ADD
1850 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_X1_TLS_ADD
1851 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y0_TLS_ADD
1852 { 0, 0, 0, 0, 0}, // R_TILEGX_IMM8_Y1_TLS_ADD
1853 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTINHERIT
1854 { 0, 0, 0, 0, 0}, // R_TILEGX_GNU_VTENTRY
1857 // Get the GOT section, creating it if necessary.
1859 template<int size
, bool big_endian
>
1860 Output_data_got
<size
, big_endian
>*
1861 Target_tilegx
<size
, big_endian
>::got_section(Symbol_table
* symtab
,
1864 if (this->got_
== NULL
)
1866 gold_assert(symtab
!= NULL
&& layout
!= NULL
);
1868 // When using -z now, we can treat .got.plt as a relro section.
1869 // Without -z now, it is modified after program startup by lazy
1871 bool is_got_plt_relro
= parameters
->options().now();
1872 Output_section_order got_order
= (is_got_plt_relro
1874 : ORDER_RELRO_LAST
);
1875 Output_section_order got_plt_order
= (is_got_plt_relro
1877 : ORDER_NON_RELRO_FIRST
);
1879 this->got_
= new Output_data_got
<size
, big_endian
>();
1881 layout
->add_output_section_data(".got", elfcpp::SHT_PROGBITS
,
1883 | elfcpp::SHF_WRITE
),
1884 this->got_
, got_order
, true);
1886 // Define _GLOBAL_OFFSET_TABLE_ at the start of the PLT.
1887 this->global_offset_table_
=
1888 symtab
->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL
,
1889 Symbol_table::PREDEFINED
,
1891 0, 0, elfcpp::STT_OBJECT
,
1893 elfcpp::STV_HIDDEN
, 0,
1896 if (parameters
->options().shared()) {
1897 // we need to keep the address of .dynamic section in the
1898 // first got entry for .so
1899 this->tilegx_dynamic_
=
1900 symtab
->define_in_output_data("_TILEGX_DYNAMIC_", NULL
,
1901 Symbol_table::PREDEFINED
,
1902 layout
->dynamic_section(),
1903 0, 0, elfcpp::STT_OBJECT
,
1905 elfcpp::STV_HIDDEN
, 0,
1908 this->got_
->add_global(this->tilegx_dynamic_
, GOT_TYPE_STANDARD
);
1910 // for executable, just set the first entry to zero.
1911 this->got_
->set_current_data_size(size
/ 8);
1913 this->got_plt_
= new Output_data_space(size
/ 8, "** GOT PLT");
1914 layout
->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS
,
1916 | elfcpp::SHF_WRITE
),
1917 this->got_plt_
, got_plt_order
,
1920 // The first two entries are reserved.
1921 this->got_plt_
->set_current_data_size
1922 (TILEGX_GOTPLT_RESERVE_COUNT
* (size
/ 8));
1924 if (!is_got_plt_relro
)
1926 // Those bytes can go into the relro segment.
1927 layout
->increase_relro(size
/ 8);
1931 // If there are any IRELATIVE relocations, they get GOT entries
1932 // in .got.plt after the jump slot entries.
1933 this->got_irelative_
1934 = new Output_data_space(size
/ 8, "** GOT IRELATIVE PLT");
1935 layout
->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS
,
1937 | elfcpp::SHF_WRITE
),
1938 this->got_irelative_
,
1939 got_plt_order
, is_got_plt_relro
);
1945 // Get the dynamic reloc section, creating it if necessary.
1947 template<int size
, bool big_endian
>
1948 typename Target_tilegx
<size
, big_endian
>::Reloc_section
*
1949 Target_tilegx
<size
, big_endian
>::rela_dyn_section(Layout
* layout
)
1951 if (this->rela_dyn_
== NULL
)
1953 gold_assert(layout
!= NULL
);
1954 this->rela_dyn_
= new Reloc_section(parameters
->options().combreloc());
1955 layout
->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA
,
1956 elfcpp::SHF_ALLOC
, this->rela_dyn_
,
1957 ORDER_DYNAMIC_RELOCS
, false);
1959 return this->rela_dyn_
;
1962 // Get the section to use for IRELATIVE relocs, creating it if
1963 // necessary. These go in .rela.dyn, but only after all other dynamic
1964 // relocations. They need to follow the other dynamic relocations so
1965 // that they can refer to global variables initialized by those
1968 template<int size
, bool big_endian
>
1969 typename Target_tilegx
<size
, big_endian
>::Reloc_section
*
1970 Target_tilegx
<size
, big_endian
>::rela_irelative_section(Layout
* layout
)
1972 if (this->rela_irelative_
== NULL
)
1974 // Make sure we have already created the dynamic reloc section.
1975 this->rela_dyn_section(layout
);
1976 this->rela_irelative_
= new Reloc_section(false);
1977 layout
->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA
,
1978 elfcpp::SHF_ALLOC
, this->rela_irelative_
,
1979 ORDER_DYNAMIC_RELOCS
, false);
1980 gold_assert(this->rela_dyn_
->output_section()
1981 == this->rela_irelative_
->output_section());
1983 return this->rela_irelative_
;
1986 // Initialize the PLT section.
1988 template<int size
, bool big_endian
>
1990 Output_data_plt_tilegx
<size
, big_endian
>::init(Layout
* layout
)
1992 this->rel_
= new Reloc_section(false);
1993 layout
->add_output_section_data(".rela.plt", elfcpp::SHT_RELA
,
1994 elfcpp::SHF_ALLOC
, this->rel_
,
1995 ORDER_DYNAMIC_PLT_RELOCS
, false);
1998 template<int size
, bool big_endian
>
2000 Output_data_plt_tilegx
<size
, big_endian
>::do_adjust_output_section(
2003 os
->set_entsize(this->get_plt_entry_size());
2006 // Add an entry to the PLT.
2008 template<int size
, bool big_endian
>
2010 Output_data_plt_tilegx
<size
, big_endian
>::add_entry(Symbol_table
* symtab
,
2011 Layout
* layout
, Symbol
* gsym
)
2013 gold_assert(!gsym
->has_plt_offset());
2015 unsigned int plt_index
;
2017 section_offset_type got_offset
;
2019 unsigned int* pcount
;
2020 unsigned int reserved
;
2021 Output_data_space
* got
;
2022 if (gsym
->type() == elfcpp::STT_GNU_IFUNC
2023 && gsym
->can_use_relative_reloc(false))
2025 pcount
= &this->irelative_count_
;
2027 got
= this->got_irelative_
;
2031 pcount
= &this->count_
;
2032 reserved
= TILEGX_GOTPLT_RESERVE_COUNT
;
2033 got
= this->got_plt_
;
2036 if (!this->is_data_size_valid())
2038 plt_index
= *pcount
;
2040 // TILEGX .plt section layout
2050 // TILEGX .got.plt section layout
2057 // entries for normal function
2061 // entries for ifunc
2065 if (got
== this->got_irelative_
)
2066 plt_offset
= plt_index
* this->get_plt_entry_size();
2068 plt_offset
= (plt_index
+ 1) * this->get_plt_entry_size();
2072 got_offset
= (plt_index
+ reserved
) * (size
/ 8);
2073 gold_assert(got_offset
== got
->current_data_size());
2075 // Every PLT entry needs a GOT entry which points back to the PLT
2076 // entry (this will be changed by the dynamic linker, normally
2077 // lazily when the function is called).
2078 got
->set_current_data_size(got_offset
+ size
/ 8);
2082 // FIXME: This is probably not correct for IRELATIVE relocs.
2084 // For incremental updates, find an available slot.
2085 plt_offset
= this->free_list_
.allocate(this->get_plt_entry_size(),
2086 this->get_plt_entry_size(), 0);
2087 if (plt_offset
== -1)
2088 gold_fallback(_("out of patch space (PLT);"
2089 " relink with --incremental-full"));
2091 // The GOT and PLT entries have a 1-1 correspondance, so the GOT offset
2092 // can be calculated from the PLT index, adjusting for the three
2093 // reserved entries at the beginning of the GOT.
2094 plt_index
= plt_offset
/ this->get_plt_entry_size() - 1;
2095 got_offset
= (plt_index
+ reserved
) * (size
/ 8);
2098 gsym
->set_plt_offset(plt_offset
);
2100 // Every PLT entry needs a reloc.
2101 this->add_relocation(symtab
, layout
, gsym
, got_offset
);
2103 // Note that we don't need to save the symbol. The contents of the
2104 // PLT are independent of which symbols are used. The symbols only
2105 // appear in the relocations.
2108 // Add an entry to the PLT for a local STT_GNU_IFUNC symbol. Return
2111 template<int size
, bool big_endian
>
2113 Output_data_plt_tilegx
<size
, big_endian
>::add_local_ifunc_entry(
2114 Symbol_table
* symtab
,
2116 Sized_relobj_file
<size
, big_endian
>* relobj
,
2117 unsigned int local_sym_index
)
2119 unsigned int plt_offset
=
2120 this->irelative_count_
* this->get_plt_entry_size();
2121 ++this->irelative_count_
;
2123 section_offset_type got_offset
= this->got_irelative_
->current_data_size();
2125 // Every PLT entry needs a GOT entry which points back to the PLT
2127 this->got_irelative_
->set_current_data_size(got_offset
+ size
/ 8);
2129 // Every PLT entry needs a reloc.
2130 Reloc_section
* rela
= this->rela_irelative(symtab
, layout
);
2131 rela
->add_symbolless_local_addend(relobj
, local_sym_index
,
2132 elfcpp::R_TILEGX_IRELATIVE
,
2133 this->got_irelative_
, got_offset
, 0);
2138 // Add the relocation for a PLT entry.
2140 template<int size
, bool big_endian
>
2142 Output_data_plt_tilegx
<size
, big_endian
>::add_relocation(Symbol_table
* symtab
,
2145 unsigned int got_offset
)
2147 if (gsym
->type() == elfcpp::STT_GNU_IFUNC
2148 && gsym
->can_use_relative_reloc(false))
2150 Reloc_section
* rela
= this->rela_irelative(symtab
, layout
);
2151 rela
->add_symbolless_global_addend(gsym
, elfcpp::R_TILEGX_IRELATIVE
,
2152 this->got_irelative_
, got_offset
, 0);
2156 gsym
->set_needs_dynsym_entry();
2157 this->rel_
->add_global(gsym
, elfcpp::R_TILEGX_JMP_SLOT
, this->got_plt_
,
2162 // Return where the IRELATIVE relocations should go in the PLT. These
2163 // follow the JUMP_SLOT and the TLSDESC relocations.
2165 template<int size
, bool big_endian
>
2166 typename Output_data_plt_tilegx
<size
, big_endian
>::Reloc_section
*
2167 Output_data_plt_tilegx
<size
, big_endian
>::rela_irelative(Symbol_table
* symtab
,
2170 if (this->irelative_rel_
== NULL
)
2172 // case we see any later on.
2173 this->irelative_rel_
= new Reloc_section(false);
2174 layout
->add_output_section_data(".rela.plt", elfcpp::SHT_RELA
,
2175 elfcpp::SHF_ALLOC
, this->irelative_rel_
,
2176 ORDER_DYNAMIC_PLT_RELOCS
, false);
2177 gold_assert(this->irelative_rel_
->output_section()
2178 == this->rel_
->output_section());
2180 if (parameters
->doing_static_link())
2182 // A statically linked executable will only have a .rela.plt
2183 // section to hold R_TILEGX_IRELATIVE relocs for
2184 // STT_GNU_IFUNC symbols. The library will use these
2185 // symbols to locate the IRELATIVE relocs at program startup
2187 symtab
->define_in_output_data("__rela_iplt_start", NULL
,
2188 Symbol_table::PREDEFINED
,
2189 this->irelative_rel_
, 0, 0,
2190 elfcpp::STT_NOTYPE
, elfcpp::STB_GLOBAL
,
2191 elfcpp::STV_HIDDEN
, 0, false, true);
2192 symtab
->define_in_output_data("__rela_iplt_end", NULL
,
2193 Symbol_table::PREDEFINED
,
2194 this->irelative_rel_
, 0, 0,
2195 elfcpp::STT_NOTYPE
, elfcpp::STB_GLOBAL
,
2196 elfcpp::STV_HIDDEN
, 0, true, true);
2199 return this->irelative_rel_
;
2202 // Return the PLT address to use for a global symbol.
2204 template<int size
, bool big_endian
>
2206 Output_data_plt_tilegx
<size
, big_endian
>::address_for_global(
2209 uint64_t offset
= 0;
2210 if (gsym
->type() == elfcpp::STT_GNU_IFUNC
2211 && gsym
->can_use_relative_reloc(false))
2212 offset
= (this->count_
+ 1) * this->get_plt_entry_size();
2213 return this->address() + offset
+ gsym
->plt_offset();
2216 // Return the PLT address to use for a local symbol. These are always
2217 // IRELATIVE relocs.
2219 template<int size
, bool big_endian
>
2221 Output_data_plt_tilegx
<size
, big_endian
>::address_for_local(
2222 const Relobj
* object
,
2225 return (this->address()
2226 + (this->count_
+ 1) * this->get_plt_entry_size()
2227 + object
->local_plt_offset(r_sym
));
2230 // Set the final size.
2231 template<int size
, bool big_endian
>
2233 Output_data_plt_tilegx
<size
, big_endian
>::set_final_data_size()
2235 unsigned int count
= this->count_
+ this->irelative_count_
;
2236 this->set_data_size((count
+ 1) * this->get_plt_entry_size());
2239 // The first entry in the PLT for an executable.
2242 Output_data_plt_tilegx
<64, false>::first_plt_entry
[plt_entry_size
] =
2244 0x00, 0x30, 0x48, 0x51,
2245 0x6e, 0x43, 0xa0, 0x18, // { ld_add r28, r27, 8 }
2246 0x00, 0x30, 0xbc, 0x35,
2247 0x00, 0x40, 0xde, 0x9e, // { ld r27, r27 }
2248 0xff, 0xaf, 0x30, 0x40,
2249 0x60, 0x73, 0x6a, 0x28, // { info 10 ; jr r27 }
2251 0x00, 0x00, 0x00, 0x00,
2252 0x00, 0x00, 0x00, 0x00,
2253 0x00, 0x00, 0x00, 0x00,
2254 0x00, 0x00, 0x00, 0x00
2259 Output_data_plt_tilegx
<32, false>::first_plt_entry
[plt_entry_size
] =
2261 0x00, 0x30, 0x48, 0x51,
2262 0x6e, 0x23, 0x58, 0x18, // { ld4s_add r28, r27, 4 }
2263 0x00, 0x30, 0xbc, 0x35,
2264 0x00, 0x40, 0xde, 0x9c, // { ld4s r27, r27 }
2265 0xff, 0xaf, 0x30, 0x40,
2266 0x60, 0x73, 0x6a, 0x28, // { info 10 ; jr r27 }
2268 0x00, 0x00, 0x00, 0x00,
2269 0x00, 0x00, 0x00, 0x00,
2270 0x00, 0x00, 0x00, 0x00,
2271 0x00, 0x00, 0x00, 0x00
2276 Output_data_plt_tilegx
<64, true>::first_plt_entry
[plt_entry_size
] =
2278 0x00, 0x30, 0x48, 0x51,
2279 0x6e, 0x43, 0xa0, 0x18, // { ld_add r28, r27, 8 }
2280 0x00, 0x30, 0xbc, 0x35,
2281 0x00, 0x40, 0xde, 0x9e, // { ld r27, r27 }
2282 0xff, 0xaf, 0x30, 0x40,
2283 0x60, 0x73, 0x6a, 0x28, // { info 10 ; jr r27 }
2285 0x00, 0x00, 0x00, 0x00,
2286 0x00, 0x00, 0x00, 0x00,
2287 0x00, 0x00, 0x00, 0x00,
2288 0x00, 0x00, 0x00, 0x00
2293 Output_data_plt_tilegx
<32, true>::first_plt_entry
[plt_entry_size
] =
2295 0x00, 0x30, 0x48, 0x51,
2296 0x6e, 0x23, 0x58, 0x18, // { ld4s_add r28, r27, 4 }
2297 0x00, 0x30, 0xbc, 0x35,
2298 0x00, 0x40, 0xde, 0x9c, // { ld4s r27, r27 }
2299 0xff, 0xaf, 0x30, 0x40,
2300 0x60, 0x73, 0x6a, 0x28, // { info 10 ; jr r27 }
2302 0x00, 0x00, 0x00, 0x00,
2303 0x00, 0x00, 0x00, 0x00,
2304 0x00, 0x00, 0x00, 0x00,
2305 0x00, 0x00, 0x00, 0x00
2308 template<int size
, bool big_endian
>
2310 Output_data_plt_tilegx
<size
, big_endian
>::fill_first_plt_entry(
2313 memcpy(pov
, first_plt_entry
, plt_entry_size
);
2316 // Subsequent entries in the PLT for an executable.
2320 Output_data_plt_tilegx
<64, false>::plt_entry
[plt_entry_size
] =
2322 0xdc, 0x0f, 0x00, 0x10,
2323 0x0d, 0xf0, 0x6a, 0x28, // { moveli r28, 0 ; lnk r26 }
2324 0xdb, 0x0f, 0x00, 0x10,
2325 0x8e, 0x03, 0x00, 0x38, // { moveli r27, 0 ; shl16insli r28, r28, 0 }
2326 0x9c, 0xc6, 0x0d, 0xd0,
2327 0x6d, 0x03, 0x00, 0x38, // { add r28, r26, r28 ; shl16insli r27, r27, 0 }
2328 0x9b, 0xb6, 0xc5, 0xad,
2329 0xff, 0x57, 0xe0, 0x8e, // { add r27, r26, r27 ; info 10 ; ld r28, r28 }
2330 0xdd, 0x0f, 0x00, 0x70,
2331 0x80, 0x73, 0x6a, 0x28, // { shl16insli r29, zero, 0 ; jr r28 }
2337 Output_data_plt_tilegx
<32, false>::plt_entry
[plt_entry_size
] =
2339 0xdc, 0x0f, 0x00, 0x10,
2340 0x0d, 0xf0, 0x6a, 0x28, // { moveli r28, 0 ; lnk r26 }
2341 0xdb, 0x0f, 0x00, 0x10,
2342 0x8e, 0x03, 0x00, 0x38, // { moveli r27, 0 ; shl16insli r28, r28, 0 }
2343 0x9c, 0xc6, 0x0d, 0xd0,
2344 0x6d, 0x03, 0x00, 0x38, // { add r28, r26, r28 ; shl16insli r27, r27, 0 }
2345 0x9b, 0xb6, 0xc5, 0xad,
2346 0xff, 0x57, 0xe0, 0x8c, // { add r27, r26, r27 ; info 10 ; ld4s r28, r28 }
2347 0xdd, 0x0f, 0x00, 0x70,
2348 0x80, 0x73, 0x6a, 0x28, // { shl16insli r29, zero, 0 ; jr r28 }
2353 Output_data_plt_tilegx
<64, true>::plt_entry
[plt_entry_size
] =
2355 0xdc, 0x0f, 0x00, 0x10,
2356 0x0d, 0xf0, 0x6a, 0x28, // { moveli r28, 0 ; lnk r26 }
2357 0xdb, 0x0f, 0x00, 0x10,
2358 0x8e, 0x03, 0x00, 0x38, // { moveli r27, 0 ; shl16insli r28, r28, 0 }
2359 0x9c, 0xc6, 0x0d, 0xd0,
2360 0x6d, 0x03, 0x00, 0x38, // { add r28, r26, r28 ; shl16insli r27, r27, 0 }
2361 0x9b, 0xb6, 0xc5, 0xad,
2362 0xff, 0x57, 0xe0, 0x8e, // { add r27, r26, r27 ; info 10 ; ld r28, r28 }
2363 0xdd, 0x0f, 0x00, 0x70,
2364 0x80, 0x73, 0x6a, 0x28, // { shl16insli r29, zero, 0 ; jr r28 }
2370 Output_data_plt_tilegx
<32, true>::plt_entry
[plt_entry_size
] =
2372 0xdc, 0x0f, 0x00, 0x10,
2373 0x0d, 0xf0, 0x6a, 0x28, // { moveli r28, 0 ; lnk r26 }
2374 0xdb, 0x0f, 0x00, 0x10,
2375 0x8e, 0x03, 0x00, 0x38, // { moveli r27, 0 ; shl16insli r28, r28, 0 }
2376 0x9c, 0xc6, 0x0d, 0xd0,
2377 0x6d, 0x03, 0x00, 0x38, // { add r28, r26, r28 ; shl16insli r27, r27, 0 }
2378 0x9b, 0xb6, 0xc5, 0xad,
2379 0xff, 0x57, 0xe0, 0x8c, // { add r27, r26, r27 ; info 10 ; ld4s r28, r28 }
2380 0xdd, 0x0f, 0x00, 0x70,
2381 0x80, 0x73, 0x6a, 0x28, // { shl16insli r29, zero, 0 ; jr r28 }
2384 template<int size
, bool big_endian
>
2386 Output_data_plt_tilegx
<size
, big_endian
>::fill_plt_entry(
2388 typename
elfcpp::Elf_types
<size
>::Elf_Addr gotplt_base
,
2389 unsigned int got_offset
,
2390 typename
elfcpp::Elf_types
<size
>::Elf_Addr plt_base
,
2391 unsigned int plt_offset
, unsigned int plt_index
)
2394 const uint32_t TILEGX_IMM16_MASK
= 0xFFFF;
2395 const uint32_t TILEGX_X0_IMM16_BITOFF
= 12;
2396 const uint32_t TILEGX_X1_IMM16_BITOFF
= 43;
2398 typedef typename
elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::Valtype
2400 memcpy(pov
, plt_entry
, plt_entry_size
);
2402 // first bundle in plt stub - x0
2403 Valtype
* wv
= reinterpret_cast<Valtype
*>(pov
);
2404 Valtype val
= elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::readval(wv
);
2406 ((gotplt_base
+ got_offset
) - (plt_base
+ plt_offset
+ 8)) >> 16;
2407 elfcpp::Elf_Xword dst_mask
=
2408 (elfcpp::Elf_Xword
)(TILEGX_IMM16_MASK
) << TILEGX_X0_IMM16_BITOFF
;
2410 reloc
&= TILEGX_IMM16_MASK
;
2411 elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::writeval(wv
,
2412 val
| (reloc
<<TILEGX_X0_IMM16_BITOFF
));
2414 // second bundle in plt stub - x1
2415 wv
= reinterpret_cast<Valtype
*>(pov
+ 8);
2416 val
= elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::readval(wv
);
2417 reloc
= (gotplt_base
+ got_offset
) - (plt_base
+ plt_offset
+ 8);
2418 dst_mask
= (elfcpp::Elf_Xword
)(TILEGX_IMM16_MASK
) << TILEGX_X1_IMM16_BITOFF
;
2420 reloc
&= TILEGX_IMM16_MASK
;
2421 elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::writeval(wv
,
2422 val
| (reloc
<<TILEGX_X1_IMM16_BITOFF
));
2424 // second bundle in plt stub - x0
2425 wv
= reinterpret_cast<Valtype
*>(pov
+ 8);
2426 val
= elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::readval(wv
);
2427 reloc
= (gotplt_base
- (plt_base
+ plt_offset
+ 8)) >> 16;
2428 dst_mask
= (elfcpp::Elf_Xword
)(TILEGX_IMM16_MASK
) << TILEGX_X0_IMM16_BITOFF
;
2430 reloc
&= TILEGX_IMM16_MASK
;
2431 elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::writeval(wv
,
2432 val
| (reloc
<<TILEGX_X0_IMM16_BITOFF
));
2434 // third bundle in plt stub - x1
2435 wv
= reinterpret_cast<Valtype
*>(pov
+ 16);
2436 val
= elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::readval(wv
);
2437 reloc
= gotplt_base
- (plt_base
+ plt_offset
+ 8);
2438 dst_mask
= (elfcpp::Elf_Xword
)(TILEGX_IMM16_MASK
) << TILEGX_X1_IMM16_BITOFF
;
2440 reloc
&= TILEGX_IMM16_MASK
;
2441 elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::writeval(wv
,
2442 val
| (reloc
<<TILEGX_X1_IMM16_BITOFF
));
2444 // fifth bundle in plt stub - carry plt_index x0
2445 wv
= reinterpret_cast<Valtype
*>(pov
+ 32);
2446 val
= elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::readval(wv
);
2447 dst_mask
= (elfcpp::Elf_Xword
)(TILEGX_IMM16_MASK
) << TILEGX_X0_IMM16_BITOFF
;
2449 plt_index
&= TILEGX_IMM16_MASK
;
2450 elfcpp::Swap
<TILEGX_INST_BUNDLE_SIZE
, big_endian
>::writeval(wv
,
2451 val
| (plt_index
<<TILEGX_X0_IMM16_BITOFF
));
2455 // Write out the PLT. This uses the hand-coded instructions above.
2457 template<int size
, bool big_endian
>
2459 Output_data_plt_tilegx
<size
, big_endian
>::do_write(Output_file
* of
)
2461 const off_t offset
= this->offset();
2462 const section_size_type oview_size
=
2463 convert_to_section_size_type(this->data_size());
2464 unsigned char* const oview
= of
->get_output_view(offset
, oview_size
);
2466 const off_t got_file_offset
= this->got_plt_
->offset();
2467 gold_assert(parameters
->incremental_update()
2468 || (got_file_offset
+ this->got_plt_
->data_size()
2469 == this->got_irelative_
->offset()));
2470 const section_size_type got_size
=
2471 convert_to_section_size_type(this->got_plt_
->data_size()
2472 + this->got_irelative_
->data_size());
2473 unsigned char* const got_view
= of
->get_output_view(got_file_offset
,
2476 unsigned char* pov
= oview
;
2478 // The base address of the .plt section.
2479 typename
elfcpp::Elf_types
<size
>::Elf_Addr plt_address
= this->address();
2480 typename
elfcpp::Elf_types
<size
>::Elf_Addr got_address
=
2481 this->got_plt_
->address();
2483 this->fill_first_plt_entry(pov
);
2484 pov
+= this->get_plt_entry_size();
2486 unsigned char* got_pov
= got_view
;
2488 // first entry of .got.plt are set to -1
2489 // second entry of .got.plt are set to 0
2490 memset(got_pov
, 0xff, size
/ 8);
2491 got_pov
+= size
/ 8;
2492 memset(got_pov
, 0x0, size
/ 8);
2493 got_pov
+= size
/ 8;
2495 unsigned int plt_offset
= this->get_plt_entry_size();
2496 const unsigned int count
= this->count_
+ this->irelative_count_
;
2497 unsigned int got_offset
= (size
/ 8) * TILEGX_GOTPLT_RESERVE_COUNT
;
2498 for (unsigned int plt_index
= 0;
2501 pov
+= this->get_plt_entry_size(),
2502 got_pov
+= size
/ 8,
2503 plt_offset
+= this->get_plt_entry_size(),
2504 got_offset
+= size
/ 8)
2506 // Set and adjust the PLT entry itself.
2507 this->fill_plt_entry(pov
, got_address
, got_offset
,
2508 plt_address
, plt_offset
, plt_index
);
2510 // Initialize entry in .got.plt to plt start address
2511 elfcpp::Swap
<size
, big_endian
>::writeval(got_pov
, plt_address
);
2514 gold_assert(static_cast<section_size_type
>(pov
- oview
) == oview_size
);
2515 gold_assert(static_cast<section_size_type
>(got_pov
- got_view
) == got_size
);
2517 of
->write_output_view(offset
, oview_size
, oview
);
2518 of
->write_output_view(got_file_offset
, got_size
, got_view
);
2521 // Create the PLT section.
2523 template<int size
, bool big_endian
>
2525 Target_tilegx
<size
, big_endian
>::make_plt_section(Symbol_table
* symtab
,
2528 if (this->plt_
== NULL
)
2530 // Create the GOT sections first.
2531 this->got_section(symtab
, layout
);
2533 // Ensure that .rela.dyn always appears before .rela.plt,
2534 // because on TILE-Gx, .rela.dyn needs to include .rela.plt
2536 this->rela_dyn_section(layout
);
2538 this->plt_
= new Output_data_plt_tilegx
<size
, big_endian
>(layout
,
2539 TILEGX_INST_BUNDLE_SIZE
, this->got_
, this->got_plt_
,
2540 this->got_irelative_
);
2542 layout
->add_output_section_data(".plt", elfcpp::SHT_PROGBITS
,
2544 | elfcpp::SHF_EXECINSTR
),
2545 this->plt_
, ORDER_NON_RELRO_FIRST
,
2548 // Make the sh_info field of .rela.plt point to .plt.
2549 Output_section
* rela_plt_os
= this->plt_
->rela_plt()->output_section();
2550 rela_plt_os
->set_info_section(this->plt_
->output_section());
2554 // Create a PLT entry for a global symbol.
2556 template<int size
, bool big_endian
>
2558 Target_tilegx
<size
, big_endian
>::make_plt_entry(Symbol_table
* symtab
,
2559 Layout
* layout
, Symbol
* gsym
)
2561 if (gsym
->has_plt_offset())
2564 if (this->plt_
== NULL
)
2565 this->make_plt_section(symtab
, layout
);
2567 this->plt_
->add_entry(symtab
, layout
, gsym
);
2570 // Make a PLT entry for a local STT_GNU_IFUNC symbol.
2572 template<int size
, bool big_endian
>
2574 Target_tilegx
<size
, big_endian
>::make_local_ifunc_plt_entry(
2575 Symbol_table
* symtab
, Layout
* layout
,
2576 Sized_relobj_file
<size
, big_endian
>* relobj
,
2577 unsigned int local_sym_index
)
2579 if (relobj
->local_has_plt_offset(local_sym_index
))
2581 if (this->plt_
== NULL
)
2582 this->make_plt_section(symtab
, layout
);
2583 unsigned int plt_offset
= this->plt_
->add_local_ifunc_entry(symtab
, layout
,
2586 relobj
->set_local_plt_offset(local_sym_index
, plt_offset
);
2589 // Return the number of entries in the PLT.
2591 template<int size
, bool big_endian
>
2593 Target_tilegx
<size
, big_endian
>::plt_entry_count() const
2595 if (this->plt_
== NULL
)
2597 return this->plt_
->entry_count();
2600 // Return the offset of the first non-reserved PLT entry.
2602 template<int size
, bool big_endian
>
2604 Target_tilegx
<size
, big_endian
>::first_plt_entry_offset() const
2606 return this->plt_
->first_plt_entry_offset();
2609 // Return the size of each PLT entry.
2611 template<int size
, bool big_endian
>
2613 Target_tilegx
<size
, big_endian
>::plt_entry_size() const
2615 return this->plt_
->get_plt_entry_size();
2618 // Create the GOT and PLT sections for an incremental update.
2620 template<int size
, bool big_endian
>
2621 Output_data_got_base
*
2622 Target_tilegx
<size
, big_endian
>::init_got_plt_for_update(Symbol_table
* symtab
,
2624 unsigned int got_count
,
2625 unsigned int plt_count
)
2627 gold_assert(this->got_
== NULL
);
2630 new Output_data_got
<size
, big_endian
>((got_count
2631 + TILEGX_GOT_RESERVE_COUNT
)
2633 layout
->add_output_section_data(".got", elfcpp::SHT_PROGBITS
,
2635 | elfcpp::SHF_WRITE
),
2636 this->got_
, ORDER_RELRO_LAST
,
2639 // Define _GLOBAL_OFFSET_TABLE_ at the start of the GOT.
2640 this->global_offset_table_
=
2641 symtab
->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL
,
2642 Symbol_table::PREDEFINED
,
2644 0, 0, elfcpp::STT_OBJECT
,
2646 elfcpp::STV_HIDDEN
, 0,
2649 if (parameters
->options().shared()) {
2650 this->tilegx_dynamic_
=
2651 symtab
->define_in_output_data("_TILEGX_DYNAMIC_", NULL
,
2652 Symbol_table::PREDEFINED
,
2653 layout
->dynamic_section(),
2654 0, 0, elfcpp::STT_OBJECT
,
2656 elfcpp::STV_HIDDEN
, 0,
2659 this->got_
->add_global(this->tilegx_dynamic_
, GOT_TYPE_STANDARD
);
2661 this->got_
->set_current_data_size(size
/ 8);
2663 // Add the two reserved entries.
2665 = new Output_data_space((plt_count
+ TILEGX_GOTPLT_RESERVE_COUNT
)
2666 * (size
/ 8), size
/ 8, "** GOT PLT");
2667 layout
->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS
,
2669 | elfcpp::SHF_WRITE
),
2670 this->got_plt_
, ORDER_NON_RELRO_FIRST
,
2673 // If there are any IRELATIVE relocations, they get GOT entries in
2674 // .got.plt after the jump slot.
2675 this->got_irelative_
2676 = new Output_data_space(0, size
/ 8, "** GOT IRELATIVE PLT");
2677 layout
->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS
,
2678 elfcpp::SHF_ALLOC
| elfcpp::SHF_WRITE
,
2679 this->got_irelative_
,
2680 ORDER_NON_RELRO_FIRST
, false);
2682 // Create the PLT section.
2683 this->plt_
= new Output_data_plt_tilegx
<size
, big_endian
>(layout
,
2684 this->plt_entry_size(), this->got_
, this->got_plt_
, this->got_irelative_
,
2687 layout
->add_output_section_data(".plt", elfcpp::SHT_PROGBITS
,
2688 elfcpp::SHF_ALLOC
| elfcpp::SHF_EXECINSTR
,
2689 this->plt_
, ORDER_PLT
, false);
2691 // Make the sh_info field of .rela.plt point to .plt.
2692 Output_section
* rela_plt_os
= this->plt_
->rela_plt()->output_section();
2693 rela_plt_os
->set_info_section(this->plt_
->output_section());
2695 // Create the rela_dyn section.
2696 this->rela_dyn_section(layout
);
2701 // Reserve a GOT entry for a local symbol, and regenerate any
2702 // necessary dynamic relocations.
2704 template<int size
, bool big_endian
>
2706 Target_tilegx
<size
, big_endian
>::reserve_local_got_entry(
2707 unsigned int got_index
,
2708 Sized_relobj
<size
, big_endian
>* obj
,
2710 unsigned int got_type
)
2712 unsigned int got_offset
= (got_index
+ TILEGX_GOT_RESERVE_COUNT
)
2714 Reloc_section
* rela_dyn
= this->rela_dyn_section(NULL
);
2716 this->got_
->reserve_local(got_index
, obj
, r_sym
, got_type
);
2719 case GOT_TYPE_STANDARD
:
2720 if (parameters
->options().output_is_position_independent())
2721 rela_dyn
->add_local_relative(obj
, r_sym
, elfcpp::R_TILEGX_RELATIVE
,
2722 this->got_
, got_offset
, 0, false);
2724 case GOT_TYPE_TLS_OFFSET
:
2725 rela_dyn
->add_local(obj
, r_sym
,
2726 size
== 32 ? elfcpp::R_TILEGX_TLS_DTPOFF32
2727 : elfcpp::R_TILEGX_TLS_DTPOFF64
,
2728 this->got_
, got_offset
, 0);
2730 case GOT_TYPE_TLS_PAIR
:
2731 this->got_
->reserve_slot(got_index
+ 1);
2732 rela_dyn
->add_local(obj
, r_sym
,
2733 size
== 32 ? elfcpp::R_TILEGX_TLS_DTPMOD32
2734 : elfcpp::R_TILEGX_TLS_DTPMOD64
,
2735 this->got_
, got_offset
, 0);
2737 case GOT_TYPE_TLS_DESC
:
2738 gold_fatal(_("TLS_DESC not yet supported for incremental linking"));
2745 // Reserve a GOT entry for a global symbol, and regenerate any
2746 // necessary dynamic relocations.
2748 template<int size
, bool big_endian
>
2750 Target_tilegx
<size
, big_endian
>::reserve_global_got_entry(
2751 unsigned int got_index
, Symbol
* gsym
, unsigned int got_type
)
2753 unsigned int got_offset
= (got_index
+ TILEGX_GOT_RESERVE_COUNT
)
2755 Reloc_section
* rela_dyn
= this->rela_dyn_section(NULL
);
2757 this->got_
->reserve_global(got_index
, gsym
, got_type
);
2760 case GOT_TYPE_STANDARD
:
2761 if (!gsym
->final_value_is_known())
2763 if (gsym
->is_from_dynobj()
2764 || gsym
->is_undefined()
2765 || gsym
->is_preemptible()
2766 || gsym
->type() == elfcpp::STT_GNU_IFUNC
)
2767 rela_dyn
->add_global(gsym
, elfcpp::R_TILEGX_GLOB_DAT
,
2768 this->got_
, got_offset
, 0);
2770 rela_dyn
->add_global_relative(gsym
, elfcpp::R_TILEGX_RELATIVE
,
2771 this->got_
, got_offset
, 0, false);
2774 case GOT_TYPE_TLS_OFFSET
:
2775 rela_dyn
->add_global_relative(gsym
,
2776 size
== 32 ? elfcpp::R_TILEGX_TLS_TPOFF32
2777 : elfcpp::R_TILEGX_TLS_TPOFF64
,
2778 this->got_
, got_offset
, 0, false);
2780 case GOT_TYPE_TLS_PAIR
:
2781 this->got_
->reserve_slot(got_index
+ 1);
2782 rela_dyn
->add_global_relative(gsym
,
2783 size
== 32 ? elfcpp::R_TILEGX_TLS_DTPMOD32
2784 : elfcpp::R_TILEGX_TLS_DTPMOD64
,
2785 this->got_
, got_offset
, 0, false);
2786 rela_dyn
->add_global_relative(gsym
,
2787 size
== 32 ? elfcpp::R_TILEGX_TLS_DTPOFF32
2788 : elfcpp::R_TILEGX_TLS_DTPOFF64
,
2789 this->got_
, got_offset
+ size
/ 8,
2792 case GOT_TYPE_TLS_DESC
:
2793 gold_fatal(_("TLS_DESC not yet supported for TILEGX"));
2800 // Register an existing PLT entry for a global symbol.
2802 template<int size
, bool big_endian
>
2804 Target_tilegx
<size
, big_endian
>::register_global_plt_entry(
2805 Symbol_table
* symtab
, Layout
* layout
, unsigned int plt_index
, Symbol
* gsym
)
2807 gold_assert(this->plt_
!= NULL
);
2808 gold_assert(!gsym
->has_plt_offset());
2810 this->plt_
->reserve_slot(plt_index
);
2812 gsym
->set_plt_offset((plt_index
+ 1) * this->plt_entry_size());
2814 unsigned int got_offset
= (plt_index
+ 2) * (size
/ 8);
2815 this->plt_
->add_relocation(symtab
, layout
, gsym
, got_offset
);
2818 // Force a COPY relocation for a given symbol.
2820 template<int size
, bool big_endian
>
2822 Target_tilegx
<size
, big_endian
>::emit_copy_reloc(
2823 Symbol_table
* symtab
, Symbol
* sym
, Output_section
* os
, off_t offset
)
2825 this->copy_relocs_
.emit_copy_reloc(symtab
,
2826 symtab
->get_sized_symbol
<size
>(sym
),
2829 this->rela_dyn_section(NULL
));
2832 // Create a GOT entry for the TLS module index.
2834 template<int size
, bool big_endian
>
2836 Target_tilegx
<size
, big_endian
>::got_mod_index_entry(Symbol_table
* symtab
,
2838 Sized_relobj_file
<size
, big_endian
>* object
)
2840 if (this->got_mod_index_offset_
== -1U)
2842 gold_assert(symtab
!= NULL
&& layout
!= NULL
&& object
!= NULL
);
2843 Reloc_section
* rela_dyn
= this->rela_dyn_section(layout
);
2844 Output_data_got
<size
, big_endian
>* got
2845 = this->got_section(symtab
, layout
);
2846 unsigned int got_offset
= got
->add_constant(0);
2847 rela_dyn
->add_local(object
, 0,
2848 size
== 32 ? elfcpp::R_TILEGX_TLS_DTPMOD32
2849 : elfcpp::R_TILEGX_TLS_DTPMOD64
, got
,
2851 got
->add_constant(0);
2852 this->got_mod_index_offset_
= got_offset
;
2854 return this->got_mod_index_offset_
;
2857 // Optimize the TLS relocation type based on what we know about the
2858 // symbol. IS_FINAL is true if the final address of this symbol is
2859 // known at link time.
2861 // the transformation rules is described below:
2863 // compiler GD reference
2866 // moveli tmp, hw1_last_tls_gd(x) X0/X1
2867 // shl16insli r0, tmp, hw0_tls_gd(x) X0/X1
2868 // addi r0, got, tls_add(x) Y0/Y1/X0/X1
2869 // jal tls_gd_call(x) X1
2870 // addi adr, r0, tls_gd_add(x) Y0/Y1/X0/X1
2872 // linker tranformation of GD insn sequence
2876 // moveli tmp, hw1_last_tls_gd(x) X0/X1
2877 // shl16insli r0, tmp, hw0_tls_gd(x) X0/X1
2878 // add r0, got, r0 Y0/Y1/X0/X1
2879 // jal plt(__tls_get_addr) X1
2880 // move adr, r0 Y0/Y1/X0/X1
2882 // moveli tmp, hw1_last_tls_ie(x) X0/X1
2883 // shl16insli r0, tmp, hw0_tls_ie(x) X0/X1
2884 // add r0, got, r0 Y0/Y1/X0/X1
2886 // add adr, r0, tp Y0/Y1/X0/X1
2888 // moveli tmp, hw1_last_tls_le(x) X0/X1
2889 // shl16insli r0, tmp, hw0_tls_le(x) X0/X1
2890 // move r0, r0 Y0/Y1/X0/X1
2891 // move r0, r0 Y0/Y1/X0/X1
2892 // add adr, r0, tp Y0/Y1/X0/X1
2895 // compiler IE reference
2898 // moveli tmp, hw1_last_tls_ie(x) X0/X1
2899 // shl16insli tmp, tmp, hw0_tls_ie(x) X0/X1
2900 // addi tmp, got, tls_add(x) Y0/Y1/X0/X1
2901 // ld_tls tmp, tmp, tls_ie_load(x) X1
2902 // add adr, tmp, tp Y0/Y1/X0/X1
2904 // linker transformation for IE insn sequence
2908 // moveli tmp, hw1_last_tls_ie(x) X0/X1
2909 // shl16insli tmp, tmp, hw0_tls_ie(x) X0/X1
2910 // add tmp, got, tmp Y0/Y1/X0/X1
2912 // add adr, tmp, tp Y0/Y1/X0/X1
2914 // moveli tmp, hw1_last_tls_le(x) X0/X1
2915 // shl16insli tmp, tmp, hw0_tls_le(x) X0/X1
2916 // move tmp, tmp Y0/Y1/X0/X1
2917 // move tmp, tmp Y0/Y1/X0/X1
2920 // compiler LE reference
2923 // moveli tmp, hw1_last_tls_le(x) X0/X1
2924 // shl16insli tmp, tmp, hw0_tls_le(x) X0/X1
2925 // add adr, tmp, tp Y0/Y1/X0/X1
2927 template<int size
, bool big_endian
>
2928 tls::Tls_optimization
2929 Target_tilegx
<size
, big_endian
>::optimize_tls_reloc(bool is_final
, int r_type
)
2931 // If we are generating a shared library, then we can't do anything
2933 if (parameters
->options().shared())
2934 return tls::TLSOPT_NONE
;
2938 // unique GD relocations
2939 case elfcpp::R_TILEGX_TLS_GD_CALL
:
2940 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
2941 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
2942 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
2943 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
2944 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
2945 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
2946 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
2947 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
2948 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
2949 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
2950 // These are General-Dynamic which permits fully general TLS
2951 // access. Since we know that we are generating an executable,
2952 // we can convert this to Initial-Exec. If we also know that
2953 // this is a local symbol, we can further switch to Local-Exec.
2955 return tls::TLSOPT_TO_LE
;
2956 return tls::TLSOPT_TO_IE
;
2958 // unique IE relocations
2959 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
2960 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
2961 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
2962 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
2963 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
2964 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
2965 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
2966 // These are Initial-Exec relocs which get the thread offset
2967 // from the GOT. If we know that we are linking against the
2968 // local symbol, we can switch to Local-Exec, which links the
2969 // thread offset into the instruction.
2971 return tls::TLSOPT_TO_LE
;
2972 return tls::TLSOPT_NONE
;
2974 // could be created for both GD and IE
2975 // but they are expanded into the same
2976 // instruction in GD and IE.
2977 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
2978 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
2979 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
2980 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
2982 return tls::TLSOPT_TO_LE
;
2983 return tls::TLSOPT_NONE
;
2985 // unique LE relocations
2986 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
2987 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
2988 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
2989 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
2990 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
2991 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
2992 // When we already have Local-Exec, there is nothing further we
2994 return tls::TLSOPT_NONE
;
3001 // Get the Reference_flags for a particular relocation.
3003 template<int size
, bool big_endian
>
3005 Target_tilegx
<size
, big_endian
>::Scan::get_reference_flags(unsigned int r_type
)
3009 case elfcpp::R_TILEGX_NONE
:
3010 case elfcpp::R_TILEGX_GNU_VTINHERIT
:
3011 case elfcpp::R_TILEGX_GNU_VTENTRY
:
3012 // No symbol reference.
3015 case elfcpp::R_TILEGX_64
:
3016 case elfcpp::R_TILEGX_32
:
3017 case elfcpp::R_TILEGX_16
:
3018 case elfcpp::R_TILEGX_8
:
3019 return Symbol::ABSOLUTE_REF
;
3021 case elfcpp::R_TILEGX_BROFF_X1
:
3022 case elfcpp::R_TILEGX_64_PCREL
:
3023 case elfcpp::R_TILEGX_32_PCREL
:
3024 case elfcpp::R_TILEGX_16_PCREL
:
3025 case elfcpp::R_TILEGX_8_PCREL
:
3026 case elfcpp::R_TILEGX_IMM16_X0_HW0_PCREL
:
3027 case elfcpp::R_TILEGX_IMM16_X1_HW0_PCREL
:
3028 case elfcpp::R_TILEGX_IMM16_X0_HW1_PCREL
:
3029 case elfcpp::R_TILEGX_IMM16_X1_HW1_PCREL
:
3030 case elfcpp::R_TILEGX_IMM16_X0_HW2_PCREL
:
3031 case elfcpp::R_TILEGX_IMM16_X1_HW2_PCREL
:
3032 case elfcpp::R_TILEGX_IMM16_X0_HW3_PCREL
:
3033 case elfcpp::R_TILEGX_IMM16_X1_HW3_PCREL
:
3034 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PCREL
:
3035 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PCREL
:
3036 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PCREL
:
3037 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PCREL
:
3038 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PCREL
:
3039 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PCREL
:
3040 return Symbol::RELATIVE_REF
;
3042 case elfcpp::R_TILEGX_JUMPOFF_X1
:
3043 case elfcpp::R_TILEGX_JUMPOFF_X1_PLT
:
3044 case elfcpp::R_TILEGX_IMM16_X0_HW0_PLT_PCREL
:
3045 case elfcpp::R_TILEGX_IMM16_X1_HW0_PLT_PCREL
:
3046 case elfcpp::R_TILEGX_IMM16_X0_HW1_PLT_PCREL
:
3047 case elfcpp::R_TILEGX_IMM16_X1_HW1_PLT_PCREL
:
3048 case elfcpp::R_TILEGX_IMM16_X0_HW2_PLT_PCREL
:
3049 case elfcpp::R_TILEGX_IMM16_X1_HW2_PLT_PCREL
:
3050 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
:
3051 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
:
3052 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
:
3053 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
:
3054 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
:
3055 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
:
3056 return Symbol::FUNCTION_CALL
| Symbol::RELATIVE_REF
;
3058 case elfcpp::R_TILEGX_IMM16_X0_HW0
:
3059 case elfcpp::R_TILEGX_IMM16_X1_HW0
:
3060 case elfcpp::R_TILEGX_IMM16_X0_HW1
:
3061 case elfcpp::R_TILEGX_IMM16_X1_HW1
:
3062 case elfcpp::R_TILEGX_IMM16_X0_HW2
:
3063 case elfcpp::R_TILEGX_IMM16_X1_HW2
:
3064 case elfcpp::R_TILEGX_IMM16_X0_HW3
:
3065 case elfcpp::R_TILEGX_IMM16_X1_HW3
:
3066 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST
:
3067 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST
:
3068 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST
:
3069 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST
:
3070 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST
:
3071 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST
:
3072 return Symbol::ABSOLUTE_REF
;
3074 case elfcpp::R_TILEGX_IMM16_X0_HW0_GOT
:
3075 case elfcpp::R_TILEGX_IMM16_X1_HW0_GOT
:
3076 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_GOT
:
3077 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_GOT
:
3078 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_GOT
:
3079 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_GOT
:
3081 return Symbol::ABSOLUTE_REF
;
3083 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
3084 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
3085 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
3086 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
3087 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
3088 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
3089 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
3090 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
3091 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
3092 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
3093 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
3094 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
3095 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
3096 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
3097 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
3098 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
3099 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
3100 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
3101 case elfcpp::R_TILEGX_TLS_DTPOFF64
:
3102 case elfcpp::R_TILEGX_TLS_DTPMOD32
:
3103 case elfcpp::R_TILEGX_TLS_DTPOFF32
:
3104 case elfcpp::R_TILEGX_TLS_TPOFF32
:
3105 case elfcpp::R_TILEGX_TLS_GD_CALL
:
3106 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
3107 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
3108 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
3109 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
3110 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
3111 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
3112 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
3113 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
3114 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
3115 return Symbol::TLS_REF
;
3117 case elfcpp::R_TILEGX_COPY
:
3118 case elfcpp::R_TILEGX_GLOB_DAT
:
3119 case elfcpp::R_TILEGX_JMP_SLOT
:
3120 case elfcpp::R_TILEGX_RELATIVE
:
3121 case elfcpp::R_TILEGX_TLS_TPOFF64
:
3122 case elfcpp::R_TILEGX_TLS_DTPMOD64
:
3124 // Not expected. We will give an error later.
3129 // Report an unsupported relocation against a local symbol.
3131 template<int size
, bool big_endian
>
3133 Target_tilegx
<size
, big_endian
>::Scan::unsupported_reloc_local(
3134 Sized_relobj_file
<size
, big_endian
>* object
,
3135 unsigned int r_type
)
3137 gold_error(_("%s: unsupported reloc %u against local symbol"),
3138 object
->name().c_str(), r_type
);
3141 // We are about to emit a dynamic relocation of type R_TYPE. If the
3142 // dynamic linker does not support it, issue an error.
3143 template<int size
, bool big_endian
>
3145 Target_tilegx
<size
, big_endian
>::Scan::check_non_pic(Relobj
* object
,
3146 unsigned int r_type
)
3150 // These are the relocation types supported by glibc for tilegx
3151 // which should always work.
3152 case elfcpp::R_TILEGX_RELATIVE
:
3153 case elfcpp::R_TILEGX_GLOB_DAT
:
3154 case elfcpp::R_TILEGX_JMP_SLOT
:
3155 case elfcpp::R_TILEGX_TLS_DTPMOD64
:
3156 case elfcpp::R_TILEGX_TLS_DTPOFF64
:
3157 case elfcpp::R_TILEGX_TLS_TPOFF64
:
3158 case elfcpp::R_TILEGX_8
:
3159 case elfcpp::R_TILEGX_16
:
3160 case elfcpp::R_TILEGX_32
:
3161 case elfcpp::R_TILEGX_64
:
3162 case elfcpp::R_TILEGX_COPY
:
3163 case elfcpp::R_TILEGX_IMM16_X0_HW0
:
3164 case elfcpp::R_TILEGX_IMM16_X1_HW0
:
3165 case elfcpp::R_TILEGX_IMM16_X0_HW1
:
3166 case elfcpp::R_TILEGX_IMM16_X1_HW1
:
3167 case elfcpp::R_TILEGX_IMM16_X0_HW2
:
3168 case elfcpp::R_TILEGX_IMM16_X1_HW2
:
3169 case elfcpp::R_TILEGX_IMM16_X0_HW3
:
3170 case elfcpp::R_TILEGX_IMM16_X1_HW3
:
3171 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST
:
3172 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST
:
3173 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST
:
3174 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST
:
3175 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST
:
3176 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST
:
3177 case elfcpp::R_TILEGX_BROFF_X1
:
3178 case elfcpp::R_TILEGX_JUMPOFF_X1
:
3179 case elfcpp::R_TILEGX_IMM16_X0_HW0_PCREL
:
3180 case elfcpp::R_TILEGX_IMM16_X1_HW0_PCREL
:
3181 case elfcpp::R_TILEGX_IMM16_X0_HW1_PCREL
:
3182 case elfcpp::R_TILEGX_IMM16_X1_HW1_PCREL
:
3183 case elfcpp::R_TILEGX_IMM16_X0_HW2_PCREL
:
3184 case elfcpp::R_TILEGX_IMM16_X1_HW2_PCREL
:
3185 case elfcpp::R_TILEGX_IMM16_X0_HW3_PCREL
:
3186 case elfcpp::R_TILEGX_IMM16_X1_HW3_PCREL
:
3187 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PCREL
:
3188 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PCREL
:
3189 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PCREL
:
3190 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PCREL
:
3191 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PCREL
:
3192 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PCREL
:
3196 // This prevents us from issuing more than one error per reloc
3197 // section. But we can still wind up issuing more than one
3198 // error per object file.
3199 if (this->issued_non_pic_error_
)
3201 gold_assert(parameters
->options().output_is_position_independent());
3202 object
->error(_("requires unsupported dynamic reloc %u; "
3203 "recompile with -fPIC"),
3205 this->issued_non_pic_error_
= true;
3208 case elfcpp::R_TILEGX_NONE
:
3213 // Return whether we need to make a PLT entry for a relocation of the
3214 // given type against a STT_GNU_IFUNC symbol.
3216 template<int size
, bool big_endian
>
3218 Target_tilegx
<size
, big_endian
>::Scan::reloc_needs_plt_for_ifunc(
3219 Sized_relobj_file
<size
, big_endian
>* object
, unsigned int r_type
)
3221 int flags
= Scan::get_reference_flags(r_type
);
3222 if (flags
& Symbol::TLS_REF
)
3223 gold_error(_("%s: unsupported TLS reloc %u for IFUNC symbol"),
3224 object
->name().c_str(), r_type
);
3228 // Scan a relocation for a local symbol.
3230 template<int size
, bool big_endian
>
3232 Target_tilegx
<size
, big_endian
>::Scan::local(Symbol_table
* symtab
,
3234 Target_tilegx
<size
, big_endian
>* target
,
3235 Sized_relobj_file
<size
, big_endian
>* object
,
3236 unsigned int data_shndx
,
3237 Output_section
* output_section
,
3238 const elfcpp::Rela
<size
, big_endian
>& reloc
,
3239 unsigned int r_type
,
3240 const elfcpp::Sym
<size
, big_endian
>& lsym
,
3246 // A local STT_GNU_IFUNC symbol may require a PLT entry.
3247 bool is_ifunc
= lsym
.get_st_type() == elfcpp::STT_GNU_IFUNC
;
3248 if (is_ifunc
&& this->reloc_needs_plt_for_ifunc(object
, r_type
))
3250 unsigned int r_sym
= elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3251 target
->make_local_ifunc_plt_entry(symtab
, layout
, object
, r_sym
);
3256 case elfcpp::R_TILEGX_NONE
:
3257 case elfcpp::R_TILEGX_GNU_VTINHERIT
:
3258 case elfcpp::R_TILEGX_GNU_VTENTRY
:
3261 // If building a shared library (or a position-independent
3262 // executable), because the runtime address needs plus
3263 // the module base address, so generate a R_TILEGX_RELATIVE.
3264 case elfcpp::R_TILEGX_32
:
3265 case elfcpp::R_TILEGX_64
:
3266 if (parameters
->options().output_is_position_independent())
3268 unsigned int r_sym
= elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3269 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3270 rela_dyn
->add_local_relative(object
, r_sym
,
3271 elfcpp::R_TILEGX_RELATIVE
,
3272 output_section
, data_shndx
,
3273 reloc
.get_r_offset(),
3274 reloc
.get_r_addend(), is_ifunc
);
3278 // If building a shared library (or a position-independent
3279 // executable), we need to create a dynamic relocation for this
3281 case elfcpp::R_TILEGX_8
:
3282 case elfcpp::R_TILEGX_16
:
3283 case elfcpp::R_TILEGX_IMM16_X0_HW0
:
3284 case elfcpp::R_TILEGX_IMM16_X1_HW0
:
3285 case elfcpp::R_TILEGX_IMM16_X0_HW1
:
3286 case elfcpp::R_TILEGX_IMM16_X1_HW1
:
3287 case elfcpp::R_TILEGX_IMM16_X0_HW2
:
3288 case elfcpp::R_TILEGX_IMM16_X1_HW2
:
3289 case elfcpp::R_TILEGX_IMM16_X0_HW3
:
3290 case elfcpp::R_TILEGX_IMM16_X1_HW3
:
3291 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST
:
3292 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST
:
3293 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST
:
3294 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST
:
3295 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST
:
3296 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST
:
3297 if (parameters
->options().output_is_position_independent())
3299 this->check_non_pic(object
, r_type
);
3301 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3302 unsigned int r_sym
= elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3303 if (lsym
.get_st_type() != elfcpp::STT_SECTION
)
3304 rela_dyn
->add_local(object
, r_sym
, r_type
, output_section
,
3305 data_shndx
, reloc
.get_r_offset(),
3306 reloc
.get_r_addend());
3309 gold_assert(lsym
.get_st_value() == 0);
3310 rela_dyn
->add_symbolless_local_addend(object
, r_sym
, r_type
,
3313 reloc
.get_r_offset(),
3314 reloc
.get_r_addend());
3320 // R_TILEGX_JUMPOFF_X1_PLT against local symbol
3321 // may happen for ifunc case.
3322 case elfcpp::R_TILEGX_JUMPOFF_X1_PLT
:
3323 case elfcpp::R_TILEGX_JUMPOFF_X1
:
3324 case elfcpp::R_TILEGX_64_PCREL
:
3325 case elfcpp::R_TILEGX_32_PCREL
:
3326 case elfcpp::R_TILEGX_16_PCREL
:
3327 case elfcpp::R_TILEGX_8_PCREL
:
3328 case elfcpp::R_TILEGX_BROFF_X1
:
3329 case elfcpp::R_TILEGX_IMM16_X0_HW0_PCREL
:
3330 case elfcpp::R_TILEGX_IMM16_X1_HW0_PCREL
:
3331 case elfcpp::R_TILEGX_IMM16_X0_HW1_PCREL
:
3332 case elfcpp::R_TILEGX_IMM16_X1_HW1_PCREL
:
3333 case elfcpp::R_TILEGX_IMM16_X0_HW2_PCREL
:
3334 case elfcpp::R_TILEGX_IMM16_X1_HW2_PCREL
:
3335 case elfcpp::R_TILEGX_IMM16_X0_HW3_PCREL
:
3336 case elfcpp::R_TILEGX_IMM16_X1_HW3_PCREL
:
3337 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PCREL
:
3338 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PCREL
:
3339 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PCREL
:
3340 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PCREL
:
3341 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PCREL
:
3342 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PCREL
:
3343 case elfcpp::R_TILEGX_IMM16_X0_HW0_PLT_PCREL
:
3344 case elfcpp::R_TILEGX_IMM16_X1_HW0_PLT_PCREL
:
3345 case elfcpp::R_TILEGX_IMM16_X0_HW1_PLT_PCREL
:
3346 case elfcpp::R_TILEGX_IMM16_X1_HW1_PLT_PCREL
:
3347 case elfcpp::R_TILEGX_IMM16_X0_HW2_PLT_PCREL
:
3348 case elfcpp::R_TILEGX_IMM16_X1_HW2_PLT_PCREL
:
3349 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
:
3350 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
:
3351 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
:
3352 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
:
3353 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
:
3354 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
:
3357 case elfcpp::R_TILEGX_IMM16_X0_HW0_GOT
:
3358 case elfcpp::R_TILEGX_IMM16_X1_HW0_GOT
:
3359 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_GOT
:
3360 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_GOT
:
3361 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_GOT
:
3362 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_GOT
:
3364 // The symbol requires a GOT entry.
3365 Output_data_got
<size
, big_endian
>* got
3366 = target
->got_section(symtab
, layout
);
3367 unsigned int r_sym
= elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3369 // For a STT_GNU_IFUNC symbol we want the PLT offset. That
3370 // lets function pointers compare correctly with shared
3371 // libraries. Otherwise we would need an IRELATIVE reloc.
3374 is_new
= got
->add_local_plt(object
, r_sym
, GOT_TYPE_STANDARD
);
3376 is_new
= got
->add_local(object
, r_sym
, GOT_TYPE_STANDARD
);
3379 // tilegx dynamic linker will not update local got entry,
3380 // so, if we are generating a shared object, we need to add a
3381 // dynamic relocation for this symbol's GOT entry to inform
3382 // dynamic linker plus the load base explicitly.
3383 if (parameters
->options().output_is_position_independent())
3385 unsigned int got_offset
3386 = object
->local_got_offset(r_sym
, GOT_TYPE_STANDARD
);
3388 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3389 rela_dyn
->add_local_relative(object
, r_sym
,
3391 got
, got_offset
, 0, is_ifunc
);
3397 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
3398 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
3399 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
3400 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
3401 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
3402 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
3403 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
3404 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
3405 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
3406 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
3407 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
3408 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
3409 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
3410 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
3411 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
3412 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
3413 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
3414 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
3415 case elfcpp::R_TILEGX_TLS_GD_CALL
:
3416 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
3417 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
3418 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
3419 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
3420 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
3421 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
3422 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
3423 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
3424 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
3426 bool output_is_shared
= parameters
->options().shared();
3427 const tls::Tls_optimization opt_t
=
3428 Target_tilegx
<size
, big_endian
>::optimize_tls_reloc(
3429 !output_is_shared
, r_type
);
3433 case elfcpp::R_TILEGX_TLS_GD_CALL
:
3434 // FIXME: predefine __tls_get_addr
3436 // R_TILEGX_TLS_GD_CALL implicitly reference __tls_get_addr,
3437 // while all other target, x86/arm/mips/powerpc/sparc
3438 // generate tls relocation against __tls_get_addr explicitly,
3439 // so for TILEGX, we need the following hack.
3440 if (opt_t
== tls::TLSOPT_NONE
) {
3441 if (!target
->tls_get_addr_sym_defined_
) {
3443 options::parse_set(NULL
, "__tls_get_addr",
3444 (gold::options::String_set
*)
3445 ¶meters
->options().undefined());
3446 symtab
->add_undefined_symbols_from_command_line(layout
);
3447 target
->tls_get_addr_sym_defined_
= true;
3448 sym
= symtab
->lookup("__tls_get_addr");
3451 target
->make_plt_entry(symtab
, layout
,
3452 symtab
->lookup("__tls_get_addr"));
3456 // only make effect when applying relocation
3457 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
3458 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
3459 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
3460 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
3461 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
3462 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
3463 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
3464 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
3465 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
3468 // GD: requires two GOT entry for module index and offset
3469 // IE: requires one GOT entry for tp-relative offset
3470 // LE: shouldn't happen for global symbol
3471 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
3472 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
3473 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
3474 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
3475 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
3476 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
3478 if (opt_t
== tls::TLSOPT_NONE
) {
3479 Output_data_got
<size
, big_endian
> *got
3480 = target
->got_section(symtab
, layout
);
3482 = elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3483 unsigned int shndx
= lsym
.get_st_shndx();
3485 shndx
= object
->adjust_sym_shndx(r_sym
, shndx
,
3488 object
->error(_("local symbol %u has bad shndx %u"),
3491 got
->add_local_pair_with_rel(object
, r_sym
, shndx
,
3493 target
->rela_dyn_section(layout
),
3495 ? elfcpp::R_TILEGX_TLS_DTPMOD32
3496 : elfcpp::R_TILEGX_TLS_DTPMOD64
);
3497 } else if (opt_t
== tls::TLSOPT_TO_IE
) {
3498 Output_data_got
<size
, big_endian
>* got
3499 = target
->got_section(symtab
, layout
);
3500 Reloc_section
* rela_dyn
3501 = target
->rela_dyn_section(layout
);
3503 = elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3504 unsigned int off
= got
->add_constant(0);
3505 object
->set_local_got_offset(r_sym
,
3506 GOT_TYPE_TLS_OFFSET
,off
);
3507 rela_dyn
->add_symbolless_local_addend(object
, r_sym
,
3509 ? elfcpp::R_TILEGX_TLS_TPOFF32
3510 : elfcpp::R_TILEGX_TLS_TPOFF64
,
3512 } else if (opt_t
!= tls::TLSOPT_TO_LE
)
3513 // only TO_LE is allowed for local symbol
3514 unsupported_reloc_local(object
, r_type
);
3519 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
3520 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
3521 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
3522 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
3523 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
3524 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
3526 layout
->set_has_static_tls();
3527 if (opt_t
== tls::TLSOPT_NONE
) {
3528 Output_data_got
<size
, big_endian
>* got
3529 = target
->got_section(symtab
, layout
);
3530 Reloc_section
* rela_dyn
3531 = target
->rela_dyn_section(layout
);
3533 = elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3534 unsigned int off
= got
->add_constant(0);
3535 object
->set_local_got_offset(r_sym
,
3536 GOT_TYPE_TLS_OFFSET
, off
);
3537 rela_dyn
->add_symbolless_local_addend(object
, r_sym
,
3539 ? elfcpp::R_TILEGX_TLS_TPOFF32
3540 : elfcpp::R_TILEGX_TLS_TPOFF64
,
3542 } else if (opt_t
!= tls::TLSOPT_TO_LE
)
3543 unsupported_reloc_local(object
, r_type
);
3548 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
3549 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
3550 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
3551 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
3552 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
3553 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
3554 layout
->set_has_static_tls();
3555 if (parameters
->options().shared()) {
3556 // defer to dynamic linker
3557 gold_assert(lsym
.get_st_type() != elfcpp::STT_SECTION
);
3559 = elfcpp::elf_r_sym
<size
>(reloc
.get_r_info());
3560 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3561 rela_dyn
->add_symbolless_local_addend(object
, r_sym
, r_type
,
3562 output_section
, data_shndx
,
3563 reloc
.get_r_offset(), 0);
3573 case elfcpp::R_TILEGX_COPY
:
3574 case elfcpp::R_TILEGX_GLOB_DAT
:
3575 case elfcpp::R_TILEGX_JMP_SLOT
:
3576 case elfcpp::R_TILEGX_RELATIVE
:
3577 // These are outstanding tls relocs, which are unexpected when linking
3578 case elfcpp::R_TILEGX_TLS_TPOFF32
:
3579 case elfcpp::R_TILEGX_TLS_TPOFF64
:
3580 case elfcpp::R_TILEGX_TLS_DTPMOD32
:
3581 case elfcpp::R_TILEGX_TLS_DTPMOD64
:
3582 case elfcpp::R_TILEGX_TLS_DTPOFF32
:
3583 case elfcpp::R_TILEGX_TLS_DTPOFF64
:
3584 gold_error(_("%s: unexpected reloc %u in object file"),
3585 object
->name().c_str(), r_type
);
3589 gold_error(_("%s: unsupported reloc %u against local symbol"),
3590 object
->name().c_str(), r_type
);
3596 // Report an unsupported relocation against a global symbol.
3598 template<int size
, bool big_endian
>
3600 Target_tilegx
<size
, big_endian
>::Scan::unsupported_reloc_global(
3601 Sized_relobj_file
<size
, big_endian
>* object
,
3602 unsigned int r_type
,
3605 gold_error(_("%s: unsupported reloc %u against global symbol %s"),
3606 object
->name().c_str(), r_type
, gsym
->demangled_name().c_str());
3609 // Returns true if this relocation type could be that of a function pointer.
3610 template<int size
, bool big_endian
>
3612 Target_tilegx
<size
, big_endian
>::Scan::possible_function_pointer_reloc(
3613 unsigned int r_type
)
3617 case elfcpp::R_TILEGX_IMM16_X0_HW0
:
3618 case elfcpp::R_TILEGX_IMM16_X1_HW0
:
3619 case elfcpp::R_TILEGX_IMM16_X0_HW1
:
3620 case elfcpp::R_TILEGX_IMM16_X1_HW1
:
3621 case elfcpp::R_TILEGX_IMM16_X0_HW2
:
3622 case elfcpp::R_TILEGX_IMM16_X1_HW2
:
3623 case elfcpp::R_TILEGX_IMM16_X0_HW3
:
3624 case elfcpp::R_TILEGX_IMM16_X1_HW3
:
3625 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST
:
3626 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST
:
3627 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST
:
3628 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST
:
3629 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST
:
3630 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST
:
3631 case elfcpp::R_TILEGX_IMM16_X0_HW0_PCREL
:
3632 case elfcpp::R_TILEGX_IMM16_X1_HW0_PCREL
:
3633 case elfcpp::R_TILEGX_IMM16_X0_HW1_PCREL
:
3634 case elfcpp::R_TILEGX_IMM16_X1_HW1_PCREL
:
3635 case elfcpp::R_TILEGX_IMM16_X0_HW2_PCREL
:
3636 case elfcpp::R_TILEGX_IMM16_X1_HW2_PCREL
:
3637 case elfcpp::R_TILEGX_IMM16_X0_HW3_PCREL
:
3638 case elfcpp::R_TILEGX_IMM16_X1_HW3_PCREL
:
3639 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PCREL
:
3640 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PCREL
:
3641 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PCREL
:
3642 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PCREL
:
3643 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PCREL
:
3644 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PCREL
:
3645 case elfcpp::R_TILEGX_IMM16_X0_HW0_GOT
:
3646 case elfcpp::R_TILEGX_IMM16_X1_HW0_GOT
:
3647 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_GOT
:
3648 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_GOT
:
3649 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_GOT
:
3650 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_GOT
:
3658 // For safe ICF, scan a relocation for a local symbol to check if it
3659 // corresponds to a function pointer being taken. In that case mark
3660 // the function whose pointer was taken as not foldable.
3662 template<int size
, bool big_endian
>
3664 Target_tilegx
<size
, big_endian
>::Scan::local_reloc_may_be_function_pointer(
3667 Target_tilegx
<size
, big_endian
>* ,
3668 Sized_relobj_file
<size
, big_endian
>* ,
3671 const elfcpp::Rela
<size
, big_endian
>& ,
3672 unsigned int r_type
,
3673 const elfcpp::Sym
<size
, big_endian
>&)
3675 return possible_function_pointer_reloc(r_type
);
3678 // For safe ICF, scan a relocation for a global symbol to check if it
3679 // corresponds to a function pointer being taken. In that case mark
3680 // the function whose pointer was taken as not foldable.
3682 template<int size
, bool big_endian
>
3684 Target_tilegx
<size
, big_endian
>::Scan::global_reloc_may_be_function_pointer(
3687 Target_tilegx
<size
, big_endian
>* ,
3688 Sized_relobj_file
<size
, big_endian
>* ,
3691 const elfcpp::Rela
<size
, big_endian
>& ,
3692 unsigned int r_type
,
3695 // GOT is not a function.
3696 if (strcmp(gsym
->name(), "_GLOBAL_OFFSET_TABLE_") == 0)
3699 // When building a shared library, do not fold symbols whose visibility
3700 // is hidden, internal or protected.
3701 return ((parameters
->options().shared()
3702 && (gsym
->visibility() == elfcpp::STV_INTERNAL
3703 || gsym
->visibility() == elfcpp::STV_PROTECTED
3704 || gsym
->visibility() == elfcpp::STV_HIDDEN
))
3705 || possible_function_pointer_reloc(r_type
));
3708 // Scan a relocation for a global symbol.
3710 template<int size
, bool big_endian
>
3712 Target_tilegx
<size
, big_endian
>::Scan::global(Symbol_table
* symtab
,
3714 Target_tilegx
<size
, big_endian
>* target
,
3715 Sized_relobj_file
<size
, big_endian
>* object
,
3716 unsigned int data_shndx
,
3717 Output_section
* output_section
,
3718 const elfcpp::Rela
<size
, big_endian
>& reloc
,
3719 unsigned int r_type
,
3722 // A reference to _GLOBAL_OFFSET_TABLE_ implies that we need a got
3723 // section. We check here to avoid creating a dynamic reloc against
3724 // _GLOBAL_OFFSET_TABLE_.
3725 if (!target
->has_got_section()
3726 && strcmp(gsym
->name(), "_GLOBAL_OFFSET_TABLE_") == 0)
3727 target
->got_section(symtab
, layout
);
3729 // A STT_GNU_IFUNC symbol may require a PLT entry.
3730 if (gsym
->type() == elfcpp::STT_GNU_IFUNC
3731 && this->reloc_needs_plt_for_ifunc(object
, r_type
))
3732 target
->make_plt_entry(symtab
, layout
, gsym
);
3736 case elfcpp::R_TILEGX_NONE
:
3737 case elfcpp::R_TILEGX_GNU_VTINHERIT
:
3738 case elfcpp::R_TILEGX_GNU_VTENTRY
:
3741 case elfcpp::R_TILEGX_DEST_IMM8_X1
:
3742 case elfcpp::R_TILEGX_IMM16_X0_HW0
:
3743 case elfcpp::R_TILEGX_IMM16_X1_HW0
:
3744 case elfcpp::R_TILEGX_IMM16_X0_HW1
:
3745 case elfcpp::R_TILEGX_IMM16_X1_HW1
:
3746 case elfcpp::R_TILEGX_IMM16_X0_HW2
:
3747 case elfcpp::R_TILEGX_IMM16_X1_HW2
:
3748 case elfcpp::R_TILEGX_IMM16_X0_HW3
:
3749 case elfcpp::R_TILEGX_IMM16_X1_HW3
:
3750 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST
:
3751 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST
:
3752 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST
:
3753 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST
:
3754 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST
:
3755 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST
:
3756 case elfcpp::R_TILEGX_64
:
3757 case elfcpp::R_TILEGX_32
:
3758 case elfcpp::R_TILEGX_16
:
3759 case elfcpp::R_TILEGX_8
:
3761 // Make a PLT entry if necessary.
3762 if (gsym
->needs_plt_entry())
3764 target
->make_plt_entry(symtab
, layout
, gsym
);
3765 // Since this is not a PC-relative relocation, we may be
3766 // taking the address of a function. In that case we need to
3767 // set the entry in the dynamic symbol table to the address of
3769 if (gsym
->is_from_dynobj() && !parameters
->options().shared())
3770 gsym
->set_needs_dynsym_value();
3772 // Make a dynamic relocation if necessary.
3773 if (gsym
->needs_dynamic_reloc(Scan::get_reference_flags(r_type
)))
3775 if (!parameters
->options().output_is_position_independent()
3776 && gsym
->may_need_copy_reloc())
3778 target
->copy_reloc(symtab
, layout
, object
,
3779 data_shndx
, output_section
, gsym
, reloc
);
3781 else if (((size
== 64 && r_type
== elfcpp::R_TILEGX_64
)
3782 || (size
== 32 && r_type
== elfcpp::R_TILEGX_32
))
3783 && gsym
->type() == elfcpp::STT_GNU_IFUNC
3784 && gsym
->can_use_relative_reloc(false)
3785 && !gsym
->is_from_dynobj()
3786 && !gsym
->is_undefined()
3787 && !gsym
->is_preemptible())
3789 // Use an IRELATIVE reloc for a locally defined
3790 // STT_GNU_IFUNC symbol. This makes a function
3791 // address in a PIE executable match the address in a
3792 // shared library that it links against.
3793 Reloc_section
* rela_dyn
=
3794 target
->rela_irelative_section(layout
);
3795 unsigned int r_type
= elfcpp::R_TILEGX_IRELATIVE
;
3796 rela_dyn
->add_symbolless_global_addend(gsym
, r_type
,
3797 output_section
, object
,
3799 reloc
.get_r_offset(),
3800 reloc
.get_r_addend());
3801 } else if ((r_type
== elfcpp::R_TILEGX_64
3802 || r_type
== elfcpp::R_TILEGX_32
)
3803 && gsym
->can_use_relative_reloc(false))
3805 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3806 rela_dyn
->add_global_relative(gsym
, elfcpp::R_TILEGX_RELATIVE
,
3807 output_section
, object
,
3809 reloc
.get_r_offset(),
3810 reloc
.get_r_addend(), false);
3814 this->check_non_pic(object
, r_type
);
3815 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3816 rela_dyn
->add_global(gsym
, r_type
, output_section
, object
,
3817 data_shndx
, reloc
.get_r_offset(),
3818 reloc
.get_r_addend());
3824 case elfcpp::R_TILEGX_BROFF_X1
:
3825 case elfcpp::R_TILEGX_IMM16_X0_HW0_PCREL
:
3826 case elfcpp::R_TILEGX_IMM16_X1_HW0_PCREL
:
3827 case elfcpp::R_TILEGX_IMM16_X0_HW1_PCREL
:
3828 case elfcpp::R_TILEGX_IMM16_X1_HW1_PCREL
:
3829 case elfcpp::R_TILEGX_IMM16_X0_HW2_PCREL
:
3830 case elfcpp::R_TILEGX_IMM16_X1_HW2_PCREL
:
3831 case elfcpp::R_TILEGX_IMM16_X0_HW3_PCREL
:
3832 case elfcpp::R_TILEGX_IMM16_X1_HW3_PCREL
:
3833 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PCREL
:
3834 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PCREL
:
3835 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PCREL
:
3836 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PCREL
:
3837 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PCREL
:
3838 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PCREL
:
3839 case elfcpp::R_TILEGX_64_PCREL
:
3840 case elfcpp::R_TILEGX_32_PCREL
:
3841 case elfcpp::R_TILEGX_16_PCREL
:
3842 case elfcpp::R_TILEGX_8_PCREL
:
3844 // Make a PLT entry if necessary.
3845 if (gsym
->needs_plt_entry())
3846 target
->make_plt_entry(symtab
, layout
, gsym
);
3847 // Make a dynamic relocation if necessary.
3848 if (gsym
->needs_dynamic_reloc(Scan::get_reference_flags(r_type
)))
3850 if (parameters
->options().output_is_executable()
3851 && gsym
->may_need_copy_reloc())
3853 target
->copy_reloc(symtab
, layout
, object
,
3854 data_shndx
, output_section
, gsym
, reloc
);
3858 this->check_non_pic(object
, r_type
);
3859 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3860 rela_dyn
->add_global(gsym
, r_type
, output_section
, object
,
3861 data_shndx
, reloc
.get_r_offset(),
3862 reloc
.get_r_addend());
3868 case elfcpp::R_TILEGX_IMM16_X0_HW0_GOT
:
3869 case elfcpp::R_TILEGX_IMM16_X1_HW0_GOT
:
3870 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_GOT
:
3871 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_GOT
:
3872 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_GOT
:
3873 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_GOT
:
3875 // The symbol requires a GOT entry.
3876 Output_data_got
<size
, big_endian
>* got
3877 = target
->got_section(symtab
, layout
);
3878 if (gsym
->final_value_is_known())
3880 // For a STT_GNU_IFUNC symbol we want the PLT address.
3881 if (gsym
->type() == elfcpp::STT_GNU_IFUNC
)
3882 got
->add_global_plt(gsym
, GOT_TYPE_STANDARD
);
3884 got
->add_global(gsym
, GOT_TYPE_STANDARD
);
3888 // If this symbol is not fully resolved, we need to add a
3889 // dynamic relocation for it.
3890 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
3892 // Use a GLOB_DAT rather than a RELATIVE reloc if:
3894 // 1) The symbol may be defined in some other module.
3896 // 2) We are building a shared library and this is a
3897 // protected symbol; using GLOB_DAT means that the dynamic
3898 // linker can use the address of the PLT in the main
3899 // executable when appropriate so that function address
3900 // comparisons work.
3902 // 3) This is a STT_GNU_IFUNC symbol in position dependent
3903 // code, again so that function address comparisons work.
3904 if (gsym
->is_from_dynobj()
3905 || gsym
->is_undefined()
3906 || gsym
->is_preemptible()
3907 || (gsym
->visibility() == elfcpp::STV_PROTECTED
3908 && parameters
->options().shared())
3909 || (gsym
->type() == elfcpp::STT_GNU_IFUNC
3910 && parameters
->options().output_is_position_independent()))
3911 got
->add_global_with_rel(gsym
, GOT_TYPE_STANDARD
, rela_dyn
,
3912 elfcpp::R_TILEGX_GLOB_DAT
);
3915 // For a STT_GNU_IFUNC symbol we want to write the PLT
3916 // offset into the GOT, so that function pointer
3917 // comparisons work correctly.
3919 if (gsym
->type() != elfcpp::STT_GNU_IFUNC
)
3920 is_new
= got
->add_global(gsym
, GOT_TYPE_STANDARD
);
3923 is_new
= got
->add_global_plt(gsym
, GOT_TYPE_STANDARD
);
3924 // Tell the dynamic linker to use the PLT address
3925 // when resolving relocations.
3926 if (gsym
->is_from_dynobj()
3927 && !parameters
->options().shared())
3928 gsym
->set_needs_dynsym_value();
3932 unsigned int got_off
= gsym
->got_offset(GOT_TYPE_STANDARD
);
3933 rela_dyn
->add_global_relative(gsym
,
3935 got
, got_off
, 0, false);
3942 // a minor difference here for R_TILEGX_JUMPOFF_X1
3943 // between bfd linker and gold linker for gold, when
3944 // R_TILEGX_JUMPOFF_X1 against global symbol, we
3945 // turn it into JUMPOFF_X1_PLT, otherwise the distance
3946 // to the symbol function may overflow at runtime.
3947 case elfcpp::R_TILEGX_JUMPOFF_X1
:
3949 case elfcpp::R_TILEGX_JUMPOFF_X1_PLT
:
3950 case elfcpp::R_TILEGX_IMM16_X0_HW0_PLT_PCREL
:
3951 case elfcpp::R_TILEGX_IMM16_X1_HW0_PLT_PCREL
:
3952 case elfcpp::R_TILEGX_IMM16_X0_HW1_PLT_PCREL
:
3953 case elfcpp::R_TILEGX_IMM16_X1_HW1_PLT_PCREL
:
3954 case elfcpp::R_TILEGX_IMM16_X0_HW2_PLT_PCREL
:
3955 case elfcpp::R_TILEGX_IMM16_X1_HW2_PLT_PCREL
:
3956 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
:
3957 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
:
3958 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
:
3959 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
:
3960 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
:
3961 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
:
3962 // If the symbol is fully resolved, this is just a PC32 reloc.
3963 // Otherwise we need a PLT entry.
3964 if (gsym
->final_value_is_known())
3966 // If building a shared library, we can also skip the PLT entry
3967 // if the symbol is defined in the output file and is protected
3969 if (gsym
->is_defined()
3970 && !gsym
->is_from_dynobj()
3971 && !gsym
->is_preemptible())
3973 target
->make_plt_entry(symtab
, layout
, gsym
);
3977 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
3978 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
3979 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
3980 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
3981 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
3982 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
3983 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
3984 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
3985 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
3986 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
3987 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
3988 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
3989 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
3990 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
3991 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
3992 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
3993 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
3994 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
3995 case elfcpp::R_TILEGX_TLS_GD_CALL
:
3996 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
3997 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
3998 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
3999 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
4000 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
4001 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
4002 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
4003 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
4004 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
4006 const bool is_final
= gsym
->final_value_is_known();
4007 const tls::Tls_optimization opt_t
=
4008 Target_tilegx
<size
, big_endian
>::optimize_tls_reloc(is_final
,
4013 // only expand to plt against __tls_get_addr in GD model
4014 case elfcpp::R_TILEGX_TLS_GD_CALL
:
4015 if (opt_t
== tls::TLSOPT_NONE
) {
4016 // FIXME: it's better '__tls_get_addr' referenced explictly
4017 if (!target
->tls_get_addr_sym_defined_
) {
4019 options::parse_set(NULL
, "__tls_get_addr",
4020 (gold::options::String_set
*)
4021 ¶meters
->options().undefined());
4022 symtab
->add_undefined_symbols_from_command_line(layout
);
4023 target
->tls_get_addr_sym_defined_
= true;
4024 sym
= symtab
->lookup("__tls_get_addr");
4027 target
->make_plt_entry(symtab
, layout
,
4028 symtab
->lookup("__tls_get_addr"));
4032 // only make effect when applying relocation
4033 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
4034 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
4035 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
4036 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
4037 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
4038 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
4039 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
4040 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
4041 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
4044 // GD: requires two GOT entry for module index and offset
4045 // IE: requires one GOT entry for tp-relative offset
4046 // LE: shouldn't happen for global symbol
4047 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
4048 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
4049 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
4050 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
4051 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
4052 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
4054 if (opt_t
== tls::TLSOPT_NONE
) {
4055 Output_data_got
<size
, big_endian
>* got
4056 = target
->got_section(symtab
, layout
);
4057 got
->add_global_pair_with_rel(gsym
, GOT_TYPE_TLS_PAIR
,
4058 target
->rela_dyn_section(layout
),
4060 ? elfcpp::R_TILEGX_TLS_DTPMOD32
4061 : elfcpp::R_TILEGX_TLS_DTPMOD64
,
4063 ? elfcpp::R_TILEGX_TLS_DTPOFF32
4064 : elfcpp::R_TILEGX_TLS_DTPOFF64
);
4065 } else if (opt_t
== tls::TLSOPT_TO_IE
) {
4066 // Create a GOT entry for the tp-relative offset.
4067 Output_data_got
<size
, big_endian
>* got
4068 = target
->got_section(symtab
, layout
);
4069 got
->add_global_with_rel(gsym
, GOT_TYPE_TLS_OFFSET
,
4070 target
->rela_dyn_section(layout
),
4072 ? elfcpp::R_TILEGX_TLS_TPOFF32
4073 : elfcpp::R_TILEGX_TLS_TPOFF64
);
4074 } else if (opt_t
!= tls::TLSOPT_TO_LE
)
4075 // exteranl symbol should not be optimized to TO_LE
4076 unsupported_reloc_global(object
, r_type
, gsym
);
4081 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
4082 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
4083 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
4084 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
4085 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
4086 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
4088 layout
->set_has_static_tls();
4089 if (opt_t
== tls::TLSOPT_NONE
) {
4090 // Create a GOT entry for the tp-relative offset.
4091 Output_data_got
<size
, big_endian
>* got
4092 = target
->got_section(symtab
, layout
);
4093 got
->add_global_with_rel(gsym
, GOT_TYPE_TLS_OFFSET
,
4094 target
->rela_dyn_section(layout
),
4096 ? elfcpp::R_TILEGX_TLS_TPOFF32
4097 : elfcpp::R_TILEGX_TLS_TPOFF64
);
4098 } else if (opt_t
!= tls::TLSOPT_TO_LE
)
4099 unsupported_reloc_global(object
, r_type
, gsym
);
4104 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
4105 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
4106 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
4107 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
4108 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
4109 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
4110 layout
->set_has_static_tls();
4111 if (parameters
->options().shared()) {
4112 // defer to dynamic linker
4113 Reloc_section
* rela_dyn
= target
->rela_dyn_section(layout
);
4114 rela_dyn
->add_symbolless_global_addend(gsym
, r_type
,
4115 output_section
, object
,
4117 reloc
.get_r_offset(), 0);
4127 // below are outstanding relocs
4128 // should not existed in static linking stage
4129 case elfcpp::R_TILEGX_COPY
:
4130 case elfcpp::R_TILEGX_GLOB_DAT
:
4131 case elfcpp::R_TILEGX_JMP_SLOT
:
4132 case elfcpp::R_TILEGX_RELATIVE
:
4133 case elfcpp::R_TILEGX_TLS_TPOFF32
:
4134 case elfcpp::R_TILEGX_TLS_TPOFF64
:
4135 case elfcpp::R_TILEGX_TLS_DTPMOD32
:
4136 case elfcpp::R_TILEGX_TLS_DTPMOD64
:
4137 case elfcpp::R_TILEGX_TLS_DTPOFF32
:
4138 case elfcpp::R_TILEGX_TLS_DTPOFF64
:
4139 gold_error(_("%s: unexpected reloc %u in object file"),
4140 object
->name().c_str(), r_type
);
4144 gold_error(_("%s: unsupported reloc %u against global symbol %s"),
4145 object
->name().c_str(), r_type
,
4146 gsym
->demangled_name().c_str());
4151 template<int size
, bool big_endian
>
4153 Target_tilegx
<size
, big_endian
>::gc_process_relocs(Symbol_table
* symtab
,
4155 Sized_relobj_file
<size
, big_endian
>* object
,
4156 unsigned int data_shndx
,
4157 unsigned int sh_type
,
4158 const unsigned char* prelocs
,
4160 Output_section
* output_section
,
4161 bool needs_special_offset_handling
,
4162 size_t local_symbol_count
,
4163 const unsigned char* plocal_symbols
)
4165 typedef Target_tilegx
<size
, big_endian
> Tilegx
;
4166 typedef typename Target_tilegx
<size
, big_endian
>::Scan Scan
;
4167 typedef gold::Default_classify_reloc
<elfcpp::SHT_RELA
, size
, big_endian
>
4170 if (sh_type
== elfcpp::SHT_REL
)
4175 gold::gc_process_relocs
<size
, big_endian
, Tilegx
, Scan
, Classify_reloc
>(
4184 needs_special_offset_handling
,
4188 // Scan relocations for a section.
4190 template<int size
, bool big_endian
>
4192 Target_tilegx
<size
, big_endian
>::scan_relocs(Symbol_table
* symtab
,
4194 Sized_relobj_file
<size
, big_endian
>* object
,
4195 unsigned int data_shndx
,
4196 unsigned int sh_type
,
4197 const unsigned char* prelocs
,
4199 Output_section
* output_section
,
4200 bool needs_special_offset_handling
,
4201 size_t local_symbol_count
,
4202 const unsigned char* plocal_symbols
)
4204 typedef Target_tilegx
<size
, big_endian
> Tilegx
;
4205 typedef typename Target_tilegx
<size
, big_endian
>::Scan Scan
;
4206 typedef gold::Default_classify_reloc
<elfcpp::SHT_RELA
, size
, big_endian
>
4209 if (sh_type
== elfcpp::SHT_REL
)
4211 gold_error(_("%s: unsupported REL reloc section"),
4212 object
->name().c_str());
4216 gold::scan_relocs
<size
, big_endian
, Tilegx
, Scan
, Classify_reloc
>(
4225 needs_special_offset_handling
,
4230 template<int size
, bool big_endian
>
4232 Target_tilegx
<size
, big_endian
>::do_define_standard_symbols(
4233 Symbol_table
* symtab
,
4236 Output_section
* feedback_section
= layout
->find_output_section(".feedback");
4238 if (feedback_section
!= NULL
)
4240 symtab
->define_in_output_data("__feedback_section_end",
4242 Symbol_table::PREDEFINED
,
4250 true, // offset_is_from_end
4255 // Finalize the sections.
4257 template<int size
, bool big_endian
>
4259 Target_tilegx
<size
, big_endian
>::do_finalize_sections(
4261 const Input_objects
*,
4262 Symbol_table
* symtab
)
4264 const Reloc_section
* rel_plt
= (this->plt_
== NULL
4266 : this->plt_
->rela_plt());
4267 layout
->add_target_dynamic_tags(false, this->got_plt_
, rel_plt
,
4268 this->rela_dyn_
, true, true);
4270 // Emit any relocs we saved in an attempt to avoid generating COPY
4272 if (this->copy_relocs_
.any_saved_relocs())
4273 this->copy_relocs_
.emit(this->rela_dyn_section(layout
));
4275 // Set the size of the _GLOBAL_OFFSET_TABLE_ symbol to the size of
4276 // the .got section.
4277 Symbol
* sym
= this->global_offset_table_
;
4280 uint64_t data_size
= this->got_
->current_data_size();
4281 symtab
->get_sized_symbol
<size
>(sym
)->set_symsize(data_size
);
4283 // If the .got section is more than 0x8000 bytes, we add
4284 // 0x8000 to the value of _GLOBAL_OFFSET_TABLE_, so that 16
4285 // bit relocations have a greater chance of working.
4286 if (data_size
>= 0x8000)
4287 symtab
->get_sized_symbol
<size
>(sym
)->set_value(
4288 symtab
->get_sized_symbol
<size
>(sym
)->value() + 0x8000);
4291 if (parameters
->doing_static_link()
4292 && (this->plt_
== NULL
|| !this->plt_
->has_irelative_section()))
4294 // If linking statically, make sure that the __rela_iplt symbols
4295 // were defined if necessary, even if we didn't create a PLT.
4296 static const Define_symbol_in_segment syms
[] =
4299 "__rela_iplt_start", // name
4300 elfcpp::PT_LOAD
, // segment_type
4301 elfcpp::PF_W
, // segment_flags_set
4302 elfcpp::PF(0), // segment_flags_clear
4305 elfcpp::STT_NOTYPE
, // type
4306 elfcpp::STB_GLOBAL
, // binding
4307 elfcpp::STV_HIDDEN
, // visibility
4309 Symbol::SEGMENT_START
, // offset_from_base
4313 "__rela_iplt_end", // name
4314 elfcpp::PT_LOAD
, // segment_type
4315 elfcpp::PF_W
, // segment_flags_set
4316 elfcpp::PF(0), // segment_flags_clear
4319 elfcpp::STT_NOTYPE
, // type
4320 elfcpp::STB_GLOBAL
, // binding
4321 elfcpp::STV_HIDDEN
, // visibility
4323 Symbol::SEGMENT_START
, // offset_from_base
4328 symtab
->define_symbols(layout
, 2, syms
,
4329 layout
->script_options()->saw_sections_clause());
4333 // Perform a relocation.
4335 template<int size
, bool big_endian
>
4337 Target_tilegx
<size
, big_endian
>::Relocate::relocate(
4338 const Relocate_info
<size
, big_endian
>* relinfo
,
4340 Target_tilegx
<size
, big_endian
>* target
,
4343 const unsigned char* preloc
,
4344 const Sized_symbol
<size
>* gsym
,
4345 const Symbol_value
<size
>* psymval
,
4346 unsigned char* view
,
4347 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
4353 typedef Tilegx_relocate_functions
<size
, big_endian
> TilegxReloc
;
4354 typename
TilegxReloc::Tilegx_howto r_howto
;
4356 const elfcpp::Rela
<size
, big_endian
> rela(preloc
);
4357 unsigned int r_type
= elfcpp::elf_r_type
<size
>(rela
.get_r_info());
4358 const Sized_relobj_file
<size
, big_endian
>* object
= relinfo
->object
;
4360 // Pick the value to use for symbols defined in the PLT.
4361 Symbol_value
<size
> symval
;
4363 && gsym
->use_plt_offset(Scan::get_reference_flags(r_type
)))
4365 symval
.set_output_value(target
->plt_address_for_global(gsym
));
4368 else if (gsym
== NULL
&& psymval
->is_ifunc_symbol())
4370 unsigned int r_sym
= elfcpp::elf_r_sym
<size
>(rela
.get_r_info());
4371 if (object
->local_has_plt_offset(r_sym
))
4373 symval
.set_output_value(target
->plt_address_for_local(object
, r_sym
));
4378 elfcpp::Elf_Xword addend
= rela
.get_r_addend();
4380 // Get the GOT offset if needed.
4381 // For tilegx, the GOT pointer points to the start of the GOT section.
4382 bool have_got_offset
= false;
4384 int got_base
= target
->got_
!= NULL
4385 ? target
->got_
->current_data_size() >= 0x8000 ? 0x8000 : 0
4387 unsigned int got_type
= GOT_TYPE_STANDARD
;
4388 bool always_apply_relocation
= false;
4391 case elfcpp::R_TILEGX_IMM16_X0_HW0_GOT
:
4392 case elfcpp::R_TILEGX_IMM16_X1_HW0_GOT
:
4393 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_GOT
:
4394 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_GOT
:
4395 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_GOT
:
4396 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_GOT
:
4399 gold_assert(gsym
->has_got_offset(got_type
));
4400 got_offset
= gsym
->got_offset(got_type
) - got_base
;
4404 unsigned int r_sym
= elfcpp::elf_r_sym
<size
>(rela
.get_r_info());
4405 gold_assert(object
->local_has_got_offset(r_sym
, got_type
));
4407 object
->local_got_offset(r_sym
, got_type
) - got_base
;
4409 have_got_offset
= true;
4416 r_howto
= TilegxReloc::howto
[r_type
];
4419 case elfcpp::R_TILEGX_NONE
:
4420 case elfcpp::R_TILEGX_GNU_VTINHERIT
:
4421 case elfcpp::R_TILEGX_GNU_VTENTRY
:
4424 case elfcpp::R_TILEGX_IMM16_X0_HW0_GOT
:
4425 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_GOT
:
4426 case elfcpp::R_TILEGX_IMM16_X1_HW0_GOT
:
4427 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_GOT
:
4428 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_GOT
:
4429 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_GOT
:
4430 gold_assert(have_got_offset
);
4431 symval
.set_output_value(got_offset
);
4433 always_apply_relocation
= true;
4437 // when under PIC mode, these relocations are deferred to rtld
4438 case elfcpp::R_TILEGX_IMM16_X0_HW0
:
4439 case elfcpp::R_TILEGX_IMM16_X1_HW0
:
4440 case elfcpp::R_TILEGX_IMM16_X0_HW1
:
4441 case elfcpp::R_TILEGX_IMM16_X1_HW1
:
4442 case elfcpp::R_TILEGX_IMM16_X0_HW2
:
4443 case elfcpp::R_TILEGX_IMM16_X1_HW2
:
4444 case elfcpp::R_TILEGX_IMM16_X0_HW3
:
4445 case elfcpp::R_TILEGX_IMM16_X1_HW3
:
4446 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST
:
4447 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST
:
4448 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST
:
4449 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST
:
4450 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST
:
4451 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST
:
4452 if (always_apply_relocation
4453 || !parameters
->options().output_is_position_independent())
4454 TilegxReloc::imm_x_general(view
, object
, psymval
, addend
, r_howto
);
4457 case elfcpp::R_TILEGX_JUMPOFF_X1
:
4458 case elfcpp::R_TILEGX_JUMPOFF_X1_PLT
:
4459 gold_assert(gsym
== NULL
4460 || gsym
->has_plt_offset()
4461 || gsym
->final_value_is_known()
4462 || (gsym
->is_defined()
4463 && !gsym
->is_from_dynobj()
4464 && !gsym
->is_preemptible()));
4465 TilegxReloc::imm_x_pcrel_general(view
, object
, psymval
, addend
,
4470 case elfcpp::R_TILEGX_IMM16_X0_HW0_PLT_PCREL
:
4471 case elfcpp::R_TILEGX_IMM16_X0_HW0_PCREL
:
4472 case elfcpp::R_TILEGX_IMM16_X1_HW0_PLT_PCREL
:
4473 case elfcpp::R_TILEGX_IMM16_X1_HW0_PCREL
:
4474 case elfcpp::R_TILEGX_IMM16_X0_HW1_PLT_PCREL
:
4475 case elfcpp::R_TILEGX_IMM16_X0_HW1_PCREL
:
4476 case elfcpp::R_TILEGX_IMM16_X1_HW1_PLT_PCREL
:
4477 case elfcpp::R_TILEGX_IMM16_X1_HW1_PCREL
:
4478 case elfcpp::R_TILEGX_IMM16_X0_HW2_PLT_PCREL
:
4479 case elfcpp::R_TILEGX_IMM16_X0_HW2_PCREL
:
4480 case elfcpp::R_TILEGX_IMM16_X1_HW2_PLT_PCREL
:
4481 case elfcpp::R_TILEGX_IMM16_X1_HW2_PCREL
:
4482 case elfcpp::R_TILEGX_IMM16_X0_HW3_PCREL
:
4483 case elfcpp::R_TILEGX_IMM16_X1_HW3_PCREL
:
4484 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PLT_PCREL
:
4485 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_PCREL
:
4486 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PLT_PCREL
:
4487 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_PCREL
:
4488 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PLT_PCREL
:
4489 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_PCREL
:
4490 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PLT_PCREL
:
4491 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_PCREL
:
4492 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PLT_PCREL
:
4493 case elfcpp::R_TILEGX_IMM16_X0_HW2_LAST_PCREL
:
4494 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PLT_PCREL
:
4495 case elfcpp::R_TILEGX_IMM16_X1_HW2_LAST_PCREL
:
4496 TilegxReloc::imm_x_pcrel_general(view
, object
, psymval
, addend
,
4500 case elfcpp::R_TILEGX_BROFF_X1
:
4501 case elfcpp::R_TILEGX_DEST_IMM8_X1
:
4502 TilegxReloc::imm_x_two_part_general(view
, object
, psymval
,
4503 addend
, address
, r_type
);
4507 // below are general relocation types, which can be
4508 // handled by target-independent handlers
4509 case elfcpp::R_TILEGX_64
:
4510 TilegxReloc::abs64(view
, object
, psymval
, addend
);
4513 case elfcpp::R_TILEGX_64_PCREL
:
4514 TilegxReloc::pc_abs64(view
, object
, psymval
, addend
, address
);
4517 case elfcpp::R_TILEGX_32
:
4518 TilegxReloc::abs32(view
, object
, psymval
, addend
);
4521 case elfcpp::R_TILEGX_32_PCREL
:
4522 TilegxReloc::pc_abs32(view
, object
, psymval
, addend
, address
);
4525 case elfcpp::R_TILEGX_16
:
4526 TilegxReloc::abs16(view
, object
, psymval
, addend
);
4529 case elfcpp::R_TILEGX_16_PCREL
:
4530 TilegxReloc::pc_abs16(view
, object
, psymval
, addend
, address
);
4533 case elfcpp::R_TILEGX_8
:
4534 Relocate_functions
<size
, big_endian
>::rela8(view
, object
,
4538 case elfcpp::R_TILEGX_8_PCREL
:
4539 Relocate_functions
<size
, big_endian
>::pcrela8(view
, object
,
4540 psymval
, addend
, address
);
4543 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
4544 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
4545 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
4546 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
4547 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
4548 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
4549 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
4550 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
4551 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
4552 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
4553 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
4554 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
4555 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
4556 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
4557 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
4558 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
4559 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
4560 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
4561 case elfcpp::R_TILEGX_TLS_GD_CALL
:
4562 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
4563 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
4564 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
4565 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
4566 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
4567 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
4568 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
4569 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
4570 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
4572 const bool is_final
= (gsym
== NULL
4573 ? !parameters
->options().shared()
4574 : gsym
->final_value_is_known());
4575 tls::Tls_optimization opt_t
=
4576 Target_tilegx
<size
, big_endian
>::optimize_tls_reloc(is_final
,
4582 case elfcpp::R_TILEGX_TLS_GD_CALL
:
4584 if (opt_t
== tls::TLSOPT_NONE
) {
4585 Symbol
*tls_sym
= relinfo
->symtab
->lookup("__tls_get_addr");
4586 symval
.set_output_value(
4587 target
->plt_address_for_global(tls_sym
));
4589 TilegxReloc::imm_x_pcrel_general(view
, object
, psymval
,
4590 addend
, address
, r_howto
);
4592 else if (opt_t
== tls::TLSOPT_TO_IE
4593 || opt_t
== tls::TLSOPT_TO_LE
)
4594 TilegxReloc::tls_relax(view
, r_type
, opt_t
);
4598 // XX_TLS_GD is the same as normal X_GOT relocation
4599 // except allocating a got entry pair,
4600 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_GD
:
4601 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_GD
:
4602 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_GD
:
4603 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_GD
:
4604 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_GD
:
4605 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_GD
:
4606 if (opt_t
== tls::TLSOPT_NONE
) {
4607 got_type
= GOT_TYPE_TLS_PAIR
;
4608 have_got_offset
= true;
4609 } else if (opt_t
== tls::TLSOPT_TO_IE
) {
4610 got_type
= GOT_TYPE_TLS_OFFSET
;
4611 have_got_offset
= true;
4613 goto do_update_value
;
4614 // XX_TLS_IE is the same as normal X_GOT relocation
4615 // except allocating one additional runtime relocation
4616 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_IE
:
4617 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_IE
:
4618 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_IE
:
4619 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_IE
:
4620 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_IE
:
4621 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_IE
:
4622 if (opt_t
== tls::TLSOPT_NONE
) {
4623 got_type
= GOT_TYPE_TLS_OFFSET
;
4624 have_got_offset
= true;
4628 if (have_got_offset
) {
4630 gold_assert(gsym
->has_got_offset(got_type
));
4631 got_offset
= gsym
->got_offset(got_type
) - got_base
;
4634 = elfcpp::elf_r_sym
<size
>(rela
.get_r_info());
4635 gold_assert(object
->local_has_got_offset(r_sym
, got_type
));
4637 object
->local_got_offset(r_sym
, got_type
) - got_base
;
4641 if (opt_t
== tls::TLSOPT_NONE
4642 || opt_t
== tls::TLSOPT_TO_IE
) {
4643 // for both GD/IE, these relocations
4644 // actually calculate got offset, so
4645 // there behavior are the same
4646 gold_assert(have_got_offset
);
4647 symval
.set_output_value(got_offset
);
4650 TilegxReloc::imm_x_general(view
, object
, psymval
,
4653 } // else if (opt_t == tls::TLSOPT_TO_LE)
4654 // both GD/IE are turned into LE, which
4655 // is absolute relocation.
4663 // t_var1 | t_var2 | t_var3 | ...
4664 // --------------------------------------------------
4666 // so offset to tp should be negative, we get offset
4667 // from the following formular for LE
4669 // t_var1_off = t_var1_sym_value - tls_section_start
4671 case elfcpp::R_TILEGX_IMM16_X0_HW0_TLS_LE
:
4672 case elfcpp::R_TILEGX_IMM16_X1_HW0_TLS_LE
:
4673 case elfcpp::R_TILEGX_IMM16_X0_HW0_LAST_TLS_LE
:
4674 case elfcpp::R_TILEGX_IMM16_X1_HW0_LAST_TLS_LE
:
4675 case elfcpp::R_TILEGX_IMM16_X0_HW1_LAST_TLS_LE
:
4676 case elfcpp::R_TILEGX_IMM16_X1_HW1_LAST_TLS_LE
:
4678 Output_segment
*tls_segment
= relinfo
->layout
->tls_segment();
4679 if (tls_segment
== NULL
) {
4680 gold_assert(parameters
->errors()->error_count() > 0
4681 || issue_undefined_symbol_error(gsym
));
4685 typename
elfcpp::Elf_types
<size
>::Elf_Addr value
4686 = psymval
->value(relinfo
->object
, 0);
4687 symval
.set_output_value(value
);
4689 TilegxReloc::imm_x_general(view
, object
, psymval
,
4695 case elfcpp::R_TILEGX_TLS_IE_LOAD
:
4696 case elfcpp::R_TILEGX_IMM8_X0_TLS_ADD
:
4697 case elfcpp::R_TILEGX_IMM8_X1_TLS_ADD
:
4698 case elfcpp::R_TILEGX_IMM8_Y0_TLS_ADD
:
4699 case elfcpp::R_TILEGX_IMM8_Y1_TLS_ADD
:
4700 case elfcpp::R_TILEGX_IMM8_X0_TLS_GD_ADD
:
4701 case elfcpp::R_TILEGX_IMM8_X1_TLS_GD_ADD
:
4702 case elfcpp::R_TILEGX_IMM8_Y0_TLS_GD_ADD
:
4703 case elfcpp::R_TILEGX_IMM8_Y1_TLS_GD_ADD
:
4704 TilegxReloc::tls_relax(view
, r_type
, opt_t
);
4713 // below are outstanding relocs
4714 // should not existed in static linking stage
4715 case elfcpp::R_TILEGX_COPY
:
4716 case elfcpp::R_TILEGX_GLOB_DAT
:
4717 case elfcpp::R_TILEGX_JMP_SLOT
:
4718 case elfcpp::R_TILEGX_RELATIVE
:
4719 case elfcpp::R_TILEGX_TLS_TPOFF32
:
4720 case elfcpp::R_TILEGX_TLS_TPOFF64
:
4721 case elfcpp::R_TILEGX_TLS_DTPMOD32
:
4722 case elfcpp::R_TILEGX_TLS_DTPMOD64
:
4723 case elfcpp::R_TILEGX_TLS_DTPOFF32
:
4724 case elfcpp::R_TILEGX_TLS_DTPOFF64
:
4725 gold_error_at_location(relinfo
, relnum
, rela
.get_r_offset(),
4726 _("unexpected reloc %u in object file"),
4731 gold_error_at_location(relinfo
, relnum
, rela
.get_r_offset(),
4732 _("unsupported reloc %u"),
4740 // Relocate section data.
4742 template<int size
, bool big_endian
>
4744 Target_tilegx
<size
, big_endian
>::relocate_section(
4745 const Relocate_info
<size
, big_endian
>* relinfo
,
4746 unsigned int sh_type
,
4747 const unsigned char* prelocs
,
4749 Output_section
* output_section
,
4750 bool needs_special_offset_handling
,
4751 unsigned char* view
,
4752 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
4753 section_size_type view_size
,
4754 const Reloc_symbol_changes
* reloc_symbol_changes
)
4756 typedef Target_tilegx
<size
, big_endian
> Tilegx
;
4757 typedef typename Target_tilegx
<size
, big_endian
>::Relocate Tilegx_relocate
;
4758 typedef gold::Default_classify_reloc
<elfcpp::SHT_RELA
, size
, big_endian
>
4761 gold_assert(sh_type
== elfcpp::SHT_RELA
);
4763 gold::relocate_section
<size
, big_endian
, Tilegx
, Tilegx_relocate
,
4764 gold::Default_comdat_behavior
, Classify_reloc
>(
4770 needs_special_offset_handling
,
4774 reloc_symbol_changes
);
4777 // Apply an incremental relocation. Incremental relocations always refer
4778 // to global symbols.
4780 template<int size
, bool big_endian
>
4782 Target_tilegx
<size
, big_endian
>::apply_relocation(
4783 const Relocate_info
<size
, big_endian
>* relinfo
,
4784 typename
elfcpp::Elf_types
<size
>::Elf_Addr r_offset
,
4785 unsigned int r_type
,
4786 typename
elfcpp::Elf_types
<size
>::Elf_Swxword r_addend
,
4788 unsigned char* view
,
4789 typename
elfcpp::Elf_types
<size
>::Elf_Addr address
,
4790 section_size_type view_size
)
4792 gold::apply_relocation
<size
, big_endian
, Target_tilegx
<size
, big_endian
>,
4793 typename Target_tilegx
<size
, big_endian
>::Relocate
>(
4805 // Scan the relocs during a relocatable link.
4807 template<int size
, bool big_endian
>
4809 Target_tilegx
<size
, big_endian
>::scan_relocatable_relocs(
4810 Symbol_table
* symtab
,
4812 Sized_relobj_file
<size
, big_endian
>* object
,
4813 unsigned int data_shndx
,
4814 unsigned int sh_type
,
4815 const unsigned char* prelocs
,
4817 Output_section
* output_section
,
4818 bool needs_special_offset_handling
,
4819 size_t local_symbol_count
,
4820 const unsigned char* plocal_symbols
,
4821 Relocatable_relocs
* rr
)
4823 typedef gold::Default_classify_reloc
<elfcpp::SHT_RELA
, size
, big_endian
>
4825 typedef gold::Default_scan_relocatable_relocs
<Classify_reloc
>
4826 Scan_relocatable_relocs
;
4828 gold_assert(sh_type
== elfcpp::SHT_RELA
);
4830 gold::scan_relocatable_relocs
<size
, big_endian
, Scan_relocatable_relocs
>(
4838 needs_special_offset_handling
,
4844 // Scan the relocs for --emit-relocs.
4846 template<int size
, bool big_endian
>
4848 Target_tilegx
<size
, big_endian
>::emit_relocs_scan(
4849 Symbol_table
* symtab
,
4851 Sized_relobj_file
<size
, big_endian
>* object
,
4852 unsigned int data_shndx
,
4853 unsigned int sh_type
,
4854 const unsigned char* prelocs
,
4856 Output_section
* output_section
,
4857 bool needs_special_offset_handling
,
4858 size_t local_symbol_count
,
4859 const unsigned char* plocal_syms
,
4860 Relocatable_relocs
* rr
)
4862 typedef gold::Default_classify_reloc
<elfcpp::SHT_RELA
, size
, big_endian
>
4864 typedef gold::Default_emit_relocs_strategy
<Classify_reloc
>
4865 Emit_relocs_strategy
;
4867 gold_assert(sh_type
== elfcpp::SHT_RELA
);
4869 gold::scan_relocatable_relocs
<size
, big_endian
, Emit_relocs_strategy
>(
4877 needs_special_offset_handling
,
4883 // Relocate a section during a relocatable link.
4885 template<int size
, bool big_endian
>
4887 Target_tilegx
<size
, big_endian
>::relocate_relocs(
4888 const Relocate_info
<size
, big_endian
>* relinfo
,
4889 unsigned int sh_type
,
4890 const unsigned char* prelocs
,
4892 Output_section
* output_section
,
4893 typename
elfcpp::Elf_types
<size
>::Elf_Off offset_in_output_section
,
4894 unsigned char* view
,
4895 typename
elfcpp::Elf_types
<size
>::Elf_Addr view_address
,
4896 section_size_type view_size
,
4897 unsigned char* reloc_view
,
4898 section_size_type reloc_view_size
)
4900 typedef gold::Default_classify_reloc
<elfcpp::SHT_RELA
, size
, big_endian
>
4903 gold_assert(sh_type
== elfcpp::SHT_RELA
);
4905 gold::relocate_relocs
<size
, big_endian
, Classify_reloc
>(
4910 offset_in_output_section
,
4918 // Return the value to use for a dynamic which requires special
4919 // treatment. This is how we support equality comparisons of function
4920 // pointers across shared library boundaries, as described in the
4921 // processor specific ABI supplement.
4923 template<int size
, bool big_endian
>
4925 Target_tilegx
<size
, big_endian
>::do_dynsym_value(const Symbol
* gsym
) const
4927 gold_assert(gsym
->is_from_dynobj() && gsym
->has_plt_offset());
4928 return this->plt_address_for_global(gsym
);
4931 // Return the value to use for the base of a DW_EH_PE_datarel offset
4932 // in an FDE. Solaris and SVR4 use DW_EH_PE_datarel because their
4933 // assembler can not write out the difference between two labels in
4934 // different sections, so instead of using a pc-relative value they
4935 // use an offset from the GOT.
4937 template<int size
, bool big_endian
>
4939 Target_tilegx
<size
, big_endian
>::do_ehframe_datarel_base() const
4941 gold_assert(this->global_offset_table_
!= NULL
);
4942 Symbol
* sym
= this->global_offset_table_
;
4943 Sized_symbol
<size
>* ssym
= static_cast<Sized_symbol
<size
>*>(sym
);
4944 return ssym
->value();
4947 // The selector for tilegx object files.
4949 template<int size
, bool big_endian
>
4950 class Target_selector_tilegx
: public Target_selector
4953 Target_selector_tilegx()
4954 : Target_selector(elfcpp::EM_TILEGX
, size
, big_endian
,
4956 ? (big_endian
? "elf64-tilegx-be" : "elf64-tilegx-le")
4957 : (big_endian
? "elf32-tilegx-be"
4958 : "elf32-tilegx-le")),
4960 ? (big_endian
? "elf64tilegx_be" : "elf64tilegx")
4961 : (big_endian
? "elf32tilegx_be" : "elf32tilegx")))
4965 do_instantiate_target()
4966 { return new Target_tilegx
<size
, big_endian
>(); }
4970 Target_selector_tilegx
<64, false> target_selector_tilegx64_le
;
4971 Target_selector_tilegx
<32, false> target_selector_tilegx32_le
;
4972 Target_selector_tilegx
<64, true> target_selector_tilegx64_be
;
4973 Target_selector_tilegx
<32, true> target_selector_tilegx32_be
;
4974 } // End anonymous namespace.