From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from xry111.site (xry111.site [IPv6:2001:470:683e::1]) by sourceware.org (Postfix) with ESMTPS id 4E57C3858D28 for ; Tue, 20 Sep 2022 06:09:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4E57C3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=xry111.site Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=xry111.site DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xry111.site; s=default; t=1663654196; bh=aiPb10cGoNO659aNfHseKF3U6atkLlot/I0NA7loHcM=; h=From:To:Cc:Subject:Date:From; b=DW1kzY1aoSbLKlOCv4JbB/gN1YCgZyTjjcIUshhGvo9UrWYHyeLzFu2zdvfd8Z8qq tOtgRN7FFyEMSD3nWGjYRjnj9zFwkSfu/gL6OFvMf54sCt8/hR1LjSPL0fEj82MmuI lhWtghP/7pPANGwPZN1JCLWIiFlO6bK8xMg/2wUo= Received: from xry111-x57s1.. (unknown [IPv6:240e:358:1109:8900:dc73:854d:832e:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) (Authenticated sender: xry111@xry111.site) by xry111.site (Postfix) with ESMTPSA id 5F1196695E; Tue, 20 Sep 2022 02:09:52 -0400 (EDT) From: Xi Ruoyao To: binutils@sourceware.org Cc: liuzhensong , Lulu Cheng , Wang Xuerui , Chenghua Xu , Xi Ruoyao Subject: [PATCH v2 0/2] Fix two bugs breaking IFUNC in static PIE Date: Tue, 20 Sep 2022 14:09:28 +0800 Message-Id: <20220920060930.33357-1-xry111@xry111.site> X-Mailer: git-send-email 2.37.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FROM_SUSPICIOUS_NTLD,FROM_SUSPICIOUS_NTLD_FP,KAM_SHORT,LIKELY_SPAM_FROM,SPF_HELO_PASS,SPF_PASS,TXREP,T_PDS_OTHER_BAD_TLD autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: To generate a static PIE, the compiler should pass "-static -pie --no-dynamic-linker -z text" options to the linker [1]. But, LoongArch BFD linker currently produces wrong result (missing R_LARCH_IRELATIVE relocs) with IFUNC and those options, causing test failures in Glibc if static PIE is enabled. Fix them now. For the detailed analysis of the bugs see the commit messages. Changes v1 -> v2: - Stop writing into GOT for local ifunc. - Add a test case for R_LARCH_IRELATIVE insertion. [1]: https://gcc.gnu.org/r13-2728 Xi Ruoyao (2): LoongArch: Don't write into GOT for local ifunc LoongArch: Fix R_LARCH_IRELATIVE insertion after elf_link_sort_relocs bfd/elfnn-loongarch.c | 46 +++++++++++-------- .../ld-loongarch-elf/ld-loongarch-elf.exp | 1 + .../ld-loongarch-elf/local-ifunc-reloc.d | 12 +++++ .../ld-loongarch-elf/local-ifunc-reloc.s | 28 +++++++++++ 4 files changed, 68 insertions(+), 19 deletions(-) create mode 100644 ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.d create mode 100644 ld/testsuite/ld-loongarch-elf/local-ifunc-reloc.s -- 2.37.0