From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 7B09E3858D28 for ; Sat, 27 Jan 2024 03:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B09E3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7B09E3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:470:142:3::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706325368; cv=none; b=YOfm16HUfNup/3zFmyhekEE0kLtK3GoJf9elcHhQnOoYhtSiVpLcrL2NMCOM+dHlG3lgKVK2gn5HiCm6RSJRI6D5l69nxbmbFSyYBU2V/QSGNybIsZ8g8WTBTU8m0dD37HiL9HrEUuMZXZDh0d/bLVWh7jOOSG8in8/ywnu3D5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706325368; c=relaxed/simple; bh=P+/IKxmh91h0ks9COBlQcGDxhfoDaXaexdBd3r+fzaA=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=ZSSUIOWJaBnrIQ0X5ZySizDP0WC/S6qEo71s29Ct5TnENYHGBnsF/snygadjVcK2B6Y77SLGBqVFnsgTHWXrpL63Prgkxr7WKImdvpg74Er60gPQZGVqoMwa17rPycMEQf51G/pYFeTzqvIrP2bUWFKuRD6APdX+gDbKyEER9t0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTZAn-0000jH-EN for gcc-patches@gcc.gnu.org; Fri, 26 Jan 2024 22:16:04 -0500 Received: from loongson.cn (unknown [10.20.4.107]) by gateway (Coremail) with SMTP id _____8DxvutqdbRlrcAGAA--.22433S3; Sat, 27 Jan 2024 11:15:55 +0800 (CST) Received: from [10.20.4.107] (unknown [10.20.4.107]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxzxNodbRlIxgeAA--.6216S3; Sat, 27 Jan 2024 11:15:53 +0800 (CST) Subject: Re: [PATCH v4 0/4] When cmodel=extreme, add macro support and only support macros. To: Xi Ruoyao , gcc-patches@gcc.gnu.org Cc: i@xen0n.name, xuchenghua@loongson.cn References: <20240126073745.13252-1-chenglulu@loongson.cn> <8031fd77ea3209ccac6c085ac5692f92f4291534.camel@xry111.site> <4f79de603056628da59234b89ed3878b0472087e.camel@xry111.site> From: chenglulu Message-ID: Date: Sat, 27 Jan 2024 11:15:52 +0800 User-Agent: Mozilla/5.0 (X11; Linux loongarch64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <4f79de603056628da59234b89ed3878b0472087e.camel@xry111.site> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-CM-TRANSID:AQAAf8AxzxNodbRlIxgeAA--.6216S3 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoWxZF1kXFWUuryDur1UtF17CFX_yoW5Cryfpr 1kCa1jkFWUJFn7tw1UJw1UuryUJr4UJw17XF1rJF48CwsrJr1YqFy5Xrn09F98Jr48Jr48 XF15XF4qvF1UJFbCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUv0b4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx1l5I 8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv67AK xVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7I2V7IY0VAS07AlzV AYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E 14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIx kGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAF wI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r 4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU1QVy3UU UUU== Received-SPF: pass client-ip=114.242.206.163; envelope-from=chenglulu@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -52 X-Spam_score: -5.3 X-Spam_bar: ----- X-Spam_report: (-5.3 / 5.0 requ) BAYES_00=-1.9,NICE_REPLY_A=-3.358,SPF_HELO_NONE=0.001,SPF_PASS=-0.001,T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00,BODY_8BITS,GIT_PATCH_0,KAM_DMARC_STATUS,NICE_REPLY_A,SPF_FAIL,SPF_HELO_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: 在 2024/1/26 下午6:57, Xi Ruoyao 写道: > On Fri, 2024-01-26 at 16:59 +0800, chenglulu wrote: >> 在 2024/1/26 下午4:49, Xi Ruoyao 写道: >>> On Fri, 2024-01-26 at 15:37 +0800, Lulu Cheng wrote: >>>> v3 -> v4: >>>>    1. Add macro support for TLS symbols >>>>    2. Added support for loading __get_tls_addr symbol address using call36. >>>>    3. Merge template got_load_tls_{ld/gd/le/ie}. >>>>    4. Enable explicit reloc for extreme TLS GD/LD with -mexplicit-relocs=auto. >>> I've rebased and attached the patch to fix the bad split in -mexplicit- >>> relocs={always,auto} -mcmodel=extreme on top of this series.  I've not >>> tested it seriously though (only tested the added and modified test >>> cases). >>> >> OK, I'll test the spec for correctness. > I suppose this still won't work yet because Binutils is not fully fixed. > GAS has been changed not to emit R_LARCH_RELAX for "la.tls.ie a0, t0, > foo", but ld is still not checking if an R_LARCH_RELAX is after > R_LARCH_TLS_IE_PC_{HI20,LO12} properly. Thus an invalid "partial" TLS > transition can still happen. > The following situations are not handled in the patch: diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 3fab4b64453..6336a9f696f 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -7472,7 +7472,13 @@ loongarch_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,      {        if (TARGET_CMODEL_EXTREME)         { -         emit_insn (gen_movdi_symbolic_off64 (temp1, fnaddr, temp2)); +         if (la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE) +           { +             emit_insn (gen_la_pcrel64_two_parts (temp1, temp2, fnaddr)); +             emit_move_insn (temp1, gen_rtx_PLUS (Pmode, temp1, temp2)); +           } +         else +           emit_insn (gen_movdi_symbolic_off64 (temp1, fnaddr, temp2));           insn = emit_call_insn (gen_sibcall_internal (temp1, const0_rtx));         }        else @@ -7482,7 +7488,15 @@ loongarch_output_mi_thunk (FILE *file, tree thunk_fndecl ATTRIBUTE_UNUSED,    else      {        if (TARGET_CMODEL_EXTREME) -       emit_insn (gen_movdi_symbolic_off64 (temp1, fnaddr, temp2)); +       { +         if (la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE) +           { +             emit_insn (gen_la_pcrel64_two_parts (temp1, temp2, fnaddr)); +             emit_move_insn (temp1, gen_rtx_PLUS (Pmode, temp1, temp2)); +           } +         else +           emit_insn (gen_movdi_symbolic_off64 (temp1, fnaddr, temp2)); +       }        else         loongarch_emit_move (temp1, fnaddr);