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.
41 Read_relocs::is_runnable()
43 return this->object_
->is_locked() ? this->object_
->token() : NULL
;
49 Read_relocs::locks(Task_locker
* tl
)
51 tl
->add(this, this->object_
->token());
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 this->object_
->release();
63 workqueue
->queue_front(new Scan_relocs(this->options_
, this->symtab_
,
64 this->layout_
, this->object_
, rd
,
65 this->symtab_lock_
, this->blocker_
));
68 // Return a debugging name for the task.
71 Read_relocs::get_name() const
73 return "Read_relocs " + this->object_
->name();
76 // Scan_relocs methods.
78 // These tasks scan the relocations read by Read_relocs and mark up
79 // the symbol table to indicate which relocations are required. We
80 // use a lock on the symbol table to keep them from interfering with
84 Scan_relocs::is_runnable()
86 if (!this->symtab_lock_
->is_writable())
87 return this->symtab_lock_
;
88 if (this->object_
->is_locked())
89 return this->object_
->token();
93 // Return the locks we hold: one on the file, one on the symbol table
97 Scan_relocs::locks(Task_locker
* tl
)
99 tl
->add(this, this->object_
->token());
100 tl
->add(this, this->symtab_lock_
);
101 tl
->add(this, this->blocker_
);
107 Scan_relocs::run(Workqueue
*)
109 this->object_
->scan_relocs(this->options_
, this->symtab_
, this->layout_
,
111 this->object_
->release();
116 // Return a debugging name for the task.
119 Scan_relocs::get_name() const
121 return "Scan_relocs " + this->object_
->name();
124 // Relocate_task methods.
126 // We may have to wait for the output sections to be written.
129 Relocate_task::is_runnable()
131 if (this->object_
->relocs_must_follow_section_writes()
132 && this->output_sections_blocker_
->is_blocked())
133 return this->output_sections_blocker_
;
135 if (this->object_
->is_locked())
136 return this->object_
->token();
141 // We want to lock the file while we run. We want to unblock
142 // INPUT_SECTIONS_BLOCKER and FINAL_BLOCKER when we are done.
143 // INPUT_SECTIONS_BLOCKER may be NULL.
146 Relocate_task::locks(Task_locker
* tl
)
148 if (this->input_sections_blocker_
!= NULL
)
149 tl
->add(this, this->input_sections_blocker_
);
150 tl
->add(this, this->final_blocker_
);
151 tl
->add(this, this->object_
->token());
157 Relocate_task::run(Workqueue
*)
159 this->object_
->relocate(this->options_
, this->symtab_
, this->layout_
,
161 this->object_
->release();
164 // Return a debugging name for the task.
167 Relocate_task::get_name() const
169 return "Relocate_task " + this->object_
->name();
172 // Read the relocs and local symbols from the object file and store
173 // the information in RD.
175 template<int size
, bool big_endian
>
177 Sized_relobj
<size
, big_endian
>::do_read_relocs(Read_relocs_data
* rd
)
181 unsigned int shnum
= this->shnum();
185 rd
->relocs
.reserve(shnum
/ 2);
187 std::vector
<Map_to_output
>& map_sections(this->map_to_output());
189 const unsigned char *pshdrs
= this->get_view(this->elf_file_
.shoff(),
190 shnum
* This::shdr_size
,
192 // Skip the first, dummy, section.
193 const unsigned char *ps
= pshdrs
+ This::shdr_size
;
194 for (unsigned int i
= 1; i
< shnum
; ++i
, ps
+= This::shdr_size
)
196 typename
This::Shdr
shdr(ps
);
198 unsigned int sh_type
= shdr
.get_sh_type();
199 if (sh_type
!= elfcpp::SHT_REL
&& sh_type
!= elfcpp::SHT_RELA
)
202 unsigned int shndx
= shdr
.get_sh_info();
205 this->error(_("relocation section %u has bad info %u"),
210 Output_section
* os
= map_sections
[shndx
].output_section
;
214 // We are scanning relocations in order to fill out the GOT and
215 // PLT sections. Relocations for sections which are not
216 // allocated (typically debugging sections) should not add new
217 // GOT and PLT entries. So we skip them.
218 typename
This::Shdr
secshdr(pshdrs
+ shndx
* This::shdr_size
);
219 if ((secshdr
.get_sh_flags() & elfcpp::SHF_ALLOC
) == 0)
222 if (shdr
.get_sh_link() != this->symtab_shndx_
)
224 this->error(_("relocation section %u uses unexpected "
226 i
, shdr
.get_sh_link());
230 off_t sh_size
= shdr
.get_sh_size();
232 unsigned int reloc_size
;
233 if (sh_type
== elfcpp::SHT_REL
)
234 reloc_size
= elfcpp::Elf_sizes
<size
>::rel_size
;
236 reloc_size
= elfcpp::Elf_sizes
<size
>::rela_size
;
237 if (reloc_size
!= shdr
.get_sh_entsize())
239 this->error(_("unexpected entsize for reloc section %u: %lu != %u"),
240 i
, static_cast<unsigned long>(shdr
.get_sh_entsize()),
245 size_t reloc_count
= sh_size
/ reloc_size
;
246 if (static_cast<off_t
>(reloc_count
* reloc_size
) != sh_size
)
248 this->error(_("reloc section %u size %lu uneven"),
249 i
, static_cast<unsigned long>(sh_size
));
253 rd
->relocs
.push_back(Section_relocs());
254 Section_relocs
& sr(rd
->relocs
.back());
256 sr
.data_shndx
= shndx
;
257 sr
.contents
= this->get_lasting_view(shdr
.get_sh_offset(), sh_size
,
259 sr
.sh_type
= sh_type
;
260 sr
.reloc_count
= reloc_count
;
261 sr
.output_section
= os
;
262 sr
.needs_special_offset_handling
= map_sections
[shndx
].offset
== -1;
265 // Read the local symbols.
266 gold_assert(this->symtab_shndx_
!= -1U);
267 if (this->symtab_shndx_
== 0 || this->local_symbol_count_
== 0)
268 rd
->local_symbols
= NULL
;
271 typename
This::Shdr
symtabshdr(pshdrs
272 + this->symtab_shndx_
* This::shdr_size
);
273 gold_assert(symtabshdr
.get_sh_type() == elfcpp::SHT_SYMTAB
);
274 const int sym_size
= This::sym_size
;
275 const unsigned int loccount
= this->local_symbol_count_
;
276 gold_assert(loccount
== symtabshdr
.get_sh_info());
277 off_t locsize
= loccount
* sym_size
;
278 rd
->local_symbols
= this->get_lasting_view(symtabshdr
.get_sh_offset(),
283 // Scan the relocs and adjust the symbol table. This looks for
284 // relocations which require GOT/PLT/COPY relocations.
286 template<int size
, bool big_endian
>
288 Sized_relobj
<size
, big_endian
>::do_scan_relocs(const General_options
& options
,
289 Symbol_table
* symtab
,
291 Read_relocs_data
* rd
)
293 Sized_target
<size
, big_endian
>* target
= this->sized_target();
295 const unsigned char* local_symbols
;
296 if (rd
->local_symbols
== NULL
)
297 local_symbols
= NULL
;
299 local_symbols
= rd
->local_symbols
->data();
301 for (Read_relocs_data::Relocs_list::iterator p
= rd
->relocs
.begin();
302 p
!= rd
->relocs
.end();
305 target
->scan_relocs(options
, symtab
, layout
, this, p
->data_shndx
,
306 p
->sh_type
, p
->contents
->data(), p
->reloc_count
,
307 p
->output_section
, p
->needs_special_offset_handling
,
308 this->local_symbol_count_
,
314 if (rd
->local_symbols
!= NULL
)
316 delete rd
->local_symbols
;
317 rd
->local_symbols
= NULL
;
321 // Relocate the input sections and write out the local symbols.
323 template<int size
, bool big_endian
>
325 Sized_relobj
<size
, big_endian
>::do_relocate(const General_options
& options
,
326 const Symbol_table
* symtab
,
327 const Layout
* layout
,
330 unsigned int shnum
= this->shnum();
332 // Read the section headers.
333 const unsigned char* pshdrs
= this->get_view(this->elf_file_
.shoff(),
334 shnum
* This::shdr_size
,
340 // Make two passes over the sections. The first one copies the
341 // section data to the output file. The second one applies
344 this->write_sections(pshdrs
, of
, &views
);
346 // Apply relocations.
348 this->relocate_sections(options
, symtab
, layout
, pshdrs
, &views
);
350 // Write out the accumulated views.
351 for (unsigned int i
= 1; i
< shnum
; ++i
)
353 if (views
[i
].view
!= NULL
)
355 if (!views
[i
].is_postprocessing_view
)
357 if (views
[i
].is_input_output_view
)
358 of
->write_input_output_view(views
[i
].offset
,
362 of
->write_output_view(views
[i
].offset
, views
[i
].view_size
,
368 // Write out the local symbols.
369 this->write_local_symbols(of
, layout
->sympool(), layout
->dynpool());
372 // Write section data to the output file. PSHDRS points to the
373 // section headers. Record the views in *PVIEWS for use when
376 template<int size
, bool big_endian
>
378 Sized_relobj
<size
, big_endian
>::write_sections(const unsigned char* pshdrs
,
382 unsigned int shnum
= this->shnum();
383 const std::vector
<Map_to_output
>& map_sections(this->map_to_output());
385 const unsigned char* p
= pshdrs
+ This::shdr_size
;
386 for (unsigned int i
= 1; i
< shnum
; ++i
, p
+= This::shdr_size
)
388 View_size
* pvs
= &(*pviews
)[i
];
392 const Output_section
* os
= map_sections
[i
].output_section
;
395 off_t output_offset
= map_sections
[i
].offset
;
397 typename
This::Shdr
shdr(p
);
399 if (shdr
.get_sh_type() == elfcpp::SHT_NOBITS
)
402 // In the normal case, this input section is simply mapped to
403 // the output section at offset OUTPUT_OFFSET.
405 // However, if OUTPUT_OFFSET == -1, then input data is handled
406 // specially--e.g., a .eh_frame section. The relocation
407 // routines need to check for each reloc where it should be
408 // applied. For this case, we need an input/output view for the
409 // entire contents of the section in the output file. We don't
410 // want to copy the contents of the input section to the output
411 // section; the output section contents were already written,
412 // and we waited for them in Relocate_task::is_runnable because
413 // relocs_must_follow_section_writes is set for the object.
415 // Regardless of which of the above cases is true, we have to
416 // check requires_postprocessing of the output section. If that
417 // is false, then we work with views of the output file
418 // directly. If it is true, then we work with a separate
419 // buffer, and the output section is responsible for writing the
420 // final data to the output file.
422 off_t output_section_offset
;
423 off_t output_section_size
;
424 if (!os
->requires_postprocessing())
426 output_section_offset
= os
->offset();
427 output_section_size
= os
->data_size();
431 output_section_offset
= 0;
432 output_section_size
= os
->postprocessing_buffer_size();
436 section_size_type view_size
;
437 if (output_offset
!= -1)
439 view_start
= output_section_offset
+ output_offset
;
440 view_size
= convert_to_section_size_type(shdr
.get_sh_size());
444 view_start
= output_section_offset
;
445 view_size
= convert_to_section_size_type(output_section_size
);
451 gold_assert(output_offset
== -1
452 || (output_offset
>= 0
453 && output_offset
+ view_size
<= output_section_size
));
456 if (os
->requires_postprocessing())
458 unsigned char* buffer
= os
->postprocessing_buffer();
459 view
= buffer
+ view_start
;
460 if (output_offset
!= -1)
461 this->read(shdr
.get_sh_offset(), view_size
, view
);
465 if (output_offset
== -1)
466 view
= of
->get_input_output_view(view_start
, view_size
);
469 view
= of
->get_output_view(view_start
, view_size
);
470 this->read(shdr
.get_sh_offset(), view_size
, view
);
475 pvs
->address
= os
->address();
476 if (output_offset
!= -1)
477 pvs
->address
+= output_offset
;
478 pvs
->offset
= view_start
;
479 pvs
->view_size
= view_size
;
480 pvs
->is_input_output_view
= output_offset
== -1;
481 pvs
->is_postprocessing_view
= os
->requires_postprocessing();
485 // Relocate section data. VIEWS points to the section data as views
486 // in the output file.
488 template<int size
, bool big_endian
>
490 Sized_relobj
<size
, big_endian
>::relocate_sections(
491 const General_options
& options
,
492 const Symbol_table
* symtab
,
493 const Layout
* layout
,
494 const unsigned char* pshdrs
,
497 unsigned int shnum
= this->shnum();
498 Sized_target
<size
, big_endian
>* target
= this->sized_target();
500 const std::vector
<Map_to_output
>& map_sections(this->map_to_output());
502 Relocate_info
<size
, big_endian
> relinfo
;
503 relinfo
.options
= &options
;
504 relinfo
.symtab
= symtab
;
505 relinfo
.layout
= layout
;
506 relinfo
.object
= this;
508 const unsigned char* p
= pshdrs
+ This::shdr_size
;
509 for (unsigned int i
= 1; i
< shnum
; ++i
, p
+= This::shdr_size
)
511 typename
This::Shdr
shdr(p
);
513 unsigned int sh_type
= shdr
.get_sh_type();
514 if (sh_type
!= elfcpp::SHT_REL
&& sh_type
!= elfcpp::SHT_RELA
)
517 unsigned int index
= shdr
.get_sh_info();
518 if (index
>= this->shnum())
520 this->error(_("relocation section %u has bad info %u"),
525 Output_section
* os
= map_sections
[index
].output_section
;
528 // This relocation section is against a section which we
532 off_t output_offset
= map_sections
[index
].offset
;
534 gold_assert((*pviews
)[index
].view
!= NULL
);
536 if (shdr
.get_sh_link() != this->symtab_shndx_
)
538 gold_error(_("relocation section %u uses unexpected "
540 i
, shdr
.get_sh_link());
544 off_t sh_size
= shdr
.get_sh_size();
545 const unsigned char* prelocs
= this->get_view(shdr
.get_sh_offset(),
548 unsigned int reloc_size
;
549 if (sh_type
== elfcpp::SHT_REL
)
550 reloc_size
= elfcpp::Elf_sizes
<size
>::rel_size
;
552 reloc_size
= elfcpp::Elf_sizes
<size
>::rela_size
;
554 if (reloc_size
!= shdr
.get_sh_entsize())
556 gold_error(_("unexpected entsize for reloc section %u: %lu != %u"),
557 i
, static_cast<unsigned long>(shdr
.get_sh_entsize()),
562 size_t reloc_count
= sh_size
/ reloc_size
;
563 if (static_cast<off_t
>(reloc_count
* reloc_size
) != sh_size
)
565 gold_error(_("reloc section %u size %lu uneven"),
566 i
, static_cast<unsigned long>(sh_size
));
570 gold_assert(output_offset
!= -1
571 || this->relocs_must_follow_section_writes());
573 relinfo
.reloc_shndx
= i
;
574 relinfo
.data_shndx
= index
;
575 target
->relocate_section(&relinfo
,
581 (*pviews
)[index
].view
,
582 (*pviews
)[index
].address
,
583 (*pviews
)[index
].view_size
);
587 // Copy_relocs::Copy_reloc_entry methods.
589 // Return whether we should emit this reloc. We should emit it if the
590 // symbol is still defined in a dynamic object. If we should not emit
591 // it, we clear it, to save ourselves the test next time.
593 template<int size
, bool big_endian
>
595 Copy_relocs
<size
, big_endian
>::Copy_reloc_entry::should_emit()
597 if (this->sym_
== NULL
)
599 if (this->sym_
->is_from_dynobj())
605 // Emit a reloc into a SHT_REL section.
607 template<int size
, bool big_endian
>
609 Copy_relocs
<size
, big_endian
>::Copy_reloc_entry::emit(
610 Output_data_reloc
<elfcpp::SHT_REL
, true, size
, big_endian
>* reloc_data
)
612 this->sym_
->set_needs_dynsym_entry();
613 reloc_data
->add_global(this->sym_
, this->reloc_type_
, this->output_section_
,
614 this->relobj_
, this->shndx_
, this->address_
);
617 // Emit a reloc into a SHT_RELA section.
619 template<int size
, bool big_endian
>
621 Copy_relocs
<size
, big_endian
>::Copy_reloc_entry::emit(
622 Output_data_reloc
<elfcpp::SHT_RELA
, true, size
, big_endian
>* reloc_data
)
624 this->sym_
->set_needs_dynsym_entry();
625 reloc_data
->add_global(this->sym_
, this->reloc_type_
, this->output_section_
,
626 this->relobj_
, this->shndx_
, this->address_
,
630 // Copy_relocs methods.
632 // Return whether we need a COPY reloc for a relocation against GSYM.
633 // The relocation is being applied to section SHNDX in OBJECT.
635 template<int size
, bool big_endian
>
637 Copy_relocs
<size
, big_endian
>::need_copy_reloc(
638 const General_options
*,
641 Sized_symbol
<size
>* sym
)
643 // FIXME: Handle -z nocopyrelocs.
645 if (sym
->symsize() == 0)
648 // If this is a readonly section, then we need a COPY reloc.
649 // Otherwise we can use a dynamic reloc.
650 if ((object
->section_flags(shndx
) & elfcpp::SHF_WRITE
) == 0)
658 template<int size
, bool big_endian
>
660 Copy_relocs
<size
, big_endian
>::save(
664 Output_section
* output_section
,
665 const elfcpp::Rel
<size
, big_endian
>& rel
)
667 unsigned int reloc_type
= elfcpp::elf_r_type
<size
>(rel
.get_r_info());
668 this->entries_
.push_back(Copy_reloc_entry(sym
, reloc_type
, relobj
, shndx
,
670 rel
.get_r_offset(), 0));
673 // Save a Rela reloc.
675 template<int size
, bool big_endian
>
677 Copy_relocs
<size
, big_endian
>::save(
681 Output_section
* output_section
,
682 const elfcpp::Rela
<size
, big_endian
>& rela
)
684 unsigned int reloc_type
= elfcpp::elf_r_type
<size
>(rela
.get_r_info());
685 this->entries_
.push_back(Copy_reloc_entry(sym
, reloc_type
, relobj
, shndx
,
688 rela
.get_r_addend()));
691 // Return whether there are any relocs to emit. We don't want to emit
692 // a reloc if the symbol is no longer defined in a dynamic object.
694 template<int size
, bool big_endian
>
696 Copy_relocs
<size
, big_endian
>::any_to_emit()
698 for (typename
Copy_reloc_entries::iterator p
= this->entries_
.begin();
699 p
!= this->entries_
.end();
702 if (p
->should_emit())
710 template<int size
, bool big_endian
>
711 template<int sh_type
>
713 Copy_relocs
<size
, big_endian
>::emit(
714 Output_data_reloc
<sh_type
, true, size
, big_endian
>* reloc_data
)
716 for (typename
Copy_reloc_entries::iterator p
= this->entries_
.begin();
717 p
!= this->entries_
.end();
720 if (p
->should_emit())
725 // Track_relocs methods.
727 // Initialize the class to track the relocs. This gets the object,
728 // the reloc section index, and the type of the relocs. This returns
729 // false if something goes wrong.
731 template<int size
, bool big_endian
>
733 Track_relocs
<size
, big_endian
>::initialize(
735 unsigned int reloc_shndx
,
736 unsigned int reloc_type
)
738 // If RELOC_SHNDX is -1U, it means there is more than one reloc
739 // section for the .eh_frame section. We can't handle that case.
740 if (reloc_shndx
== -1U)
743 // If RELOC_SHNDX is 0, there is no reloc section.
744 if (reloc_shndx
== 0)
747 // Get the contents of the reloc section.
748 this->prelocs_
= object
->section_contents(reloc_shndx
, &this->len_
, false);
750 if (reloc_type
== elfcpp::SHT_REL
)
751 this->reloc_size_
= elfcpp::Elf_sizes
<size
>::rel_size
;
752 else if (reloc_type
== elfcpp::SHT_RELA
)
753 this->reloc_size_
= elfcpp::Elf_sizes
<size
>::rela_size
;
757 if (this->len_
% this->reloc_size_
!= 0)
759 object
->error(_("reloc section size %zu is not a multiple of "
761 static_cast<size_t>(this->len_
),
769 // Return the offset of the next reloc, or -1 if there isn't one.
771 template<int size
, bool big_endian
>
773 Track_relocs
<size
, big_endian
>::next_offset() const
775 if (this->pos_
>= this->len_
)
778 // Rel and Rela start out the same, so we can always use Rel to find
779 // the r_offset value.
780 elfcpp::Rel
<size
, big_endian
> rel(this->prelocs_
+ this->pos_
);
781 return rel
.get_r_offset();
784 // Return the index of the symbol referenced by the next reloc, or -1U
785 // if there aren't any more relocs.
787 template<int size
, bool big_endian
>
789 Track_relocs
<size
, big_endian
>::next_symndx() const
791 if (this->pos_
>= this->len_
)
794 // Rel and Rela start out the same, so we can use Rel to find the
796 elfcpp::Rel
<size
, big_endian
> rel(this->prelocs_
+ this->pos_
);
797 return elfcpp::elf_r_sym
<size
>(rel
.get_r_info());
800 // Advance to the next reloc whose r_offset is greater than or equal
801 // to OFFSET. Return the number of relocs we skip.
803 template<int size
, bool big_endian
>
805 Track_relocs
<size
, big_endian
>::advance(off_t offset
)
808 while (this->pos_
< this->len_
)
810 // Rel and Rela start out the same, so we can always use Rel to
811 // find the r_offset value.
812 elfcpp::Rel
<size
, big_endian
> rel(this->prelocs_
+ this->pos_
);
813 if (static_cast<off_t
>(rel
.get_r_offset()) >= offset
)
816 this->pos_
+= this->reloc_size_
;
821 // Instantiate the templates we need. We could use the configure
822 // script to restrict this to only the ones for implemented targets.
824 #ifdef HAVE_TARGET_32_LITTLE
827 Sized_relobj
<32, false>::do_read_relocs(Read_relocs_data
* rd
);
830 #ifdef HAVE_TARGET_32_BIG
833 Sized_relobj
<32, true>::do_read_relocs(Read_relocs_data
* rd
);
836 #ifdef HAVE_TARGET_64_LITTLE
839 Sized_relobj
<64, false>::do_read_relocs(Read_relocs_data
* rd
);
842 #ifdef HAVE_TARGET_64_BIG
845 Sized_relobj
<64, true>::do_read_relocs(Read_relocs_data
* rd
);
848 #ifdef HAVE_TARGET_32_LITTLE
851 Sized_relobj
<32, false>::do_scan_relocs(const General_options
& options
,
852 Symbol_table
* symtab
,
854 Read_relocs_data
* rd
);
857 #ifdef HAVE_TARGET_32_BIG
860 Sized_relobj
<32, true>::do_scan_relocs(const General_options
& options
,
861 Symbol_table
* symtab
,
863 Read_relocs_data
* rd
);
866 #ifdef HAVE_TARGET_64_LITTLE
869 Sized_relobj
<64, false>::do_scan_relocs(const General_options
& options
,
870 Symbol_table
* symtab
,
872 Read_relocs_data
* rd
);
875 #ifdef HAVE_TARGET_64_BIG
878 Sized_relobj
<64, true>::do_scan_relocs(const General_options
& options
,
879 Symbol_table
* symtab
,
881 Read_relocs_data
* rd
);
884 #ifdef HAVE_TARGET_32_LITTLE
887 Sized_relobj
<32, false>::do_relocate(const General_options
& options
,
888 const Symbol_table
* symtab
,
889 const Layout
* layout
,
893 #ifdef HAVE_TARGET_32_BIG
896 Sized_relobj
<32, true>::do_relocate(const General_options
& options
,
897 const Symbol_table
* symtab
,
898 const Layout
* layout
,
902 #ifdef HAVE_TARGET_64_LITTLE
905 Sized_relobj
<64, false>::do_relocate(const General_options
& options
,
906 const Symbol_table
* symtab
,
907 const Layout
* layout
,
911 #ifdef HAVE_TARGET_64_BIG
914 Sized_relobj
<64, true>::do_relocate(const General_options
& options
,
915 const Symbol_table
* symtab
,
916 const Layout
* layout
,
920 #ifdef HAVE_TARGET_32_LITTLE
922 class Copy_relocs
<32, false>;
925 #ifdef HAVE_TARGET_32_BIG
927 class Copy_relocs
<32, true>;
930 #ifdef HAVE_TARGET_64_LITTLE
932 class Copy_relocs
<64, false>;
935 #ifdef HAVE_TARGET_64_BIG
937 class Copy_relocs
<64, true>;
940 #ifdef HAVE_TARGET_32_LITTLE
943 Copy_relocs
<32, false>::emit
<elfcpp::SHT_REL
>(
944 Output_data_reloc
<elfcpp::SHT_REL
, true, 32, false>*);
947 #ifdef HAVE_TARGET_32_BIG
950 Copy_relocs
<32, true>::emit
<elfcpp::SHT_REL
>(
951 Output_data_reloc
<elfcpp::SHT_REL
, true, 32, true>*);
954 #ifdef HAVE_TARGET_64_LITTLE
957 Copy_relocs
<64, false>::emit
<elfcpp::SHT_REL
>(
958 Output_data_reloc
<elfcpp::SHT_REL
, true, 64, false>*);
961 #ifdef HAVE_TARGET_64_BIG
964 Copy_relocs
<64, true>::emit
<elfcpp::SHT_REL
>(
965 Output_data_reloc
<elfcpp::SHT_REL
, true, 64, true>*);
968 #ifdef HAVE_TARGET_32_LITTLE
971 Copy_relocs
<32, false>::emit
<elfcpp::SHT_RELA
>(
972 Output_data_reloc
<elfcpp::SHT_RELA
, true, 32, false>*);
975 #ifdef HAVE_TARGET_32_BIG
978 Copy_relocs
<32, true>::emit
<elfcpp::SHT_RELA
>(
979 Output_data_reloc
<elfcpp::SHT_RELA
, true, 32, true>*);
982 #ifdef HAVE_TARGET_64_LITTLE
985 Copy_relocs
<64, false>::emit
<elfcpp::SHT_RELA
>(
986 Output_data_reloc
<elfcpp::SHT_RELA
, true, 64, false>*);
989 #ifdef HAVE_TARGET_64_BIG
992 Copy_relocs
<64, true>::emit
<elfcpp::SHT_RELA
>(
993 Output_data_reloc
<elfcpp::SHT_RELA
, true, 64, true>*);
996 #ifdef HAVE_TARGET_32_LITTLE
998 class Track_relocs
<32, false>;
1001 #ifdef HAVE_TARGET_32_BIG
1003 class Track_relocs
<32, true>;
1006 #ifdef HAVE_TARGET_64_LITTLE
1008 class Track_relocs
<64, false>;
1011 #ifdef HAVE_TARGET_64_BIG
1013 class Track_relocs
<64, true>;
1016 } // End namespace gold.