aboutsummaryrefslogtreecommitdiff
path: root/gold
diff options
context:
space:
mode:
Diffstat (limited to 'gold')
-rw-r--r--gold/ChangeLog5
-rw-r--r--gold/powerpc.cc4
2 files changed, 7 insertions, 2 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog
index 225a85c..b024dfa 100644
--- a/gold/ChangeLog
+++ b/gold/ChangeLog
@@ -1,5 +1,10 @@
2019-06-28 Alan Modra <amodra@gmail.com>
+ * powerpc.cc (Target_powerpc::Relocate::relocate): Don't look
+ at next/previous reloc when relnum is -1.
+
+2019-06-28 Alan Modra <amodra@gmail.com>
+
* powerpc.cc (Stub_table::plt_error): New function.
(Stub_table::do_write): Use it.
(Output_data_glink::do_write): Don't segfault emitting linkage
diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index 43010b8..6f0be09 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -8986,7 +8986,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
size_t reloc_count = shdr.get_sh_size() / reloc_size;
if (size == 64
&& ent->r2save_
- && relnum + 1 < reloc_count)
+ && relnum < reloc_count - 1)
{
Reltype next_rela(preloc + reloc_size);
if (elfcpp::elf_r_type<size>(next_rela.get_r_info())
@@ -9757,7 +9757,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
// addi 2,2,.TOC.@l
// if .TOC. is in range. */
if (value + address - 4 + 0x80008000 <= 0xffffffff
- && relnum != 0
+ && relnum + 1 > 1
&& preloc != NULL
&& target->abiversion() >= 2
&& !parameters->options().output_is_position_independent()