diff options
author | mengqinggang <mengqinggang@loongson.cn> | 2023-05-11 18:03:54 +0800 |
---|---|---|
committer | liuzhensong <liuzhensong@loongson.cn> | 2023-05-15 09:22:27 +0800 |
commit | 6a1cf1bfedbcdb977d9ead3bf6a228360d78cc1b (patch) | |
tree | e22aa545cc60554d8f59c0c93a392ad264b413da /bfd | |
parent | b2ca6bdc88cd1ab02ab113f638aa41b427826c23 (diff) | |
download | gdb-6a1cf1bfedbcdb977d9ead3bf6a228360d78cc1b.zip gdb-6a1cf1bfedbcdb977d9ead3bf6a228360d78cc1b.tar.gz gdb-6a1cf1bfedbcdb977d9ead3bf6a228360d78cc1b.tar.bz2 |
LoongArch: Fix PLT entry generate bug
If a function symbol only get its address by la.global, without
directly called by bl instruction, the PLT entry is not required.
bfd/ChangeLog:
* elfnn-loongarch.c (loongarch_elf_adjust_dynamic_symbol): Fix PLT
entry generate bug.
ld/ChangeLog:
* testsuite/ld-elf/shared.exp: Clear xfail for LoongArch.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/elfnn-loongarch.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c index b0f9b6e..3fb74ed 100644 --- a/bfd/elfnn-loongarch.c +++ b/bfd/elfnn-loongarch.c @@ -980,7 +980,7 @@ loongarch_elf_adjust_dynamic_symbol (struct bfd_link_info *info, (although we could actually do it here). */ if (h->type == STT_FUNC || h->type == STT_GNU_IFUNC || h->needs_plt) { - if (h->plt.refcount < 0 + if (h->plt.refcount <= 0 || (h->type != STT_GNU_IFUNC && (SYMBOL_REFERENCES_LOCAL (info, h) || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT @@ -993,8 +993,6 @@ loongarch_elf_adjust_dynamic_symbol (struct bfd_link_info *info, h->plt.offset = MINUS_ONE; h->needs_plt = 0; } - else - h->needs_plt = 1; return true; } |