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_postprocessing_view)
381 if (views[i].is_input_output_view)
382 of->write_input_output_view(views[i].offset,
386 of->write_output_view(views[i].offset, views[i].view_size,
392 // Write out the local symbols.
393 this->write_local_symbols(of, layout->sympool(), layout->dynpool());
396 // Write section data to the output file. PSHDRS points to the
397 // section headers. Record the views in *PVIEWS for use when
400 template<int size, bool big_endian>
402 Sized_relobj<size, big_endian>::write_sections(const unsigned char* pshdrs,
406 unsigned int shnum = this->shnum();
407 std::vector<Map_to_output>& map_sections(this->map_to_output());
409 const unsigned char* p = pshdrs + This::shdr_size;
410 for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
412 View_size* pvs = &(*pviews)[i];
416 const Output_section* os = map_sections[i].output_section;
419 off_t output_offset = map_sections[i].offset;
421 typename This::Shdr shdr(p);
423 if (shdr.get_sh_type() == elfcpp::SHT_NOBITS)
426 // In the normal case, this input section is simply mapped to
427 // the output section at offset OUTPUT_OFFSET.
429 // However, if OUTPUT_OFFSET == -1, then input data is handled
430 // specially--e.g., a .eh_frame section. The relocation
431 // routines need to check for each reloc where it should be
432 // applied. For this case, we need an input/output view for the
433 // entire contents of the section in the output file. We don't
434 // want to copy the contents of the input section to the output
435 // section; the output section contents were already written,
436 // and we waited for them in Relocate_task::is_runnable because
437 // relocs_must_follow_section_writes is set for the object.
439 // Regardless of which of the above cases is true, we have to
440 // check requires_postprocessing of the output section. If that
441 // is false, then we work with views of the output file
442 // directly. If it is true, then we work with a separate
443 // buffer, and the output section is responsible for writing the
444 // final data to the output file.
446 off_t output_section_offset;
447 off_t output_section_size;
448 if (!os->requires_postprocessing())
450 output_section_offset = os->offset();
451 output_section_size = os->data_size();
455 output_section_offset = 0;
456 output_section_size = os->postprocessing_buffer_size();
461 if (output_offset != -1)
463 view_start = output_section_offset + output_offset;
464 view_size = shdr.get_sh_size();
468 view_start = output_section_offset;
469 view_size = output_section_size;
475 gold_assert(output_offset == -1
476 || (output_offset >= 0
477 && output_offset + view_size <= output_section_size));
480 if (os->requires_postprocessing())
482 unsigned char* buffer = os->postprocessing_buffer();
483 view = buffer + view_start;
484 if (output_offset != -1)
485 this->read(shdr.get_sh_offset(), view_size, view);
489 if (output_offset == -1)
490 view = of->get_input_output_view(view_start, view_size);
493 view = of->get_output_view(view_start, view_size);
494 this->read(shdr.get_sh_offset(), view_size, view);
499 pvs->address = os->address();
500 if (output_offset != -1)
501 pvs->address += output_offset;
502 pvs->offset = view_start;
503 pvs->view_size = view_size;
504 pvs->is_input_output_view = output_offset == -1;
505 pvs->is_postprocessing_view = os->requires_postprocessing();
509 // Relocate section data. VIEWS points to the section data as views
510 // in the output file.
512 template<int size, bool big_endian>
514 Sized_relobj<size, big_endian>::relocate_sections(
515 const General_options& options,
516 const Symbol_table* symtab,
517 const Layout* layout,
518 const unsigned char* pshdrs,
521 unsigned int shnum = this->shnum();
522 Sized_target<size, big_endian>* target = this->sized_target();
524 std::vector<Map_to_output>& map_sections(this->map_to_output());
526 Relocate_info<size, big_endian> relinfo;
527 relinfo.options = &options;
528 relinfo.symtab = symtab;
529 relinfo.layout = layout;
530 relinfo.object = this;
532 const unsigned char* p = pshdrs + This::shdr_size;
533 for (unsigned int i = 1; i < shnum; ++i, p += This::shdr_size)
535 typename This::Shdr shdr(p);
537 unsigned int sh_type = shdr.get_sh_type();
538 if (sh_type != elfcpp::SHT_REL && sh_type != elfcpp::SHT_RELA)
541 unsigned int index = shdr.get_sh_info();
542 if (index >= this->shnum())
544 this->error(_("relocation section %u has bad info %u"),
549 Output_section* os = map_sections[index].output_section;
552 // This relocation section is against a section which we
556 off_t output_offset = map_sections[index].offset;
558 gold_assert((*pviews)[index].view != NULL);
560 if (shdr.get_sh_link() != this->symtab_shndx_)
562 gold_error(_("relocation section %u uses unexpected "
564 i, shdr.get_sh_link());
568 off_t sh_size = shdr.get_sh_size();
569 const unsigned char* prelocs = this->get_view(shdr.get_sh_offset(),
572 unsigned int reloc_size;
573 if (sh_type == elfcpp::SHT_REL)
574 reloc_size = elfcpp::Elf_sizes<size>::rel_size;
576 reloc_size = elfcpp::Elf_sizes<size>::rela_size;
578 if (reloc_size != shdr.get_sh_entsize())
580 gold_error(_("unexpected entsize for reloc section %u: %lu != %u"),
581 i, static_cast<unsigned long>(shdr.get_sh_entsize()),
586 size_t reloc_count = sh_size / reloc_size;
587 if (static_cast<off_t>(reloc_count * reloc_size) != sh_size)
589 gold_error(_("reloc section %u size %lu uneven"),
590 i, static_cast<unsigned long>(sh_size));
594 gold_assert(output_offset != -1
595 || this->relocs_must_follow_section_writes());
597 relinfo.reloc_shndx = i;
598 relinfo.data_shndx = index;
599 target->relocate_section(&relinfo,
605 (*pviews)[index].view,
606 (*pviews)[index].address,
607 (*pviews)[index].view_size);
611 // Copy_relocs::Copy_reloc_entry methods.
613 // Return whether we should emit this reloc. We should emit it if the
614 // symbol is still defined in a dynamic object. If we should not emit
615 // it, we clear it, to save ourselves the test next time.
617 template<int size, bool big_endian>
619 Copy_relocs<size, big_endian>::Copy_reloc_entry::should_emit()
621 if (this->sym_ == NULL)
623 if (this->sym_->is_from_dynobj())
629 // Emit a reloc into a SHT_REL section.
631 template<int size, bool big_endian>
633 Copy_relocs<size, big_endian>::Copy_reloc_entry::emit(
634 Output_data_reloc<elfcpp::SHT_REL, true, size, big_endian>* reloc_data)
636 this->sym_->set_needs_dynsym_entry();
637 reloc_data->add_global(this->sym_, this->reloc_type_, this->output_section_,
638 this->relobj_, this->shndx_, this->address_);
641 // Emit a reloc into a SHT_RELA section.
643 template<int size, bool big_endian>
645 Copy_relocs<size, big_endian>::Copy_reloc_entry::emit(
646 Output_data_reloc<elfcpp::SHT_RELA, true, size, big_endian>* reloc_data)
648 this->sym_->set_needs_dynsym_entry();
649 reloc_data->add_global(this->sym_, this->reloc_type_, this->output_section_,
650 this->relobj_, this->shndx_, this->address_,
654 // Copy_relocs methods.
656 // Return whether we need a COPY reloc for a relocation against GSYM.
657 // The relocation is being applied to section SHNDX in OBJECT.
659 template<int size, bool big_endian>
661 Copy_relocs<size, big_endian>::need_copy_reloc(
662 const General_options*,
665 Sized_symbol<size>* sym)
667 // FIXME: Handle -z nocopyrelocs.
669 if (sym->symsize() == 0)
672 // If this is a readonly section, then we need a COPY reloc.
673 // Otherwise we can use a dynamic reloc.
674 if ((object->section_flags(shndx) & elfcpp::SHF_WRITE) == 0)
682 template<int size, bool big_endian>
684 Copy_relocs<size, big_endian>::save(
688 Output_section* output_section,
689 const elfcpp::Rel<size, big_endian>& rel)
691 unsigned int reloc_type = elfcpp::elf_r_type<size>(rel.get_r_info());
692 this->entries_.push_back(Copy_reloc_entry(sym, reloc_type, relobj, shndx,
694 rel.get_r_offset(), 0));
697 // Save a Rela reloc.
699 template<int size, bool big_endian>
701 Copy_relocs<size, big_endian>::save(
705 Output_section* output_section,
706 const elfcpp::Rela<size, big_endian>& rela)
708 unsigned int reloc_type = elfcpp::elf_r_type<size>(rela.get_r_info());
709 this->entries_.push_back(Copy_reloc_entry(sym, reloc_type, relobj, shndx,
712 rela.get_r_addend()));
715 // Return whether there are any relocs to emit. We don't want to emit
716 // a reloc if the symbol is no longer defined in a dynamic object.
718 template<int size, bool big_endian>
720 Copy_relocs<size, big_endian>::any_to_emit()
722 for (typename Copy_reloc_entries::iterator p = this->entries_.begin();
723 p != this->entries_.end();
726 if (p->should_emit())
734 template<int size, bool big_endian>
735 template<int sh_type>
737 Copy_relocs<size, big_endian>::emit(
738 Output_data_reloc<sh_type, true, size, big_endian>* reloc_data)
740 for (typename Copy_reloc_entries::iterator p = this->entries_.begin();
741 p != this->entries_.end();
744 if (p->should_emit())
749 // Track_relocs methods.
751 // Initialize the class to track the relocs. This gets the object,
752 // the reloc section index, and the type of the relocs. This returns
753 // false if something goes wrong.
755 template<int size, bool big_endian>
757 Track_relocs<size, big_endian>::initialize(
759 unsigned int reloc_shndx,
760 unsigned int reloc_type)
762 // If RELOC_SHNDX is -1U, it means there is more than one reloc
763 // section for the .eh_frame section. We can't handle that case.
764 if (reloc_shndx == -1U)
767 // If RELOC_SHNDX is 0, there is no reloc section.
768 if (reloc_shndx == 0)
771 // Get the contents of the reloc section.
772 this->prelocs_ = object->section_contents(reloc_shndx, &this->len_, false);
774 if (reloc_type == elfcpp::SHT_REL)
775 this->reloc_size_ = elfcpp::Elf_sizes<size>::rel_size;
776 else if (reloc_type == elfcpp::SHT_RELA)
777 this->reloc_size_ = elfcpp::Elf_sizes<size>::rela_size;
781 if (this->len_ % this->reloc_size_ != 0)
783 object->error(_("reloc section size %zu is not a multiple of "
785 static_cast<size_t>(this->len_),
793 // Return the offset of the next reloc, or -1 if there isn't one.
795 template<int size, bool big_endian>
797 Track_relocs<size, big_endian>::next_offset() const
799 if (this->pos_ >= this->len_)
802 // Rel and Rela start out the same, so we can always use Rel to find
803 // the r_offset value.
804 elfcpp::Rel<size, big_endian> rel(this->prelocs_ + this->pos_);
805 return rel.get_r_offset();
808 // Return the index of the symbol referenced by the next reloc, or -1U
809 // if there aren't any more relocs.
811 template<int size, bool big_endian>
813 Track_relocs<size, big_endian>::next_symndx() const
815 if (this->pos_ >= this->len_)
818 // Rel and Rela start out the same, so we can use Rel to find the
820 elfcpp::Rel<size, big_endian> rel(this->prelocs_ + this->pos_);
821 return elfcpp::elf_r_sym<size>(rel.get_r_info());
824 // Advance to the next reloc whose r_offset is greater than or equal
825 // to OFFSET. Return the number of relocs we skip.
827 template<int size, bool big_endian>
829 Track_relocs<size, big_endian>::advance(off_t offset)
832 while (this->pos_ < this->len_)
834 // Rel and Rela start out the same, so we can always use Rel to
835 // find the r_offset value.
836 elfcpp::Rel<size, big_endian> rel(this->prelocs_ + this->pos_);
837 if (static_cast<off_t>(rel.get_r_offset()) >= offset)
840 this->pos_ += this->reloc_size_;
845 // Instantiate the templates we need. We could use the configure
846 // script to restrict this to only the ones for implemented targets.
848 #ifdef HAVE_TARGET_32_LITTLE
851 Sized_relobj<32, false>::do_read_relocs(Read_relocs_data* rd);
854 #ifdef HAVE_TARGET_32_BIG
857 Sized_relobj<32, true>::do_read_relocs(Read_relocs_data* rd);
860 #ifdef HAVE_TARGET_64_LITTLE
863 Sized_relobj<64, false>::do_read_relocs(Read_relocs_data* rd);
866 #ifdef HAVE_TARGET_64_BIG
869 Sized_relobj<64, true>::do_read_relocs(Read_relocs_data* rd);
872 #ifdef HAVE_TARGET_32_LITTLE
875 Sized_relobj<32, false>::do_scan_relocs(const General_options& options,
876 Symbol_table* symtab,
878 Read_relocs_data* rd);
881 #ifdef HAVE_TARGET_32_BIG
884 Sized_relobj<32, true>::do_scan_relocs(const General_options& options,
885 Symbol_table* symtab,
887 Read_relocs_data* rd);
890 #ifdef HAVE_TARGET_64_LITTLE
893 Sized_relobj<64, false>::do_scan_relocs(const General_options& options,
894 Symbol_table* symtab,
896 Read_relocs_data* rd);
899 #ifdef HAVE_TARGET_64_BIG
902 Sized_relobj<64, true>::do_scan_relocs(const General_options& options,
903 Symbol_table* symtab,
905 Read_relocs_data* rd);
908 #ifdef HAVE_TARGET_32_LITTLE
911 Sized_relobj<32, false>::do_relocate(const General_options& options,
912 const Symbol_table* symtab,
913 const Layout* layout,
917 #ifdef HAVE_TARGET_32_BIG
920 Sized_relobj<32, true>::do_relocate(const General_options& options,
921 const Symbol_table* symtab,
922 const Layout* layout,
926 #ifdef HAVE_TARGET_64_LITTLE
929 Sized_relobj<64, false>::do_relocate(const General_options& options,
930 const Symbol_table* symtab,
931 const Layout* layout,
935 #ifdef HAVE_TARGET_64_BIG
938 Sized_relobj<64, true>::do_relocate(const General_options& options,
939 const Symbol_table* symtab,
940 const Layout* layout,
944 #ifdef HAVE_TARGET_32_LITTLE
946 class Copy_relocs<32, false>;
949 #ifdef HAVE_TARGET_32_BIG
951 class Copy_relocs<32, true>;
954 #ifdef HAVE_TARGET_64_LITTLE
956 class Copy_relocs<64, false>;
959 #ifdef HAVE_TARGET_64_BIG
961 class Copy_relocs<64, true>;
964 #ifdef HAVE_TARGET_32_LITTLE
967 Copy_relocs<32, false>::emit<elfcpp::SHT_REL>(
968 Output_data_reloc<elfcpp::SHT_REL, true, 32, false>*);
971 #ifdef HAVE_TARGET_32_BIG
974 Copy_relocs<32, true>::emit<elfcpp::SHT_REL>(
975 Output_data_reloc<elfcpp::SHT_REL, true, 32, true>*);
978 #ifdef HAVE_TARGET_64_LITTLE
981 Copy_relocs<64, false>::emit<elfcpp::SHT_REL>(
982 Output_data_reloc<elfcpp::SHT_REL, true, 64, false>*);
985 #ifdef HAVE_TARGET_64_BIG
988 Copy_relocs<64, true>::emit<elfcpp::SHT_REL>(
989 Output_data_reloc<elfcpp::SHT_REL, true, 64, true>*);
992 #ifdef HAVE_TARGET_32_LITTLE
995 Copy_relocs<32, false>::emit<elfcpp::SHT_RELA>(
996 Output_data_reloc<elfcpp::SHT_RELA , true, 32, false>*);
999 #ifdef HAVE_TARGET_32_BIG
1002 Copy_relocs<32, true>::emit<elfcpp::SHT_RELA>(
1003 Output_data_reloc<elfcpp::SHT_RELA, true, 32, true>*);
1006 #ifdef HAVE_TARGET_64_LITTLE
1009 Copy_relocs<64, false>::emit<elfcpp::SHT_RELA>(
1010 Output_data_reloc<elfcpp::SHT_RELA, true, 64, false>*);
1013 #ifdef HAVE_TARGET_64_BIG
1016 Copy_relocs<64, true>::emit<elfcpp::SHT_RELA>(
1017 Output_data_reloc<elfcpp::SHT_RELA, true, 64, true>*);
1020 #ifdef HAVE_TARGET_32_LITTLE
1022 class Track_relocs<32, false>;
1025 #ifdef HAVE_TARGET_32_BIG
1027 class Track_relocs<32, true>;
1030 #ifdef HAVE_TARGET_64_LITTLE
1032 class Track_relocs<64, false>;
1035 #ifdef HAVE_TARGET_64_BIG
1037 class Track_relocs<64, true>;
1040 } // End namespace gold.