This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Retry powerpc gold stub grouping when groups prove too large
- From: Alan Modra <amodra at gmail dot com>
- To: Markus Trippelsdorf <markus at trippelsdorf dot de>, Cary Coutant <ccoutant at google dot com>, Binutils <binutils at sourceware dot org>
- Date: Thu, 4 Dec 2014 21:20:27 +1030
- Subject: Re: Retry powerpc gold stub grouping when groups prove too large
- Authentication-results: sourceware.org; auth=none
- References: <CAHACq4rr8Z6bKL74tmunhwZYUJx1s6md=+0vg5+oWVDjNr84bA at mail dot gmail dot com> <20141120111444 dot GB4477 at bubble dot grove dot modra dot org> <CAHACq4o9xRNgZ+ddfabhh_GTQU7AjcE0aydeU70JQ91cfThBHQ at mail dot gmail dot com> <20141126025831 dot GP4477 at bubble dot grove dot modra dot org> <20141204091156 dot GA344 at x4> <20141204094451 dot GX20383 at bubble dot grove dot modra dot org>
On Thu, Dec 04, 2014 at 08:14:51PM +1030, Alan Modra wrote:
> They tell me I have some bugs to squash with the 32-bit support..
Mixing 64-bit and 32-bit types led to the wrong promotions. Keep
calculation in same type. Also fix a case where PLTREL25 reloc addend
should be ignored.
* Powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
addend of PLTREL24 reloc when not generating a plt stub. Make
max_branch_offset an "Address".
(Stub_table::can_read_stub): Make max_branch_offset an "Address".
(Target_powerpc::Relocate::relocate): Likewise.
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 0da355f..1407a0e 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -2657,7 +2657,7 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub(
}
else
{
- unsigned long max_branch_offset = max_branch_delta(this->r_type_);
+ Address max_branch_offset = max_branch_delta(this->r_type_);
if (max_branch_offset == 0)
return true;
Address from = this->object_->get_output_section_offset(this->shndx_);
@@ -2711,7 +2711,8 @@ Target_powerpc<size, big_endian>::Branch_info::make_stub(
if (size == 64)
to += this->object_->ppc64_local_entry_offset(this->r_sym_);
}
- to += this->addend_;
+ if (!(size == 32 && this->r_type_ == elfcpp::R_PPC_PLTREL24))
+ to += this->addend_;
if (stub_table == NULL)
stub_table = this->object_->stub_table(this->shndx_);
if (size == 64 && target->abiversion() < 2)
@@ -3627,7 +3628,7 @@ class Stub_table : public Output_relaxed_input_section
bool
can_reach_stub(Address from, unsigned int off, unsigned int r_type)
{
- unsigned long max_branch_offset = max_branch_delta(r_type);
+ Address max_branch_offset = max_branch_delta(r_type);
if (max_branch_offset == 0)
return true;
gold_assert(from != invalid_address);
@@ -7197,7 +7198,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
else if (!has_stub_value)
{
Address addend = 0;
- if (r_type != elfcpp::R_PPC_PLTREL24)
+ if (!(size == 32 && r_type == elfcpp::R_PPC_PLTREL24))
addend = rela.get_r_addend();
value = psymval->value(object, addend);
if (size == 64 && is_branch_reloc(r_type))
@@ -7216,7 +7217,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
&value, &dest_shndx);
}
}
- unsigned long max_branch_offset = max_branch_delta(r_type);
+ Address max_branch_offset = max_branch_delta(r_type);
if (max_branch_offset != 0
&& value - address + max_branch_offset >= 2 * max_branch_offset)
{
--
Alan Modra
Australia Development Lab, IBM