aboutsummaryrefslogtreecommitdiff
path: root/gold/powerpc.cc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-06-23 09:38:13 +0930
committerAlan Modra <amodra@gmail.com>2023-06-23 21:02:48 +0930
commitbdad2ad579f7e7a6307f61e67ef70315506a26f6 (patch)
treeac16c422e917dfe8cde08116d7c8029c881c40a9 /gold/powerpc.cc
parent027614abf11de9e79a335df4e1f9a788b7ab0063 (diff)
downloadgdb-bdad2ad579f7e7a6307f61e67ef70315506a26f6.zip
gdb-bdad2ad579f7e7a6307f61e67ef70315506a26f6.tar.gz
gdb-bdad2ad579f7e7a6307f61e67ef70315506a26f6.tar.bz2
[GOLD] Support setting DT_RELACOUNT late
PowerPC gold adds relative dynamic relocs in do_relax. These aren't accounted for in the value set in add_target_dynamic_tags, which is called before do_relax. Provide a way of setting DT_RELCOUNT and DT_RELACOUNT at the point where .dynamic is written. * layout.cc (Layout::add_target_dynamic_tags): Add custom_relcount parameter. Emit DT_RELCOUNT/RELACOUNT as a custom target handled dynamic tag if set. * layout.h(Layout::add_target_dynamic_tags): Update prototype. * aarch64.cc (Target_aarch64::do_finalize_sections): Adjust add_target_dynamic_tags call. * arm.cc (Target_arm::do_finalize_sections): Likewise. * i386.cc (Target_i386::do_finalize_sections): Likewise. * mips.cc (Target_mips::do_finalize_sections): Likewise. * s390.cc (Target_s390::do_finalize_sections): Likewise. * sparc.cc (Target_sparc::do_finalize_sections): Likewise. * tilegx.cc (Target_tilegx::do_finalize_sections): Likewise. * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise. * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise. (Target_powerpc::do_dynamic_tag_custom_value): New function.
Diffstat (limited to 'gold/powerpc.cc')
-rw-r--r--gold/powerpc.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 0c15e1b..5838b49 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -796,6 +796,10 @@ class Target_powerpc : public Sized_target<size, big_endian>
void
do_finalize_sections(Layout*, const Input_objects*, Symbol_table*);
+ // Get the custom dynamic tag value.
+ unsigned int
+ do_dynamic_tag_custom_value(elfcpp::DT) const;
+
// Return the value to use for a dynamic which requires special
// treatment.
uint64_t
@@ -10135,7 +10139,7 @@ Target_powerpc<size, big_endian>::do_finalize_sections(
? NULL
: this->plt_->rel_plt());
layout->add_target_dynamic_tags(false, this->plt_, rel_plt,
- this->rela_dyn_, true, size == 32);
+ this->rela_dyn_, true, size == 32, true);
if (size == 32)
{
@@ -10206,6 +10210,18 @@ Target_powerpc<size, big_endian>::do_finalize_sections(
}
}
+// Get the custom dynamic tag value.
+
+template<int size, bool big_endian>
+unsigned int
+Target_powerpc<size, big_endian>::do_dynamic_tag_custom_value(
+ elfcpp::DT tag) const
+{
+ if (tag != elfcpp::DT_RELACOUNT)
+ gold_unreachable();
+ return this->rela_dyn_->relative_reloc_count();
+}
+
// Merge object attributes from input file called NAME with those of the
// output. The input object attributes are in the object pointed by PASD.