powerpc64-ld infinite loop

Message ID 20200311052111.GA5384@bubble.grove.modra.org
State New
Headers show
Series
  • powerpc64-ld infinite loop
Related show

Commit Message

H.J. Lu via Binutils March 11, 2020, 5:21 a.m.
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.


-- 
Alan Modra
Australia Development Lab, IBM

Patch

diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 05ef34b030..c804ab3d6a 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -7621,7 +7621,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;