From: Alan Modra Date: Fri, 28 Jun 2019 00:48:03 +0000 (+0930) Subject: [GOLD] PowerPC tweak relnum tests X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f60c61e60e59c2bfc5fdd1b448408c2af287899e;p=binutils-gdb.git [GOLD] PowerPC tweak relnum tests There is a call of relocate() to perform a single relocation. In that case the "relnum" parameter is -1U and of course it isn't appropriate to consider any of the PowerPC code sequence optimisations triggered by a following relocation. * powerpc.cc (Target_powerpc::Relocate::relocate): Don't look at next/previous reloc when relnum is -1. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index 225a85cdb68..b024dfa24f6 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2019-06-28 Alan Modra + + * powerpc.cc (Target_powerpc::Relocate::relocate): Don't look + at next/previous reloc when relnum is -1. + 2019-06-28 Alan Modra * powerpc.cc (Stub_table::plt_error): New function. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 43010b8c055..6f0be0975a2 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -8986,7 +8986,7 @@ Target_powerpc::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(next_rela.get_r_info()) @@ -9757,7 +9757,7 @@ Target_powerpc::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()