From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id EB73A3858D28 for ; Wed, 13 Apr 2022 06:22:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EB73A3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn Received: from 5.5.5 (unknown [10.2.5.5]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxXxMGbFZiIIMhAA--.41245S2; Wed, 13 Apr 2022 14:22:03 +0800 (CST) From: liuzhensong To: binutils@sourceware.org Cc: caiyinyu Subject: [PATCH] ld:LoongArch: Fix glibc fail: tst-audit25a/b. Date: Wed, 13 Apr 2022 14:21:39 +0800 Message-Id: <20220413062139.3562272-1-liuzhensong@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf9DxXxMGbFZiIIMhAA--.41245S2 X-Coremail-Antispam: 1UD129KBjvJXoW7AF17uF1kWF4ftFWUJF48tFb_yoW8Xw17pr y3ury5Gr18JFsrWwsrXas09rsxKr4xur17tFy3tF40kw4DJa48WFs5trWrWFWUt34xGryj qFyxAas8uFs5ZF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkS14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26ryj6F1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK6svPMxAI w28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI0_Jr0_Jr 4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUXVWUAwCIc40Y0x0EwIxG rwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8Jw CI42IY6xAIw20EY4v20xvaj40_Wr1j6rW3Jr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAI cVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUozVbDUUUU X-CM-SenderInfo: holx6xphqv003j6o00pqjv00gofq/ X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2022 06:22:08 -0000 From: caiyinyu 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