[PATCH] LoongArch: ld: Fix bug not generate plt when link a x.so

liuzhensong liuzhensong@loongson.cn
Sat Aug 20 09:08:35 GMT 2022


  bfd/
    elfnn-loongarch.c
---
 bfd/elfnn-loongarch.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 8d0f66ea7c1..a9ca20ee49b 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -746,6 +746,14 @@ loongarch_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
 	case R_LARCH_PCALA_HI20:
 	  if (h != NULL)
 	    {
+	      /* For pcalau12i + jirl.  */
+		{
+		  h->needs_plt = 1;
+		  if (h->plt.refcount < 0)
+		    h->plt.refcount = 0;
+		  h->plt.refcount++;
+		}
+
 	      h->non_got_ref = 1;
 	      h->pointer_equality_needed = 1;
 	    }
-- 
2.31.1



More information about the Binutils mailing list