aboutsummaryrefslogtreecommitdiff
path: root/gold/reloc.cc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2012-09-05 00:34:20 +0000
committerAlan Modra <amodra@gmail.com>2012-09-05 00:34:20 +0000
commit7404fe1b8d20b30162a7e56307d5a2d400cb5645 (patch)
tree71cfb8fde4ad34ab2eb812996ad807feec50828b /gold/reloc.cc
parentf54ae065b8f805b626729a8f60bacf8312a182db (diff)
downloadfsf-binutils-gdb-7404fe1b8d20b30162a7e56307d5a2d400cb5645.zip
fsf-binutils-gdb-7404fe1b8d20b30162a7e56307d5a2d400cb5645.tar.gz
fsf-binutils-gdb-7404fe1b8d20b30162a7e56307d5a2d400cb5645.tar.bz2
* object.h (Sized_relobj_file::emit_relocs): Delete.
(Sized_relobj_file::emit_relocs_reltype): Delete. * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target relocate_relocs for --emit-relocs. (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete. * output.h: Update comment. (Output_segment::first_section): New function. (Output_segment::first_section_load_address): Use first_section. * output.cc (Output_segment::first_section): New function extracted.. (Output_segment::first_section_load_address): ..from here. Delete. * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs. * target.h (Sized_target::relocate_for_relocatable): Likewise. * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and adjust call to target.h function. * i386.cc (Target_i386): Likewise. * sparc.cc (Target_sparc): Likewise. * x86_64.cc (Target_x86_64): Likewise. * powerpc.cc (Target_powerpc): Likewise. (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS. Ensure first tls section has section symbol for optimised local dynamic output relocs. (Target_powerpc::Relocate::relocate): Correct local dynamic value. (Target_powerpc::relocate_relocs): Adjust relocs emitted for optimised tls code. * testsuite/testfile.cc (Target_test::relocate_for_relocatable): Rename to relocate_relocs. Update error message.
Diffstat (limited to 'gold/reloc.cc')
-rw-r--r--gold/reloc.cc90
1 files changed, 13 insertions, 77 deletions
diff --git a/gold/reloc.cc b/gold/reloc.cc
index 4c28b03..ca7f32f 100644
--- a/gold/reloc.cc
+++ b/gold/reloc.cc
@@ -1014,9 +1014,14 @@ Sized_relobj_file<size, big_endian>::do_relocate_sections(
output_offset == invalid_address,
view, address, view_size, reloc_map);
if (parameters->options().emit_relocs())
- this->emit_relocs(&relinfo, i, sh_type, prelocs, reloc_count,
- os, output_offset, view, address, view_size,
- (*pviews)[i].view, (*pviews)[i].view_size);
+ {
+ Relocatable_relocs* rr = this->relocatable_relocs(i);
+ target->relocate_relocs(&relinfo, sh_type, prelocs, reloc_count,
+ os, output_offset, rr,
+ view, address, view_size,
+ (*pviews)[i].view,
+ (*pviews)[i].view_size);
+ }
if (parameters->incremental())
this->incremental_relocs_write(&relinfo, sh_type, prelocs,
reloc_count, os, output_offset, of);
@@ -1024,84 +1029,15 @@ Sized_relobj_file<size, big_endian>::do_relocate_sections(
else
{
Relocatable_relocs* rr = this->relocatable_relocs(i);
- target->relocate_for_relocatable(&relinfo, sh_type, prelocs,
- reloc_count, os, output_offset, rr,
- view, address, view_size,
- (*pviews)[i].view,
- (*pviews)[i].view_size);
+ target->relocate_relocs(&relinfo, sh_type, prelocs, reloc_count,
+ os, output_offset, rr,
+ view, address, view_size,
+ (*pviews)[i].view,
+ (*pviews)[i].view_size);
}
}
}
-// Emit the relocs for --emit-relocs.
-
-template<int size, bool big_endian>
-void
-Sized_relobj_file<size, big_endian>::emit_relocs(
- const Relocate_info<size, big_endian>* relinfo,
- unsigned int i,
- unsigned int sh_type,
- const unsigned char* prelocs,
- size_t reloc_count,
- Output_section* output_section,
- typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
- unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr address,
- section_size_type view_size,
- unsigned char* reloc_view,
- section_size_type reloc_view_size)
-{
- if (sh_type == elfcpp::SHT_REL)
- this->emit_relocs_reltype<elfcpp::SHT_REL>(relinfo, i, prelocs,
- reloc_count, output_section,
- offset_in_output_section,
- view, address, view_size,
- reloc_view, reloc_view_size);
- else
- {
- gold_assert(sh_type == elfcpp::SHT_RELA);
- this->emit_relocs_reltype<elfcpp::SHT_RELA>(relinfo, i, prelocs,
- reloc_count, output_section,
- offset_in_output_section,
- view, address, view_size,
- reloc_view, reloc_view_size);
- }
-}
-
-// Emit the relocs for --emit-relocs, templatized on the type of the
-// relocation section.
-
-template<int size, bool big_endian>
-template<int sh_type>
-void
-Sized_relobj_file<size, big_endian>::emit_relocs_reltype(
- const Relocate_info<size, big_endian>* relinfo,
- unsigned int i,
- const unsigned char* prelocs,
- size_t reloc_count,
- Output_section* output_section,
- typename elfcpp::Elf_types<size>::Elf_Addr offset_in_output_section,
- unsigned char* view,
- typename elfcpp::Elf_types<size>::Elf_Addr address,
- section_size_type view_size,
- unsigned char* reloc_view,
- section_size_type reloc_view_size)
-{
- const Relocatable_relocs* rr = this->relocatable_relocs(i);
- relocate_for_relocatable<size, big_endian, sh_type>(
- relinfo,
- prelocs,
- reloc_count,
- output_section,
- offset_in_output_section,
- rr,
- view,
- address,
- view_size,
- reloc_view,
- reloc_view_size);
-}
-
// Write the incremental relocs.
template<int size, bool big_endian>