From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by sourceware.org (Postfix) with ESMTPS id CC1A43858D20 for ; Fri, 27 Jan 2023 19:24:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC1A43858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-1442977d77dso7805128fac.6 for ; Fri, 27 Jan 2023 11:24:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=WmUpG5JOIEtLsehktLt+dR5yQH633qO+xOiYzGl2z/8=; b=ENK2mcEQtIe+4o9wPelTCf4cliZpsx4OW4kkXduMobFPQx0cTapJTgzGWD0PwRNjIv L7aMmjDlT2cdW3ylorg7Xo4yQ8fDgLRwlm2zLyhc9NI1VDN94Swu4tbIWFewatv0vucH iaiBCLaCsZaKs13sdkwNW/CiSYX8BrjLcAFi4rGR3tYmgKp4EYxoUfAGyqm+tRlVWk8R ljYYjoNP67CTG5STK0+oFzrG3zBqqo3cs2sjscQBoXhCHhCutzIRbdYZ6VV92dewJids UjYWQM1koT5WedQ1RMNTE1HmZqlGyUCWZcAceWmcsOPqSL6FnlQPxP25nZo8T5hC1cIM WFPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WmUpG5JOIEtLsehktLt+dR5yQH633qO+xOiYzGl2z/8=; b=iLnjojJPFsem5I6yEO682QWaJlSTrfXbicKQGYQtPp8hHDsylGJvTgR4yglNXmy0vY B9Tv5tVkk6tSo6zBt1AGz7i7bV2tc22lF85cmYu76F7+DR6PvoDpPIiu1SRAKCqu+Mh1 LPjYMwiNuBjZjrne5xcJDVvTNiqPspQugA8DKv8cs2Q+JDecxQo+Q5FIvUDh5a5nNvmS MTDpRvWYjMcIhtuXrwMdmCz3I3GKUfsSqD/BM3WTmE5qv5sT3rL2auSaWlJkd2uMClup P7oCiA64eY80jVRgfMwzirvoQQUkbQP1HrQU2dquImyoglaA9kF243b5/cY+1YhyOq/M Hn2A== X-Gm-Message-State: AO0yUKUBbW+E6CX7dO8X1xolrvqn63cnNH/DarBLBW3YWFnmk/ouBiQ/ zC+ysxEruVKXx+LiL/QpoN01kyFSM4UTKFd7/G8= X-Google-Smtp-Source: AK7set96hWeb+f4mpov3bNI6bwAcPJvDgKz52Clanxtmgvgkaw5puHy49wHlb2vtwtIke4MuGK+trA== X-Received: by 2002:a05:6870:d254:b0:163:595e:3653 with SMTP id h20-20020a056870d25400b00163595e3653mr3636316oac.16.1674847476126; Fri, 27 Jan 2023 11:24:36 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c1:7e99:6983:51e0:457e:734? ([2804:1b3:a7c1:7e99:6983:51e0:457e:734]) by smtp.gmail.com with ESMTPSA id u2-20020a056870304200b0015b64f8ff2bsm2228034oau.52.2023.01.27.11.24.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Jan 2023 11:24:35 -0800 (PST) Message-ID: <0c09da9c-dc9d-4843-4c6a-46c21085c4c3@linaro.org> Date: Fri, 27 Jan 2023 16:24:32 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: [PATCH v2] C-SKY: Strip hard float abi from hard float feature. Content-Language: en-US To: Xianmiao Qu , libc-alpha@sourceware.org, han_mao@linux.alibaba.com Cc: fweimer@redhat.com References: <20230127020631.77580-1-cooper.qu@linux.alibaba.com> From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: <20230127020631.77580-1-cooper.qu@linux.alibaba.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_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 List-Id: On 26/01/23 23:06, Xianmiao Qu via Libc-alpha wrote: > The hard float abi and hard float are different, > Hard float abi: Use float register to pass float type arguments. > Hard float: Enable the hard float ISA feature.> So the with_fp_cond cannot represent these two features. When > -mfloat-abi=softfp, the float abi is soft and hard float is enabled. > So add 'with_hard_float_abi' in preconfigure and define 'CSKY_HARD_FLOAT_ABI' > if float abi is hard, and use 'CSKY_HARD_FLOAT_ABI' to determine > dynamic linker because it is what determines compatibility. > And with_fp_cond is still needed to tell glibc whether to enable > hard floating feature. > In addition, use AC_TRY_COMMAND to test gcc to ensure compatibility > between different versions of gcc. The original way has a problem > that __CSKY_HARD_FLOAT_FPU_SF__ means the target only has single > hard float-points ISA, so it's not defined in CPUs like ck810f. > --- > config.h.in | 5 ++- > sysdeps/csky/preconfigure | 47 ++++++++++++--------- > sysdeps/csky/preconfigure.ac | 39 +++++++++-------- > sysdeps/unix/sysv/linux/csky/shlib-versions | 4 +- > 4 files changed, 52 insertions(+), 43 deletions(-) > mode change 100644 => 100755 sysdeps/csky/preconfigure > > diff --git a/config.h.in b/config.h.in > index 43d32518ab..09730d9d52 100644 > --- a/config.h.in > +++ b/config.h.in > @@ -123,9 +123,12 @@ > /* C-SKY ABI version. */ > #undef CSKYABI > > -/* C-SKY floating-point ABI. */ > +/* C-SKY floating-point instructions. */ > #undef CSKY_HARD_FLOAT > > +/* C-SKY floating-point ABI. */ > +#undef CSKY_HARD_FLOAT_ABI > + > /* RISC-V integer ABI for ld.so. */ > #undef RISCV_ABI_XLEN > > diff --git a/sysdeps/csky/preconfigure b/sysdeps/csky/preconfigure > old mode 100644 > new mode 100755 > index 8a6136dd8d..6ba4871d18 > --- a/sysdeps/csky/preconfigure > +++ b/sysdeps/csky/preconfigure > @@ -5,10 +5,8 @@ case "$machine" in > csky*) > abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > sed -n 's/^#define __CSKYABI__ \(.*\)/\1/p'` > - hard_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > - sed -n 's/^#define __CSKY_HARD_FLOAT__ \(.*\)/\1/p'` > - hard_float_sf=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > - sed -n 's/^#define __CSKY_HARD_FLOAT_FPU_SF__ \(.*\)/\1/p'` > + soft_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > + sed -n 's/^#define __CSKY_SOFT_FLOAT__ \(.*\)/\1/p'` > hard_float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > sed -n 's/^#define __CSKY_HARD_FLOAT_ABI__ \(.*\)/\1/p'` > > @@ -24,26 +22,31 @@ csky*) > ;; > esac > > - # __CSKY_HARD_FLOAT_ABI__ was added on gcc 11 to specify whether > - # -mfloat-abi=hard is set. On older gcc, the float ABI is defined solely > - # with __CSKY_HARD_FLOAT__. If __CSKY_HARD_FLOAT__ is set, it can be > - # either a hard-float ABI (gcc older than 11, or gcc11 -mfloat-abi=hard > - # (__CSKY_HARD_FLOAT_ABI__ is set) or -mfloat-abi=softfp > - # (__CSKY_HARD_FLOAT_ABI__ is not set). To be compatible with older gcc, > - # use __CSKY_HARD_FLOAT_FPU_SF__ identify if -mfloat-abi is supported, > - # because it is added to gcc at the same time as -mfloat-abi. > - if test -n "$hard_float"; then > - if test -z "$hard_float_sf"; then > - with_fp_cond=1 > - else > + if { ac_try='${CC-cc} -S -mfloat-abi=softfp /dev/null 1>&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 > + soft_float_abi_support=1 > + else > + soft_float_abi_support=0 > + fi > + > + if test -n "$soft_float"; then > + with_fp_cond=0 > + with_hard_float_abi=0 > + else > + with_fp_cond=1 > + if test -n "$soft_float_abi_support"; then > if test -n "$hard_float_abi"; then > - with_fp_cond=1 > + with_hard_float_abi=1 > else > - with_fp_cond=0 > + with_hard_float_abi=0 > fi > + else > + with_hard_float_abi=1 > fi > - else > - with_fp_cond=0 > fi > > base_machine=csky > @@ -55,6 +58,10 @@ _ACEOF > > cat >>confdefs.h <<_ACEOF > #define CSKY_HARD_FLOAT $with_fp_cond > +_ACEOF > + > + cat >>confdefs.h <<_ACEOF > +#define CSKY_HARD_FLOAT_ABI $with_hard_float_abi > _ACEOF > > ;; > diff --git a/sysdeps/csky/preconfigure.ac b/sysdeps/csky/preconfigure.ac > index 332c0f1cab..7412bcef92 100644 > --- a/sysdeps/csky/preconfigure.ac > +++ b/sysdeps/csky/preconfigure.ac > @@ -5,10 +5,8 @@ case "$machine" in > csky*) > abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > sed -n 's/^#define __CSKYABI__ \(.*\)/\1/p'` > - hard_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > - sed -n 's/^#define __CSKY_HARD_FLOAT__ \(.*\)/\1/p'` > - hard_float_sf=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > - sed -n 's/^#define __CSKY_HARD_FLOAT_FPU_SF__ \(.*\)/\1/p'` > + soft_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > + sed -n 's/^#define __CSKY_SOFT_FLOAT__ \(.*\)/\1/p'` > hard_float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | > sed -n 's/^#define __CSKY_HARD_FLOAT_ABI__ \(.*\)/\1/p'` > > @@ -24,26 +22,26 @@ csky*) > ;; > esac > > - # __CSKY_HARD_FLOAT_ABI__ was added on gcc 11 to specify whether > - # -mfloat-abi=hard is set. On older gcc, the float ABI is defined solely > - # with __CSKY_HARD_FLOAT__. If __CSKY_HARD_FLOAT__ is set, it can be > - # either a hard-float ABI (gcc older than 11, or gcc11 -mfloat-abi=hard > - # (__CSKY_HARD_FLOAT_ABI__ is set) or -mfloat-abi=softfp > - # (__CSKY_HARD_FLOAT_ABI__ is not set). To be compatible with older gcc, > - # use __CSKY_HARD_FLOAT_FPU_SF__ identify if -mfloat-abi is supported, > - # because it is added to gcc at the same time as -mfloat-abi. > - if test -n "$hard_float"; then > - if test -z "$hard_float_sf"; then > - with_fp_cond=1 > - else > + if AC_TRY_COMMAND(${CC-cc} -S -mfloat-abi=softfp /dev/null 1>&AS_MESSAGE_LOG_FD); then > + soft_float_abi_support=1 > + else > + soft_float_abi_support=0 > + fi It is not clear to me why you need to use '-mfloat-abi=softfp' to check for soft-float ABI, since it *won't* be used to actually build glibc (meaning that the compiler build invocation not necessary will use the same ABI as the test is doing). > + > + if test -n "$soft_float"; then > + with_fp_cond=0 > + with_hard_float_abi=0 > + else > + with_fp_cond=1 > + if test -n "$soft_float_abi_support"; then > if test -n "$hard_float_abi"; then > - with_fp_cond=1 > + with_hard_float_abi=1 > else > - with_fp_cond=0 > + with_hard_float_abi=0 > fi > + else > + with_hard_float_abi=1 > fi > - else > - with_fp_cond=0 > fi > > base_machine=csky > @@ -51,5 +49,6 @@ csky*) > > AC_DEFINE_UNQUOTED([CSKYABI], [$abi]) > AC_DEFINE_UNQUOTED([CSKY_HARD_FLOAT], [$with_fp_cond]) > + AC_DEFINE_UNQUOTED([CSKY_HARD_FLOAT_ABI], [$with_hard_float_abi]) > ;; > esac > diff --git a/sysdeps/unix/sysv/linux/csky/shlib-versions b/sysdeps/unix/sysv/linux/csky/shlib-versions > index 8c026356ef..4ab7d6b83e 100644 > --- a/sysdeps/unix/sysv/linux/csky/shlib-versions > +++ b/sysdeps/unix/sysv/linux/csky/shlib-versions > @@ -1,8 +1,8 @@ > DEFAULT GLIBC_2.29 > > -%if CSKYABI == 2 && CSKY_HARD_FLOAT == 1 > +%if CSKYABI == 2 && CSKY_HARD_FLOAT_ABI == 1 > ld=ld-linux-cskyv2-hf.so.1 > -%elif CSKYABI == 2 && CSKY_HARD_FLOAT == 0 > +%elif CSKYABI == 2 && CSKY_HARD_FLOAT_ABI == 0 > ld=ld-linux-cskyv2.so.1 > %else > %error cannot determine ABI