From de9c1b7cfe6e57ea8b677dc2de06e83de50f47c2 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 11 Mar 2020 14:43:16 +1030
Subject: [PATCH] powerpc64-ld infinite loop

If this code dealing with possible conversion of inline plt sequences
is ever executed, ld will hang.  A binary with such sequences and of
code size larger than approximately 90% the reach of an unconditional
branch is the trigger.  Oops.

	* elf64-ppc.c (ppc64_elf_inline_plt): Do increment rel in for loop.

(cherry picked from commit 435edf0bf231240ccecb474b74ebb49dc8db2633)
---
 bfd/elf64-ppc.c | 2 +-
 1 files changed, 1 insertions(+), 1 deletion(-)

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 73ea286..bea722c 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7507,7 +7507,7 @@ ppc64_elf_inline_plt (struct bfd_link_info *info)
 	      return FALSE;
 
 	    relend = relstart + sec->reloc_count;
-	    for (rel = relstart; rel < relend; )
+	    for (rel = relstart; rel < relend; rel++)
 	      {
 		enum elf_ppc64_reloc_type r_type;
 		unsigned long r_symndx;
-- 
1.8.3.1

