[committed,2/2] RISC-V: Should reset `again' flag for _bfd_riscv_relax_pc.

Message ID 20221025013347.68282-2-nelson@rivosinc.com
State Unresolved
Headers
Series [committed,1/2] RISC-V: Improve link time complexity. |

Checks

Context Check Description
snail/binutils-gdb-check warning Git am fail log

Commit Message

Nelson Chu Oct. 25, 2022, 1:33 a.m. UTC
  The R_RISCV_DELETE relocations are no longer deleted at another relax pass,
so we should reset 'again' flag to true for _bfd_riscv_relax_pc, while the
deleted bytes are marked as R_RISCV_DELETE.

bfd/
    * elfnn-riscv.c (_bfd_riscv_relax_pc): Set `again' to true while the
    deleted bytes are marked as R_RISCV_DELETE.
---
 bfd/elfnn-riscv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c
index e4064313724..cf852636c9c 100644
--- a/bfd/elfnn-riscv.c
+++ b/bfd/elfnn-riscv.c
@@ -4586,7 +4586,7 @@  _bfd_riscv_relax_pc (bfd *abfd ATTRIBUTE_UNUSED,
 		     bfd_vma symval,
 		     bfd_vma max_alignment,
 		     bfd_vma reserve_size,
-		     bool *again ATTRIBUTE_UNUSED,
+		     bool *again,
 		     riscv_pcgp_relocs *pcgp_relocs,
 		     bool undefined_weak)
 {
@@ -4715,6 +4715,7 @@  _bfd_riscv_relax_pc (bfd *abfd ATTRIBUTE_UNUSED,
 				      sym_sec,
 				      undefined_weak);
 	  /* Delete unnecessary AUIPC and reuse the reloc.  */
+	  *again = true;
 	  riscv_relax_delete_bytes (abfd, sec, rel->r_offset, 4, link_info,
 				    pcgp_relocs, rel);
 	  return true;