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 ED8363858D39 for ; Tue, 20 Sep 2022 09:29:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED8363858D39 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 [10.20.4.152] (unknown [10.20.4.152]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxrmvfhyljUpweAA--.35290S3; Tue, 20 Sep 2022 17:29:04 +0800 (CST) Subject: Re: [PATCH v2 0/2] Fix two bugs breaking IFUNC in static PIE To: Xi Ruoyao , binutils@sourceware.org Cc: Lulu Cheng , Wang Xuerui , Chenghua Xu References: <20220920060930.33357-1-xry111@xry111.site> From: liuzhensong Message-ID: Date: Tue, 20 Sep 2022 17:29:03 +0800 User-Agent: Mozilla/5.0 (X11; Linux mips64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20220920060930.33357-1-xry111@xry111.site> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8CxrmvfhyljUpweAA--.35290S3 X-Coremail-Antispam: 1UD129KBjvJXoW7ZF1DGrWkuw1Utr18Zw1kZrb_yoW8Gw13pr W7C3W5Ar1Fy3Z7XFn3K3yrX3Z5Xws3GryaqF43Jw1I9r98AryUXrWSyrW3WF15Aa48Xw4F vryFq3s8WF1DAFJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvI14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07AlzVAY IcxG8wCY02Avz4vE-syl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2 IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v2 6r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2 IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv 67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf 9x0JUywZ7UUUUU= X-CM-SenderInfo: holx6xphqv003j6o00pqjv00gofq/ X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,KAM_DMARC_STATUS,KAM_SHORT,MIME_CHARSET_FARAWAY,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: ÔÚ 2022/9/20 ÏÂÎç2:09, Xi Ruoyao дµÀ: > 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 > Done. https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=6224a6c2ead26a04f0b2b8ccf4ff5b817afbb425 https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ae2e4d4035f511543d12f74b3b7fdb1ba0daab16