From patchwork Tue Jan 23 03:54:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chenglulu X-Patchwork-Id: 190703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp106308dyi; Mon, 22 Jan 2024 19:55:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTs2r6ObtZDOmpM+qvxPH7RKfSlB0WoI2jaHU8A3xolw+N4KdRCdQVPwEpobbc7F2f15si X-Received: by 2002:a05:6214:d0b:b0:686:9389:7427 with SMTP id 11-20020a0562140d0b00b0068693897427mr292289qvh.48.1705982134937; Mon, 22 Jan 2024 19:55:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705982134; cv=pass; d=google.com; s=arc-20160816; b=SPFQUvDH54U21BlN3Jv0N2S+DrcPrVkgscmix7ORVJqy8OsBvSJ33sW6hJ+nDWirpU 67s3MDp7AxRBVTRR43QtrJA5SQPy6uLy5RqNr4WcQIPUaE6xhiXzmw8kHRRNpzB8zHxR RFdIGZLETcQ8h2H7SrFyx/eRJ1zpISrnrZ7A4SGSKHfBNqq0MKGi7r2g15I1IDdxsl+s QKcv/PII0EWJnkBKw8G16oVI1e7L3bzFGUbnMuxXN2Na+Cjv3OeeKwFAyIujLI5hyuXf Hw7FE6KH/ofGnBXN3fT5hCFXAw7lawJdjpnWZJjE6kVj7+z7g5zFEkayur+hpDOqUQNu kjvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:arc-filter :dmarc-filter:delivered-to; bh=0tXWWaHH9tCs3e/J8oODb97+24O/KcNHgRfIa58mG3Y=; fh=kLXYvQYlFoGM+V705nfHVJAr1G8Exwjn4Aw52UExiO4=; b=a1XPqxLHi1AbWkmtEYYjz58iz5V7f5/DCnXQQCqk4uaB4DMvyxjJcZw84QZCa1gRJH 98DTeGzaUJ1AIWWPypSAaJxlgobfh8SLmIDAZxztgfpRoGT8WPC0mjb6+1rTAFuhDP1M 36XtuSDIrlwnfCDa0Vd4hq5sNgaR5eaacKe4KviMTg/if9l2aqHY06g2F2H01qO5tYR6 MYiVNZnpuAXdyR/KgNSEMbIZdHzAcDjamNlzIeLn+1ZaKCYMEM28C+Swl6ZhgpLgYSX4 JVZ9bOq4FnCO9SekztgtcHWxREAWmaIgjZcUY3+C/QvVe9jZy4tHwv2UzKslvu7wtJSL KjVA== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y15-20020a0c8ecf000000b0068686887126si944269qvb.531.2024.01.22.19.55.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 19:55:34 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A66633858420 for ; Tue, 23 Jan 2024 03:55:34 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by sourceware.org (Postfix) with ESMTP id 4E5713858D20 for ; Tue, 23 Jan 2024 03:54:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4E5713858D20 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 4E5713858D20 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=1705982100; cv=none; b=UHdeLQWhK+iK2eYnNibE2AFCsb2KoW4Xg/qT3Gl8GShNUmsEhzN+O8q8lE/bdXieSN+O6cuTKf5QwGugUdpK/Q0M1Vk6tMWTXVtnGwOlDSV20Gzqdpi7ZvjydEaZrZWkglGwBPh6PbWDDAf78EwBlo6ma7DhmoByQiDnePlaJog= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705982100; c=relaxed/simple; bh=LE5oc5iqFOpxzcFxQld277j5mbGRydSG9lx0RcavTmY=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=scI9/7Ke/Hzb7ju5YAHYDYEvQimpRDxUqSkTht+cBQNq6/GPBnpGI+X4IuR9D5fflfa8mi3H8R56CVB9ctnZj5z4t454Gz+oVqdMoswtzgXy7TKxyWwDY5liT6NrnDZMvTrfT2mH/Fotfpv1cVARHrImmUyO9YuwmhHLOJjIHYI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from loongson.cn (unknown [10.20.4.107]) by gateway (Coremail) with SMTP id _____8Axz+uLOK9lGgEEAA--.16095S3; Tue, 23 Jan 2024 11:54:52 +0800 (CST) Received: from loongson-pc.loongson.cn (unknown [10.20.4.107]) by localhost.localdomain (Coremail) with SMTP id AQAAf8Cxf8+HOK9lv4QTAA--.22852S2; Tue, 23 Jan 2024 11:54:50 +0800 (CST) From: Lulu Cheng To: gcc-patches@gcc.gnu.org Cc: xry111@xry111.site, i@xen0n.name, xuchenghua@loongson.cn, Lulu Cheng Subject: [PATCH] LoongArch: Disable TLS type symbols from generating non-zero offsets. Date: Tue, 23 Jan 2024 11:54:35 +0800 Message-Id: <20240123035435.1402-1-chenglulu@loongson.cn> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8Cxf8+HOK9lv4QTAA--.22852S2 X-CM-SenderInfo: xfkh0wpoxo3qxorr0wxvrqhubq/ X-Coremail-Antispam: 1Uk129KBj93XoW7ZrWDuFW8Wr4UAr18Jr1kZwc_yoW8ZF18pF Z7Ar47tr48GrnrWw4DGas8XwnrCasrWa12ga45try0kFZ2qryUZF1xJFWjg3WUWws5XF92 gryS9FZ8W3W8A3XCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1l84ACjcxK6I8E87Iv67AKxVWxJVW8Jr1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6r4UJVWxJr1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqjxCEc2xF0cIa020Ex4CE44I27w Aqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jrv_JF1lYx0Ex4A2jsIE 14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x 0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E 7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcV C0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF 04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7 CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU1QVy3UUUUU== X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_STOCKGEN, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788851923396827913 X-GMAIL-MSGID: 1788851923396827913 TLS gd ld and ie type symbols will generate corresponding GOT entries, so non-zero offsets cannot be generated. The address of TLS le type symbol+addend is not implemented in binutils, so non-zero offset is not generated here for the time being. gcc/ChangeLog: * config/loongarch/loongarch.cc (loongarch_symbolic_constant_p): For symbols of type tls, non-zero Offset is not generated. --- gcc/config/loongarch/loongarch.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 82467474288..f2ce1f6906d 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -1924,11 +1924,7 @@ loongarch_symbolic_constant_p (rtx x, enum loongarch_symbol_type *symbol_type) x = UNSPEC_ADDRESS (x); } else if (SYMBOL_REF_P (x) || LABEL_REF_P (x)) - { - *symbol_type = loongarch_classify_symbol (x); - if (*symbol_type == SYMBOL_TLS) - return true; - } + *symbol_type = loongarch_classify_symbol (x); else return false; @@ -1939,17 +1935,21 @@ loongarch_symbolic_constant_p (rtx x, enum loongarch_symbol_type *symbol_type) relocations. */ switch (*symbol_type) { - case SYMBOL_TLS_IE: - case SYMBOL_TLS_LE: - case SYMBOL_TLSGD: - case SYMBOL_TLSLDM: case SYMBOL_PCREL: case SYMBOL_PCREL64: /* GAS rejects offsets outside the range [-2^31, 2^31-1]. */ return sext_hwi (INTVAL (offset), 32) == INTVAL (offset); + /* The following symbol types do not allow non-zero offsets. */ case SYMBOL_GOT_DISP: + case SYMBOL_TLS_IE: + case SYMBOL_TLSGD: + case SYMBOL_TLSLDM: case SYMBOL_TLS: + /* From an implementation perspective, tls_le symbols are allowed to + have non-zero offsets, but currently binutils has not added support, + so the generation of non-zero offsets is prohibited here. */ + case SYMBOL_TLS_LE: return false; } gcc_unreachable ();