From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 898453858D33 for ; Fri, 29 Dec 2023 08:51:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 898453858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 898453858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703839888; cv=none; b=SK2wpX9WCbjE6+A9UP+LUFQaQvfaf9EYlFMoaukrnjNr0KbVM3Ebb12emiPIfgILgepaD/JyDHF1fRCgddDjdM+pXZDalBXncYzUfCDHF1a9Zc4xUCZpS+Wg+JED1lzijrAS3BVcryoEz9ejxnazyUpslKwyhjp95Id00U79RHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703839888; c=relaxed/simple; bh=lr81PeZA4Gw8djPSVyxasE243nXgCfH83vMqr9nsma0=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=KYnpWNjC/E3t48wDq34M+K6CU5ZMvRrZXnLKmOtXwl88Uwv6ryhn52PfvKsmBe0cqemmageNA3RYpBppX5V6Kw9NDEO4NN1Mv8YJe0CVJ21R8T/3pSl9IhSEZGxh8TEtp8z01z95Bg7dY6Sx0UOL/2u0y7ouuom2wNXFAcgxF4A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.20.4.171]) by gateway (Coremail) with SMTP id _____8AxjuuGiI5l82UAAA--.1890S3; Fri, 29 Dec 2023 16:51:18 +0800 (CST) Received: from [10.20.4.171] (unknown [10.20.4.171]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxH+V0iI5lS6YPAA--.52073S3; Fri, 29 Dec 2023 16:51:17 +0800 (CST) Subject: Re: [PATCH] LoongArch: Update comment about bottom bit usage in TLS GOT construction To: Tatsuyuki Ishi , binutils@sourceware.org Cc: cailulu@loongson.cn, chenglulu@loongson.cn, hejinyang@loongson.cn, i.swmail@xen0n.name, liuzhensong@loongson.cn, luweining@loongson.cn, maskray@google.com, nickc@redhat.com, wanglei@loongson.cn, xry111@xry111.site, xuchenghua@loongson.cn References: <20231228145802.74719-1-ishitatsuyuki@gmail.com> <20231228145802.74719-3-ishitatsuyuki@gmail.com> From: mengqinggang Message-ID: Date: Fri, 29 Dec 2023 16:50:59 +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: <20231228145802.74719-3-ishitatsuyuki@gmail.com> Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8BxH+V0iI5lS6YPAA--.52073S3 X-CM-SenderInfo: 5phqw15lqjwttqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7AFy8uFyfXr17XryUZr43urX_yoW8Aw45pr Wav34Yyr18u3s7Ww12vw48uF4rW3yxur42kFy7K3yrJrZ7A34kW3Z5trWF9ayrXws7CrW2 va409ayUAFnrAacCm3ZEXasCq-sJn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUv2b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r106r15M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07 AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02 F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GF ylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7Cj xVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r 1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8cz VUUUUUU== X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00,GIT_PATCH_0,KAM_DMARC_STATUS,MIME_CHARSET_FARAWAY,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: At the beginning of implementation, we try to IE and GD only generate their own GOT entry, so we need two bits to do the flags. ÔÚ 2023/12/28 ÏÂÎç10:58, Tatsuyuki Ishi дµÀ: > The GOT assignment logic, likely copied from another backend, does not in > fact require multiple flags to construct multiple type of slots. Instead, > all slots are initialized on the first relocation encountered. Update > comment to avoid confusion. > --- > bfd/elfnn-loongarch.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/bfd/elfnn-loongarch.c b/bfd/elfnn-loongarch.c > index 64c34e99261..d66dcee1100 100644 > --- a/bfd/elfnn-loongarch.c > +++ b/bfd/elfnn-loongarch.c > @@ -3656,16 +3656,13 @@ loongarch_elf_relocate_section (bfd *output_bfd, struct bfd_link_info *info, > relocation -= elf_hash_table (info)->tls_sec->vma; > break; > > - /* TLS IE LD/GD process separately is troublesome. > - When a symbol is both ie and LD/GD, h->got.off |= 1 > - make only one type be relocated. We must use > - h->got.offset |= 1 and h->got.offset |= 2 > - diff IE and LD/GD. And all (got_off & (~(bfd_vma)1)) > - (IE LD/GD and reusable GOT reloc) must change to > - (got_off & (~(bfd_vma)3)), beause we use lowest 2 bits > - as a tag. > - Now, LD and GD is both GOT_TLS_GD type, LD seems to > - can be omitted. */ > + /* The bottom bit of h->got.offset is (ab)used as a flag. > + Upon encountering the first TLS relocation, we initialize all GOT > + slots for the corresponding symbol and set the bottom bit to 1. > + > + The second and subsequent relocations will check the flag, see that > + the slot is already initialized, and move on to just relocating the > + entry. */ > case R_LARCH_TLS_IE_PC_HI20: > case R_LARCH_TLS_IE_HI20: > case R_LARCH_TLS_LD_PC_HI20: