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: 1834665 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rn0v61sQpz1ynD for ; Fri, 15 Sep 2023 14:04:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6573438582BC for ; Fri, 15 Sep 2023 04:04:30 +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+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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: