[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.
This commit is contained in:
Alan Modra
2019-06-28 10:18:03 +09:30
parent f073a3e8c6
commit f60c61e60e
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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> 2019-06-28 Alan Modra <amodra@gmail.com>
* powerpc.cc (Stub_table::plt_error): New function. * powerpc.cc (Stub_table::plt_error): New function.

View File

@ -8986,7 +8986,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
size_t reloc_count = shdr.get_sh_size() / reloc_size; size_t reloc_count = shdr.get_sh_size() / reloc_size;
if (size == 64 if (size == 64
&& ent->r2save_ && ent->r2save_
&& relnum + 1 < reloc_count) && relnum < reloc_count - 1)
{ {
Reltype next_rela(preloc + reloc_size); Reltype next_rela(preloc + reloc_size);
if (elfcpp::elf_r_type<size>(next_rela.get_r_info()) 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 // addi 2,2,.TOC.@l
// if .TOC. is in range. */ // if .TOC. is in range. */
if (value + address - 4 + 0x80008000 <= 0xffffffff if (value + address - 4 + 0x80008000 <= 0xffffffff
&& relnum != 0 && relnum + 1 > 1
&& preloc != NULL && preloc != NULL
&& target->abiversion() >= 2 && target->abiversion() >= 2
&& !parameters->options().output_is_position_independent() && !parameters->options().output_is_position_independent()