aboutsummaryrefslogtreecommitdiff
path: root/bfd/elfnn-loongarch.c
diff options
context:
space:
mode:
authorliuzhensong <liuzhensong@loongson.cn>2022-08-19 15:04:45 +0800
committerliuzhensong <liuzhensong@loongson.cn>2022-08-24 14:27:03 +0800
commit42bd5254fb5f52f045796e1d9cce07102881d3b1 (patch)
tree32613c1472e87894f69dd3aaae41a1bcab95a94b /bfd/elfnn-loongarch.c
parent044193ebf6a2197a36c75cbc1ec7e77440a37b26 (diff)
downloadbinutils-42bd5254fb5f52f045796e1d9cce07102881d3b1.zip
binutils-42bd5254fb5f52f045796e1d9cce07102881d3b1.tar.gz
binutils-42bd5254fb5f52f045796e1d9cce07102881d3b1.tar.bz2
LoongArch: ld: Fix bug not generate plt when link a dso
Fix the bug that can not generate func@plt when linking a undefined function with cmodel=medium. Add testcase. bfd/ * elfnn-loongarch.c ld/testsuite/ld-loongarch-elf/ * cmodel-libjirl.dd * cmodel.exp * libjirl.s
Diffstat (limited to 'bfd/elfnn-loongarch.c')
-rw-r--r--bfd/elfnn-loongarch.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 8d0f66e..ed42b8b 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -746,6 +746,12 @@ 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;
}