public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/5] LoongArch: Fix ld --no-relax bug
@ 2023-10-13  8:24 mengqinggang
  2023-10-13  8:24 ` [PATCH 2/5] LoongArch: Directly delete relaxed instuctions, not use R_LARCH_DELETE relocation mengqinggang
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: mengqinggang @ 2023-10-13  8:24 UTC (permalink / raw)
  To: binutils
  Cc: xuchenghua, chenglulu, liuzhensong, xry111, i.swmail, maskray,
	cailulu, mengqinggang

When ld --no-relax, pcalau12i + ld.d still can be relaxed.
---
 bfd/elfnn-loongarch.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 70a666283af..471b5df3a9c 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -3996,29 +3996,22 @@ loongarch_elf_relax_section (bfd *abfd, asection *sec,
 	    loongarch_relax_align (abfd, sec, sym_sec, info, rel, symval);
 	  break;
 	case R_LARCH_DELETE:
-	  if (info->relax_pass == 1)
+	  if (1 == info->relax_pass)
 	    {
 	      loongarch_relax_delete_bytes (abfd, sec, rel->r_offset, 4, info);
 	      rel->r_info = ELFNN_R_INFO (0, R_LARCH_NONE);
 	    }
 	  break;
 	case R_LARCH_PCALA_HI20:
-	  if (info->relax_pass == 0)
-	    {
-	      if (i + 4 > sec->reloc_count)
-		break;
-	      loongarch_relax_pcala_addi (abfd, sec, rel, symval);
-	    }
+	  if (0 == info->relax_pass && (i + 4) <= sec->reloc_count)
+	    loongarch_relax_pcala_addi (abfd, sec, rel, symval);
 	  break;
 	case R_LARCH_GOT_PC_HI20:
-	  if (local_got)
+	  if (local_got && 0 == info->relax_pass
+	      && (i + 4) <= sec->reloc_count)
 	    {
-	      if (i + 4 > sec->reloc_count)
-		break;
 	      if (loongarch_relax_pcala_ld (abfd, sec, rel))
-		{
-		  loongarch_relax_pcala_addi (abfd, sec, rel, symval);
-		}
+		loongarch_relax_pcala_addi (abfd, sec, rel, symval);
 	    }
 	  break;
 	default:
-- 
2.36.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-11-16  2:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-13  8:24 [PATCH 1/5] LoongArch: Fix ld --no-relax bug mengqinggang
2023-10-13  8:24 ` [PATCH 2/5] LoongArch: Directly delete relaxed instuctions, not use R_LARCH_DELETE relocation mengqinggang
2023-10-13  8:24 ` [PATCH 3/5] LoongArch: Multiple relax_trip in one relax_pass mengqinggang
2023-10-13  8:24 ` [PATCH 4/5] LoongArch: Remove "elf_seg_map (info->output_bfd) == NULL" relaxation condition mengqinggang
2023-10-19 14:04   ` Xi Ruoyao
2023-10-30  5:14     ` Xi Ruoyao
2023-10-30  8:00       ` mengqinggang
2023-11-16  0:03         ` Xi Ruoyao
2023-11-16  2:06           ` mengqinggang
2023-10-13  8:24 ` [PATCH 5/5] LoongArch: Modify link_info.relax_pass from 3 to 2 mengqinggang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).