public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: liuzhensong <liuzhensong@loongson.cn>
To: binutils@sourceware.org
Cc: caiyinyu <caiyinyu@loongson.cn>
Subject: [PATCH] ld:LoongArch: Fix glibc fail: tst-audit25a/b.
Date: Wed, 13 Apr 2022 14:21:39 +0800	[thread overview]
Message-ID: <20220413062139.3562272-1-liuzhensong@loongson.cn> (raw)

From: caiyinyu <caiyinyu@loongson.cn>

  bfd/

  * elfnn-loongarch.c: Add new func elf_loongarch64_hash_symbol.
---
 bfd/elfnn-loongarch.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c
index 8aaf157b303..3c7268c02b8 100644
--- a/bfd/elfnn-loongarch.c
+++ b/bfd/elfnn-loongarch.c
@@ -3390,6 +3390,21 @@ loongarch_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info,
   return _bfd_elf_gc_mark_hook (sec, info, rel, h, sym);
 }
 
+/* Return TRUE if symbol H should be hashed in the `.gnu.hash' section.  For
+   executable PLT slots where the executable never takes the address of those
+   functions, the function symbols are not added to the hash table.  */
+
+static bool
+elf_loongarch64_hash_symbol (struct elf_link_hash_entry *h)
+{
+  if (h->plt.offset != (bfd_vma) -1
+      && !h->def_regular
+      && !h->pointer_equality_needed)
+    return false;
+
+  return _bfd_elf_hash_symbol (h);
+}
+
 #define TARGET_LITTLE_SYM loongarch_elfNN_vec
 #define TARGET_LITTLE_NAME "elfNN-loongarch"
 #define ELF_ARCH bfd_arch_loongarch
@@ -3421,5 +3436,6 @@ loongarch_elf_gc_mark_hook (asection *sec, struct bfd_link_info *info,
 #define elf_backend_plt_sym_val loongarch_elf_plt_sym_val
 #define elf_backend_grok_prstatus loongarch_elf_grok_prstatus
 #define elf_backend_grok_psinfo loongarch_elf_grok_psinfo
+#define elf_backend_hash_symbol elf_loongarch64_hash_symbol
 
 #include "elfNN-target.h"
-- 
2.31.1


                 reply	other threads:[~2022-04-13  6:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220413062139.3562272-1-liuzhensong@loongson.cn \
    --to=liuzhensong@loongson.cn \
    --cc=binutils@sourceware.org \
    --cc=caiyinyu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).