From patchwork Fri Sep 15 04:04:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: mengqinggang X-Patchwork-Id: 140128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp790995vqi; Thu, 14 Sep 2023 21:04:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEOucfjRbldDzDdQVAwpnZo2xV5UuPJpGEmim5nhg5dRloij/teo/JGHLFdx5jevG0mwJwE X-Received: by 2002:a05:6512:709:b0:4fb:780d:2a49 with SMTP id b9-20020a056512070900b004fb780d2a49mr423136lfs.5.1694750688238; Thu, 14 Sep 2023 21:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694750688; cv=none; d=google.com; s=arc-20160816; b=ZY0Vjr+V0AV1TZiC2Qw9s5+uXt8GDnmlh/a7+W4UwxW5meeLjvHkOkIKlKQUh48bxg 4CAnfJLo+qSJNrh4ovwhl67eGx0uzOzxDta1LpIFggR12+pJw5nsDy7BOZoOwBChS7qr VU+MXHdDJ9DGDyg3aa9UqUcal3f6lFuk1I0ZZmAYT9JgHYUSmdbcFcarDItDfI9GCRsS sG4zExkcXqtJbd+S6fkSirOFjGY+0uQgZ9WEcwFVB2Pg1YYZrgz+Whz+gSnrXOFiH3rm iaXexV//kVxfi6fRS3jaX8RcJRkdWGMLHy5enysY/3xf2W3d94vGqYM53cQ9UVzzO2ag QImQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender: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:dmarc-filter :delivered-to; bh=zVp9QEDhrS1kcWzb4rKZPIvLS35u0LmtskCnam5YynM=; fh=LLjmqyk7McxkHSaE1mIUf1njExJEpor+WdgDONG1jxc=; b=rp+QQj4vvX8He2qX3BANzp6R0/OPUXkmiC+0ZvDNUjFUN/S/mYja3MrvxrKFQN+rpX q9PBrDkwTZJrZGFhxx7PT9tRAspKefd1ZpoCK3xNlUkx1O8j3icksYrKuBziZm4UD++/ 2ZdnDJNRL8g0r8rEOuc0OZe2DSh0nB6reMonuNQFN8d4S+i4auQ1CcASg/cQiXlDnGy3 U1m2nCcq6lfkHTIjp95YY4haTcdqNuVFWa7yJIthj8ggtzyYxsdHKYqgM+xUjotwbaIV wzb4kREqtTzVlr8XhSUzmdOJcFpE/0OkEfaOD3Yr8BkYVjhms7f7JQ8c6xvQ8AFF37AI m+oA== ARC-Authentication-Results: i=1; mx.google.com; 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 lf28-20020a170907175c00b0099d804da2ebsi2457910ejc.503.2023.09.14.21.04.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 21:04:48 -0700 (PDT) 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; 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 CA12F3858002 for ; Fri, 15 Sep 2023 04:04:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 72BC83858C52 for ; Fri, 15 Sep 2023 04:04:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 72BC83858C52 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=loongson.cn Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qh03z-0000to-9E for gcc-patches@gcc.gnu.org; Fri, 15 Sep 2023 00:04:18 -0400 Received: from loongson.cn (unknown [10.2.5.5]) by gateway (Coremail) with SMTP id _____8Dxfeu31wNlTxQoAA--.9192S3; Fri, 15 Sep 2023 12:04:08 +0800 (CST) Received: from 5.5.5 (unknown [10.2.5.5]) by localhost.localdomain (Coremail) with SMTP id AQAAf8BxbNy21wNlfGcGAA--.12297S2; Fri, 15 Sep 2023 12:04:06 +0800 (CST) From: mengqinggang To: gcc-patches@gcc.gnu.org Cc: chenglulu@loongson.cn, xry111@xry111.site, i@xen0n.name, xuchenghua@loongson.cn, mengqinggang Subject: [PATCH v2] Modify gas uleb128 support test Date: Fri, 15 Sep 2023 12:04:04 +0800 Message-Id: <20230915040404.729860-1-mengqinggang@loongson.cn> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8BxbNy21wNlfGcGAA--.12297S2 X-CM-SenderInfo: 5phqw15lqjwttqj6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoWxGrWktryDtr1kCr47WrWrXrc_yoW5tF1fpF yfZF43Ka4kCryrWwsxXa1S9w4Fywn3Wr9Ika9xAryUta4UAF10vr4UAF1aqw4kJF1rCF13 Z34rKFnrGw4kCFbCm3ZEXasCq-sJn29KB7ZKAUJUUUU5529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUkFb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2x26I8E6xACxx 1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv 67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2 Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s02 6x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0x vE2Ix0cI8IcVAFwI0_JFI_Gr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE 42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r1j6r4UYxBIdaVFxhVjvjDU0xZFpf9x07UNvtZUUUUU= Received-SPF: pass client-ip=114.242.206.163; envelope-from=mengqinggang@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_FAIL, SPF_HELO_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 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 Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777074897162369517 X-GMAIL-MSGID: 1777074897162369517 Some assemblers (GNU as for LoongArch) generates relocations for leb128 symbol arithmetic for relaxation, we need to disable relaxation probing leb128 support then. gcc/ChangeLog: * configure: Regenerate. * configure.ac: Checking assembler for -mno-relax support. Disable relaxation when probing leb128 support. co-authored-by: Xi Ruoyao --- gcc/configure | 35 ++++++++++++++++++++++++++++++++++- gcc/configure.ac | 10 +++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/gcc/configure b/gcc/configure index 07e8a64afbb..b1cc52a8041 100755 --- a/gcc/configure +++ b/gcc/configure @@ -24676,6 +24676,39 @@ _ACEOF +# Some assemblers (GNU as for LoongArch) generates relocations for +# leb128 symbol arithmetic for relaxation, we need to disable relaxation +# probing leb128 support then. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler for -mno-relax support" >&5 +$as_echo_n "checking assembler for -mno-relax support... " >&6; } +if ${gcc_cv_as_mno_relax+:} false; then : + $as_echo_n "(cached) " >&6 +else + gcc_cv_as_mno_relax=no + if test x$gcc_cv_as != x; then + $as_echo '.text' > conftest.s + if { ac_try='$gcc_cv_as $gcc_cv_as_flags -mno-relax -o conftest.o conftest.s >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } + then + gcc_cv_as_mno_relax=yes + else + echo "configure: failed program was" >&5 + cat conftest.s >&5 + fi + rm -f conftest.o conftest.s + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_as_mno_relax" >&5 +$as_echo "$gcc_cv_as_mno_relax" >&6; } +if test $gcc_cv_as_mno_relax = yes; then + check_leb128_asflags=-mno-relax +fi + + # Check if we have .[us]leb128, and support symbol arithmetic with it. # Older versions of GAS and some non-GNU assemblers, have a bugs handling # these directives, even when they appear to accept them. @@ -24694,7 +24727,7 @@ L1: L2: .uleb128 0x8000000000000000 ' > conftest.s - if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5' + if { ac_try='$gcc_cv_as $gcc_cv_as_flags $check_leb128_asflags -o conftest.o conftest.s >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 ac_status=$? diff --git a/gcc/configure.ac b/gcc/configure.ac index cb4be11facd..10027a4aaaa 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -3229,10 +3229,18 @@ AC_MSG_RESULT($gcc_cv_ld_ro_rw_mix) gcc_AC_INITFINI_ARRAY +# Some assemblers (GNU as for LoongArch) generates relocations for +# leb128 symbol arithmetic for relaxation, we need to disable relaxation +# probing leb128 support then. +gcc_GAS_CHECK_FEATURE([-mno-relax support], + gcc_cv_as_mno_relax,[-mno-relax],[.text],, + [check_leb128_asflags=-mno-relax]) + # Check if we have .[us]leb128, and support symbol arithmetic with it. # Older versions of GAS and some non-GNU assemblers, have a bugs handling # these directives, even when they appear to accept them. -gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128,, +gcc_GAS_CHECK_FEATURE([.sleb128 and .uleb128], gcc_cv_as_leb128, +[$check_leb128_asflags], [ .data .uleb128 L2 - L1 L1: