diff options
author | Cary Coutant <ccoutant@gmail.com> | 2017-04-25 19:21:57 -0700 |
---|---|---|
committer | Cary Coutant <ccoutant@gmail.com> | 2017-04-25 20:07:52 -0700 |
commit | 8c13bcd2209cb776aa2cf7e5016b7884b0aecbf6 (patch) | |
tree | dc131c444a7e2a372b057cca03b68bc21ae50f28 /gold/output.cc | |
parent | 4658f12e9c5ec0d2efb04f1688f6cd6bd9f1a47d (diff) | |
download | binutils-gdb-8c13bcd2209cb776aa2cf7e5016b7884b0aecbf6.tar.gz |
Experimental implementation of RELR-style relocations.users/ccoutant/experimental-relr
For x86-64 only. Instead of R_X86_64_RELATIVE relocations, we
write the offsets of the relocation targets to a new section,
.relr.dyn, with section type SHT_RELR.
Diffstat (limited to 'gold/output.cc')
-rw-r--r-- | gold/output.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gold/output.cc b/gold/output.cc index 5b1e601d491..8c27ad49779 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -1224,6 +1224,17 @@ Output_reloc<elfcpp::SHT_RELA, dynamic, size, big_endian>::write( orel.put_r_addend(addend); } +// Write out a Relr relocation. + +template<bool dynamic, int size, bool big_endian> +void +Output_reloc<elfcpp::SHT_RELR, dynamic, size, big_endian>::write( + unsigned char* pov) const +{ + elfcpp::Relr_write<size, big_endian> orel(pov); + orel.put_r_offset(this->rel_.get_address()); +} + // Output_data_reloc_base methods. // Adjust the output section. @@ -1237,6 +1248,8 @@ Output_data_reloc_base<sh_type, dynamic, size, big_endian> os->set_entsize(elfcpp::Elf_sizes<size>::rel_size); else if (sh_type == elfcpp::SHT_RELA) os->set_entsize(elfcpp::Elf_sizes<size>::rela_size); + else if (sh_type == elfcpp::SHT_RELR) + os->set_entsize(elfcpp::Elf_sizes<size>::relr_size); else gold_unreachable(); @@ -5528,6 +5541,26 @@ class Output_data_reloc<elfcpp::SHT_RELA, true, 64, true>; #ifdef HAVE_TARGET_32_LITTLE template +class Output_data_reloc<elfcpp::SHT_RELR, true, 32, false>; +#endif + +#ifdef HAVE_TARGET_32_BIG +template +class Output_data_reloc<elfcpp::SHT_RELR, true, 32, true>; +#endif + +#ifdef HAVE_TARGET_64_LITTLE +template +class Output_data_reloc<elfcpp::SHT_RELR, true, 64, false>; +#endif + +#ifdef HAVE_TARGET_64_BIG +template +class Output_data_reloc<elfcpp::SHT_RELR, true, 64, true>; +#endif + +#ifdef HAVE_TARGET_32_LITTLE +template class Output_relocatable_relocs<elfcpp::SHT_REL, 32, false>; #endif |