1 // reloc.cc -- relocate input files for gold.
3 // Copyright 2006, 2007 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
25 #include "workqueue.h"
34 // Read_relocs methods.
36 // These tasks just read the relocation information from the file.
37 // After reading it, the start another task to process the
38 // information. These tasks requires access to the file.
40 Task::Is_runnable_type
41 Read_relocs::is_runnable(Workqueue
*)
43 return this->object_
->is_locked() ? IS_LOCKED
: IS_RUNNABLE
;
49 Read_relocs::locks(Workqueue
*)
51 return new Task_locker_obj
<Object
>(*this->object_
);
54 // Read the relocations and then start a Scan_relocs_task.
57 Read_relocs::run(Workqueue
* workqueue
)
59 Read_relocs_data
*rd
= new Read_relocs_data
;
60 this->object_
->read_relocs(rd
);
61 workqueue
->queue_front(new Scan_relocs(this->options_
, this->symtab_
,
62 this->layout_
, this->object_
, rd
,
63 this->symtab_lock_
, this->blocker_
));
66 // Return a debugging name for the task.
69 Read_relocs::get_name() const
71 return "Read_relocs " + this->object_
->name();
74 // Scan_relocs methods.
76 // These tasks scan the relocations read by Read_relocs and mark up
77 // the symbol table to indicate which relocations are required. We
78 // use a lock on the symbol table to keep them from interfering with
81 Task::Is_runnable_type
82 Scan_relocs::is_runnable(Workqueue
*)
84 if (!this->symtab_lock_
->is_writable() || this->object_
->is_locked())
89 // Return the locks we hold: one on the file, one on the symbol table
92 class Scan_relocs::Scan_relocs_locker
: public Task_locker
95 Scan_relocs_locker(Object
* object
, Task_token
& symtab_lock
, Task
* task
,
96 Task_token
& blocker
, Workqueue
* workqueue
)
97 : objlock_(*object
), symtab_locker_(symtab_lock
, task
),
98 blocker_(blocker
, workqueue
)
102 Task_locker_obj
<Object
> objlock_
;
103 Task_locker_write symtab_locker_
;
104 Task_locker_block blocker_
;
108 Scan_relocs::locks(Workqueue
* workqueue
)
110 return new Scan_relocs_locker(this->object_
, *this->symtab_lock_
, this,
111 *this->blocker_
, workqueue
);
117 Scan_relocs::run(Workqueue
*)
119 this->object_
->scan_relocs(this->options_
, this->symtab_
, this->layout_
,
125 // Return a debugging name for the task.
128 Scan_relocs::get_name() const
130 return "Scan_relocs " + this->object_
->name();
133 // Relocate_task methods.
135 // We may have to wait for the output sections to be written.
137 Task::Is_runnable_type
138 Relocate_task::is_runnable(Workqueue
*)
140 if (this->object_
->relocs_must_follow_section_writes()
141 && this->output_sections_blocker_
->is_blocked())
144 if (this->object_
->is_locked())
150 // We want to lock the file while we run. We want to unblock
151 // INPUT_SECTIONS_BLOCKER and FINAL_BLOCKER when we are done.
153 class Relocate_task::Relocate_locker
: public Task_locker
156 Relocate_locker(Task_token
& input_sections_blocker
,
157 Task_token
& final_blocker
, Workqueue
* workqueue
,
159 : input_sections_blocker_(input_sections_blocker
, workqueue
),
160 final_blocker_(final_blocker
, workqueue
),
165 Task_block_token input_sections_blocker_
;
166 Task_block_token final_blocker_
;
167 Task_locker_obj
<Object
> objlock_
;
171 Relocate_task::locks(Workqueue
* workqueue
)
173 return new Relocate_locker(*this->input_sections_blocker_
,
174 *this->final_blocker_
,
182 Relocate_task::run(Workqueue
*)
184 this->object_
->relocate(this->options_
, this->symtab_
, this->layout_
,
188 // Return a debugging name for the task.
191 Relocate_task::get_name() const
193 return "Relocate_task " + this->object_
->name();
196 // Read the relocs and local symbols from the object file and store
197 // the information in RD.
199 template<int size
, bool big_endian
>
201 Sized_relobj
<size
, big_endian
>::do_read_relocs(Read_relocs_data
* rd
)
205 unsigned int shnum
= this->shnum();
209 rd
->relocs
.reserve(shnum
/ 2);
211 std::vector
<Map_to_output
>& map_sections(this->map_to_output());
213 const unsigned char *pshdrs
= this->get_view(this->elf_file_
.shoff(),
214 shnum
* This::shdr_size
,
216 // Skip the first, dummy, section.
217 const unsigned char *ps
= pshdrs
+ This::shdr_size
;
218 for (unsigned int i
= 1; i
< shnum
; ++i
, ps
+= This::shdr_size
)
220 typename
This::Shdr
shdr(ps
);
222 unsigned int sh_type
= shdr
.get_sh_type();
223 if (sh_type
!= elfcpp::SHT_REL
&& sh_type
!= elfcpp::SHT_RELA
)
226 unsigned int shndx
= shdr
.get_sh_info();
229 this->error(_("relocation section %u has bad info %u"),
234 Output_section
* os
= map_sections
[shndx
].output_section
;
238 // We are scanning relocations in order to fill out the GOT and
239 // PLT sections. Relocations for sections which are not
240 // allocated (typically debugging sections) should not add new
241 // GOT and PLT entries. So we skip them.
242 typename
This::Shdr
secshdr(pshdrs
+ shndx
* This::shdr_size
);
243 if ((secshdr
.get_sh_flags() & elfcpp::SHF_ALLOC
) == 0)
246 if (shdr
.get_sh_link() != this->symtab_shndx_
)
248 this->error(_("relocation section %u uses unexpected "
250 i
, shdr
.get_sh_link());
254 off_t sh_size
= shdr
.get_sh_size();
256 unsigned int reloc_size
;
257 if (sh_type
== elfcpp::SHT_REL
)
258 reloc_size
= elfcpp::Elf_sizes
<size
>::rel_size
;
260 reloc_size
= elfcpp::Elf_sizes
<size
>::rela_size
;
261 if (reloc_size
!= shdr
.get_sh_entsize())
263 this->error(_("unexpected entsize for reloc section %u: %lu != %u"),
264 i
, static_cast<unsigned long>(shdr
.get_sh_entsize()),
269 size_t reloc_count
= sh_size
/ reloc_size
;
270 if (static_cast<off_t
>(reloc_count
* reloc_size
) != sh_size
)
272 this->error(_("reloc section %u size %lu uneven"),
273 i
, static_cast<unsigned long>(sh_size
));
277 rd
->relocs
.push_back(Section_relocs());
278 Section_relocs
& sr(rd
->relocs
.back());
280 sr
.data_shndx
= shndx
;
281 sr
.contents
= this->get_lasting_view(shdr
.get_sh_offset(), sh_size
,
283 sr
.sh_type
= sh_type
;
284 sr
.reloc_count
= reloc_count
;
285 sr
.output_section
= os
;
286 sr
.needs_special_offset_handling
= map_sections
[shndx
].offset
== -1;
289 // Read the local symbols.
290 gold_assert(this->symtab_shndx_
!= -1U);
291 if (this->symtab_shndx_
== 0 || this->local_symbol_count_
== 0)
292 rd
->local_symbols
= NULL
;
295 typename
This::Shdr
symtabshdr(pshdrs
296 + this->symtab_shndx_
* This::shdr_size
);
297 gold_assert(symtabshdr
.get_sh_type() == elfcpp::SHT_SYMTAB
);
298 const int sym_size
= This::sym_size
;
299 const unsigned int loccount
= this->local_symbol_count_
;
300 gold_assert(loccount
== symtabshdr
.get_sh_info());
301 off_t locsize
= loccount
* sym_size
;
302 rd
->local_symbols
= this->get_lasting_view(symtabshdr
.get_sh_offset(),
307 // Scan the relocs and adjust the symbol table. This looks for
308 // relocations which require GOT/PLT/COPY relocations.
310 template<int size
, bool big_endian
>
312 Sized_relobj
<size
, big_endian
>::do_scan_relocs(const General_options
& options
,
313 Symbol_table
* symtab
,
315 Read_relocs_data
* rd
)
317 Sized_target
<size
, big_endian
>* target
= this->sized_target();
319 const unsigned char* local_symbols
;
320 if (rd
->local_symbols
== NULL
)
321 local_symbols
= NULL
;
323 local_symbols
= rd
->local_symbols
->data();
325 for (Read_relocs_data::Relocs_list::iterator p
= rd
->relocs
.begin();
326 p
!= rd
->relocs
.end();
329 target
->scan_relocs(options
, symtab
, layout
, this, p
->data_shndx
,
330 p
->sh_type
, p
->contents
->data(), p
->reloc_count
,
331 p
->output_section
, p
->needs_special_offset_handling
,
332 this->local_symbol_count_
,
338 if (rd
->local_symbols
!= NULL
)
340 delete rd
->local_symbols
;
341 rd
->local_symbols
= NULL
;
345 // Relocate the input sections and write out the local symbols.
347 template<int size
, bool big_endian
>
349 Sized_relobj
<size
, big_endian
>::do_relocate(const General_options
& options
,
350 const Symbol_table
* symtab
,
351 const Layout
* layout
,
354 unsigned int shnum
= this->shnum();
356 // Read the section headers.
357 const unsigned char* pshdrs
= this->get_view(this->elf_file_
.shoff(),
358 shnum
* This::shdr_size
,
364 // Make two passes over the sections. The first one copies the
365 // section data to the output file. The second one applies
368 this->write_sections(pshdrs
, of
, &views
);
370 // Apply relocations.
372 this->relocate_sections(options
, symtab
, layout
, pshdrs
, &views
);
374 // Write out the accumulated views.
375 for (unsigned int i
= 1; i
< shnum
; ++i
)
377 if (views
[i
].view
!= NULL
)
379 if (views
[i
].is_input_output_view
)
380 of
->write_input_output_view(views
[i
].offset
, views
[i
].view_size
,
383 of
->write_output_view(views
[i
].offset
, views
[i
].view_size
,
388 // Write out the local symbols.
389 this->write_local_symbols(of
, layout
->sympool());
392 // Write section data to the output file. PSHDRS points to the
393 // section headers. Record the views in *PVIEWS for use when
396 template<int size
, bool big_endian
>
398 Sized_relobj
<size
, big_endian
>::write_sections(const unsigned char* pshdrs
,
402 unsigned int shnum
= this->shnum();
403 std::vector
<Map_to_output
>& map_sections(this->map_to_output());
405 const unsigned char* p
= pshdrs
+ This::shdr_size
;
406 for (unsigned int i
= 1; i
< shnum
; ++i
, p
+= This::shdr_size
)
408 View_size
* pvs
= &(*pviews
)[i
];
412 const Output_section
* os
= map_sections
[i
].output_section
;
415 off_t output_offset
= map_sections
[i
].offset
;
417 typename
This::Shdr
shdr(p
);
419 if (shdr
.get_sh_type() == elfcpp::SHT_NOBITS
)
424 if (output_offset
!= -1)
426 view_start
= os
->offset() + output_offset
;
427 view_size
= shdr
.get_sh_size();
431 view_start
= os
->offset();
432 view_size
= os
->data_size();
438 gold_assert(output_offset
== -1
439 || (output_offset
>= 0
440 && output_offset
+ view_size
<= os
->data_size()));
443 if (output_offset
== -1)
444 view
= of
->get_input_output_view(view_start
, view_size
);
447 view
= of
->get_output_view(view_start
, view_size
);
448 this->read(shdr
.get_sh_offset(), view_size
, view
);
452 pvs
->address
= os
->address();
453 if (output_offset
!= -1)
454 pvs
->address
+= output_offset
;
455 pvs
->offset
= view_start
;
456 pvs
->view_size
= view_size
;
457 pvs
->is_input_output_view
= output_offset
== -1;
461 // Relocate section data. VIEWS points to the section data as views
462 // in the output file.
464 template<int size
, bool big_endian
>
466 Sized_relobj
<size
, big_endian
>::relocate_sections(
467 const General_options
& options
,
468 const Symbol_table
* symtab
,
469 const Layout
* layout
,
470 const unsigned char* pshdrs
,
473 unsigned int shnum
= this->shnum();
474 Sized_target
<size
, big_endian
>* target
= this->sized_target();
476 std::vector
<Map_to_output
>& map_sections(this->map_to_output());
478 Relocate_info
<size
, big_endian
> relinfo
;
479 relinfo
.options
= &options
;
480 relinfo
.symtab
= symtab
;
481 relinfo
.layout
= layout
;
482 relinfo
.object
= this;
484 const unsigned char* p
= pshdrs
+ This::shdr_size
;
485 for (unsigned int i
= 1; i
< shnum
; ++i
, p
+= This::shdr_size
)
487 typename
This::Shdr
shdr(p
);
489 unsigned int sh_type
= shdr
.get_sh_type();
490 if (sh_type
!= elfcpp::SHT_REL
&& sh_type
!= elfcpp::SHT_RELA
)
493 unsigned int index
= shdr
.get_sh_info();
494 if (index
>= this->shnum())
496 this->error(_("relocation section %u has bad info %u"),
501 Output_section
* os
= map_sections
[index
].output_section
;
504 // This relocation section is against a section which we
508 off_t output_offset
= map_sections
[index
].offset
;
510 gold_assert((*pviews
)[index
].view
!= NULL
);
512 if (shdr
.get_sh_link() != this->symtab_shndx_
)
514 gold_error(_("relocation section %u uses unexpected "
516 i
, shdr
.get_sh_link());
520 off_t sh_size
= shdr
.get_sh_size();
521 const unsigned char* prelocs
= this->get_view(shdr
.get_sh_offset(),
524 unsigned int reloc_size
;
525 if (sh_type
== elfcpp::SHT_REL
)
526 reloc_size
= elfcpp::Elf_sizes
<size
>::rel_size
;
528 reloc_size
= elfcpp::Elf_sizes
<size
>::rela_size
;
530 if (reloc_size
!= shdr
.get_sh_entsize())
532 gold_error(_("unexpected entsize for reloc section %u: %lu != %u"),
533 i
, static_cast<unsigned long>(shdr
.get_sh_entsize()),
538 size_t reloc_count
= sh_size
/ reloc_size
;
539 if (static_cast<off_t
>(reloc_count
* reloc_size
) != sh_size
)
541 gold_error(_("reloc section %u size %lu uneven"),
542 i
, static_cast<unsigned long>(sh_size
));
546 relinfo
.reloc_shndx
= i
;
547 relinfo
.data_shndx
= index
;
548 target
->relocate_section(&relinfo
,
554 (*pviews
)[index
].view
,
555 (*pviews
)[index
].address
,
556 (*pviews
)[index
].view_size
);
560 // Copy_relocs::Copy_reloc_entry methods.
562 // Return whether we should emit this reloc. We should emit it if the
563 // symbol is still defined in a dynamic object. If we should not emit
564 // it, we clear it, to save ourselves the test next time.
566 template<int size
, bool big_endian
>
568 Copy_relocs
<size
, big_endian
>::Copy_reloc_entry::should_emit()
570 if (this->sym_
== NULL
)
572 if (this->sym_
->is_from_dynobj())
578 // Emit a reloc into a SHT_REL section.
580 template<int size
, bool big_endian
>
582 Copy_relocs
<size
, big_endian
>::Copy_reloc_entry::emit(
583 Output_data_reloc
<elfcpp::SHT_REL
, true, size
, big_endian
>* reloc_data
)
585 this->sym_
->set_needs_dynsym_entry();
586 reloc_data
->add_global(this->sym_
, this->reloc_type_
, this->output_section_
,
587 this->relobj_
, this->shndx_
, this->address_
);
590 // Emit a reloc into a SHT_RELA section.
592 template<int size
, bool big_endian
>
594 Copy_relocs
<size
, big_endian
>::Copy_reloc_entry::emit(
595 Output_data_reloc
<elfcpp::SHT_RELA
, true, size
, big_endian
>* reloc_data
)
597 this->sym_
->set_needs_dynsym_entry();
598 reloc_data
->add_global(this->sym_
, this->reloc_type_
, this->output_section_
,
599 this->relobj_
, this->shndx_
, this->address_
,
603 // Copy_relocs methods.
605 // Return whether we need a COPY reloc for a relocation against GSYM.
606 // The relocation is being applied to section SHNDX in OBJECT.
608 template<int size
, bool big_endian
>
610 Copy_relocs
<size
, big_endian
>::need_copy_reloc(
611 const General_options
*,
614 Sized_symbol
<size
>* sym
)
616 // FIXME: Handle -z nocopyrelocs.
618 if (sym
->symsize() == 0)
621 // If this is a readonly section, then we need a COPY reloc.
622 // Otherwise we can use a dynamic reloc.
623 if ((object
->section_flags(shndx
) & elfcpp::SHF_WRITE
) == 0)
631 template<int size
, bool big_endian
>
633 Copy_relocs
<size
, big_endian
>::save(
637 Output_section
* output_section
,
638 const elfcpp::Rel
<size
, big_endian
>& rel
)
640 unsigned int reloc_type
= elfcpp::elf_r_type
<size
>(rel
.get_r_info());
641 this->entries_
.push_back(Copy_reloc_entry(sym
, reloc_type
, relobj
, shndx
,
643 rel
.get_r_offset(), 0));
646 // Save a Rela reloc.
648 template<int size
, bool big_endian
>
650 Copy_relocs
<size
, big_endian
>::save(
654 Output_section
* output_section
,
655 const elfcpp::Rela
<size
, big_endian
>& rela
)
657 unsigned int reloc_type
= elfcpp::elf_r_type
<size
>(rela
.get_r_info());
658 this->entries_
.push_back(Copy_reloc_entry(sym
, reloc_type
, relobj
, shndx
,
661 rela
.get_r_addend()));
664 // Return whether there are any relocs to emit. We don't want to emit
665 // a reloc if the symbol is no longer defined in a dynamic object.
667 template<int size
, bool big_endian
>
669 Copy_relocs
<size
, big_endian
>::any_to_emit()
671 for (typename
Copy_reloc_entries::iterator p
= this->entries_
.begin();
672 p
!= this->entries_
.end();
675 if (p
->should_emit())
683 template<int size
, bool big_endian
>
684 template<int sh_type
>
686 Copy_relocs
<size
, big_endian
>::emit(
687 Output_data_reloc
<sh_type
, true, size
, big_endian
>* reloc_data
)
689 for (typename
Copy_reloc_entries::iterator p
= this->entries_
.begin();
690 p
!= this->entries_
.end();
693 if (p
->should_emit())
698 // Track_relocs methods.
700 // Initialize the class to track the relocs. This gets the object,
701 // the reloc section index, and the type of the relocs. This returns
702 // false if something goes wrong.
704 template<int size
, bool big_endian
>
706 Track_relocs
<size
, big_endian
>::initialize(
708 unsigned int reloc_shndx
,
709 unsigned int reloc_type
)
711 // If RELOC_SHNDX is -1U, it means there is more than one reloc
712 // section for the .eh_frame section. We can't handle that case.
713 if (reloc_shndx
== -1U)
716 // If RELOC_SHNDX is 0, there is no reloc section.
717 if (reloc_shndx
== 0)
720 // Get the contents of the reloc section.
721 this->prelocs_
= object
->section_contents(reloc_shndx
, &this->len_
, false);
723 if (reloc_type
== elfcpp::SHT_REL
)
724 this->reloc_size_
= elfcpp::Elf_sizes
<size
>::rel_size
;
725 else if (reloc_type
== elfcpp::SHT_RELA
)
726 this->reloc_size_
= elfcpp::Elf_sizes
<size
>::rela_size
;
730 if (this->len_
% this->reloc_size_
!= 0)
732 object
->error(_("reloc section size %zu is not a multiple of "
734 static_cast<size_t>(this->len_
),
742 // Return the offset of the next reloc, or -1 if there isn't one.
744 template<int size
, bool big_endian
>
746 Track_relocs
<size
, big_endian
>::next_offset() const
748 if (this->pos_
>= this->len_
)
751 // Rel and Rela start out the same, so we can always use Rel to find
752 // the r_offset value.
753 elfcpp::Rel
<size
, big_endian
> rel(this->prelocs_
+ this->pos_
);
754 return rel
.get_r_offset();
757 // Return the index of the symbol referenced by the next reloc, or -1U
758 // if there aren't any more relocs.
760 template<int size
, bool big_endian
>
762 Track_relocs
<size
, big_endian
>::next_symndx() const
764 if (this->pos_
>= this->len_
)
767 // Rel and Rela start out the same, so we can use Rel to find the
769 elfcpp::Rel
<size
, big_endian
> rel(this->prelocs_
+ this->pos_
);
770 return elfcpp::elf_r_sym
<size
>(rel
.get_r_info());
773 // Advance to the next reloc whose r_offset is greater than or equal
774 // to OFFSET. Return the number of relocs we skip.
776 template<int size
, bool big_endian
>
778 Track_relocs
<size
, big_endian
>::advance(off_t offset
)
781 while (this->pos_
< this->len_
)
783 // Rel and Rela start out the same, so we can always use Rel to
784 // find the r_offset value.
785 elfcpp::Rel
<size
, big_endian
> rel(this->prelocs_
+ this->pos_
);
786 if (static_cast<off_t
>(rel
.get_r_offset()) >= offset
)
789 this->pos_
+= this->reloc_size_
;
794 // Instantiate the templates we need. We could use the configure
795 // script to restrict this to only the ones for implemented targets.
797 #ifdef HAVE_TARGET_32_LITTLE
800 Sized_relobj
<32, false>::do_read_relocs(Read_relocs_data
* rd
);
803 #ifdef HAVE_TARGET_32_BIG
806 Sized_relobj
<32, true>::do_read_relocs(Read_relocs_data
* rd
);
809 #ifdef HAVE_TARGET_64_LITTLE
812 Sized_relobj
<64, false>::do_read_relocs(Read_relocs_data
* rd
);
815 #ifdef HAVE_TARGET_64_BIG
818 Sized_relobj
<64, true>::do_read_relocs(Read_relocs_data
* rd
);
821 #ifdef HAVE_TARGET_32_LITTLE
824 Sized_relobj
<32, false>::do_scan_relocs(const General_options
& options
,
825 Symbol_table
* symtab
,
827 Read_relocs_data
* rd
);
830 #ifdef HAVE_TARGET_32_BIG
833 Sized_relobj
<32, true>::do_scan_relocs(const General_options
& options
,
834 Symbol_table
* symtab
,
836 Read_relocs_data
* rd
);
839 #ifdef HAVE_TARGET_64_LITTLE
842 Sized_relobj
<64, false>::do_scan_relocs(const General_options
& options
,
843 Symbol_table
* symtab
,
845 Read_relocs_data
* rd
);
848 #ifdef HAVE_TARGET_64_BIG
851 Sized_relobj
<64, true>::do_scan_relocs(const General_options
& options
,
852 Symbol_table
* symtab
,
854 Read_relocs_data
* rd
);
857 #ifdef HAVE_TARGET_32_LITTLE
860 Sized_relobj
<32, false>::do_relocate(const General_options
& options
,
861 const Symbol_table
* symtab
,
862 const Layout
* layout
,
866 #ifdef HAVE_TARGET_32_BIG
869 Sized_relobj
<32, true>::do_relocate(const General_options
& options
,
870 const Symbol_table
* symtab
,
871 const Layout
* layout
,
875 #ifdef HAVE_TARGET_64_LITTLE
878 Sized_relobj
<64, false>::do_relocate(const General_options
& options
,
879 const Symbol_table
* symtab
,
880 const Layout
* layout
,
884 #ifdef HAVE_TARGET_64_BIG
887 Sized_relobj
<64, true>::do_relocate(const General_options
& options
,
888 const Symbol_table
* symtab
,
889 const Layout
* layout
,
893 #ifdef HAVE_TARGET_32_LITTLE
895 class Copy_relocs
<32, false>;
898 #ifdef HAVE_TARGET_32_BIG
900 class Copy_relocs
<32, true>;
903 #ifdef HAVE_TARGET_64_LITTLE
905 class Copy_relocs
<64, false>;
908 #ifdef HAVE_TARGET_64_BIG
910 class Copy_relocs
<64, true>;
913 #ifdef HAVE_TARGET_32_LITTLE
916 Copy_relocs
<32, false>::emit
<elfcpp::SHT_REL
>(
917 Output_data_reloc
<elfcpp::SHT_REL
, true, 32, false>*);
920 #ifdef HAVE_TARGET_32_BIG
923 Copy_relocs
<32, true>::emit
<elfcpp::SHT_REL
>(
924 Output_data_reloc
<elfcpp::SHT_REL
, true, 32, true>*);
927 #ifdef HAVE_TARGET_64_LITTLE
930 Copy_relocs
<64, false>::emit
<elfcpp::SHT_REL
>(
931 Output_data_reloc
<elfcpp::SHT_REL
, true, 64, false>*);
934 #ifdef HAVE_TARGET_64_BIG
937 Copy_relocs
<64, true>::emit
<elfcpp::SHT_REL
>(
938 Output_data_reloc
<elfcpp::SHT_REL
, true, 64, true>*);
941 #ifdef HAVE_TARGET_32_LITTLE
944 Copy_relocs
<32, false>::emit
<elfcpp::SHT_RELA
>(
945 Output_data_reloc
<elfcpp::SHT_RELA
, true, 32, false>*);
948 #ifdef HAVE_TARGET_32_BIG
951 Copy_relocs
<32, true>::emit
<elfcpp::SHT_RELA
>(
952 Output_data_reloc
<elfcpp::SHT_RELA
, true, 32, true>*);
955 #ifdef HAVE_TARGET_64_LITTLE
958 Copy_relocs
<64, false>::emit
<elfcpp::SHT_RELA
>(
959 Output_data_reloc
<elfcpp::SHT_RELA
, true, 64, false>*);
962 #ifdef HAVE_TARGET_64_BIG
965 Copy_relocs
<64, true>::emit
<elfcpp::SHT_RELA
>(
966 Output_data_reloc
<elfcpp::SHT_RELA
, true, 64, true>*);
969 #ifdef HAVE_TARGET_32_LITTLE
971 class Track_relocs
<32, false>;
974 #ifdef HAVE_TARGET_32_BIG
976 class Track_relocs
<32, true>;
979 #ifdef HAVE_TARGET_64_LITTLE
981 class Track_relocs
<64, false>;
984 #ifdef HAVE_TARGET_64_BIG
986 class Track_relocs
<64, true>;
989 } // End namespace gold.