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/layout.cc | |
parent | 4658f12e9c5ec0d2efb04f1688f6cd6bd9f1a47d (diff) | |
download | binutils-users/ccoutant/experimental-relr.zip binutils-users/ccoutant/experimental-relr.tar.gz binutils-users/ccoutant/experimental-relr.tar.bz2 |
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/layout.cc')
-rw-r--r-- | gold/layout.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gold/layout.cc b/gold/layout.cc index 07a3590..504028a 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -4710,7 +4710,8 @@ void Layout::add_target_dynamic_tags(bool use_rel, const Output_data* plt_got, const Output_data* plt_rel, const Output_data_reloc_generic* dyn_rel, - bool add_debug, bool dynrel_includes_plt) + bool add_debug, bool dynrel_includes_plt, + const Output_data_reloc_generic* dyn_relr) { Output_data_dynamic* odyn = this->dynamic_data_; if (odyn == NULL) @@ -4783,6 +4784,14 @@ Layout::add_target_dynamic_tags(bool use_rel, const Output_data* plt_got, } } + if (dyn_relr != NULL && dyn_relr->output_section() != NULL) + { + const int size = parameters->target().get_size(); + odyn->add_section_address(elfcpp::DT_RELR, dyn_relr->output_section()); + odyn->add_section_size(elfcpp::DT_RELRSZ, dyn_relr->output_section()); + odyn->add_constant(elfcpp::DT_RELRENT, size / 8); + } + if (add_debug && !parameters->options().shared()) { // The value of the DT_DEBUG tag is filled in by the dynamic |