aboutsummaryrefslogtreecommitdiff
path: root/gold/powerpc.cc
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-06-28 10:18:03 +0930
committerAlan Modra <amodra@gmail.com>2019-06-28 10:18:03 +0930
commitf60c61e60e59c2bfc5fdd1b448408c2af287899e (patch)
tree4e768737ff28498934c79746fdd25f3cebaf2f66 /gold/powerpc.cc
parentf073a3e8c6735bd8fc24d35a957d8944087ea367 (diff)
downloadfsf-binutils-gdb-f60c61e60e59c2bfc5fdd1b448408c2af287899e.zip
fsf-binutils-gdb-f60c61e60e59c2bfc5fdd1b448408c2af287899e.tar.gz
fsf-binutils-gdb-f60c61e60e59c2bfc5fdd1b448408c2af287899e.tar.bz2
[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.
Diffstat (limited to 'gold/powerpc.cc')
-rw-r--r--gold/powerpc.cc4
1 files changed, 2 insertions, 2 deletions
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()