Re: 回复:Re: [PATCH 1/1] C-SKY:Fix dynamic linker's name when mfloat-abi=softfp.

Cooper Qu cooper.qu@linux.alibaba.com
Mon Oct 19 06:24:03 GMT 2020


Hi Adhemerval,

>     *发件人:*Adhemerval Zanella <adhemerval.zanella@linaro.org>
>     *发送时间:*10/16/20 23:36:15
>     *收件人:*Cooper Qu <cooper.qu@linux.alibaba.com>, Alistair Francis
>     via Libc-alpha <libc-alpha@sourceware.org>, Mao Han
>     <han_mao@c-sky.com>
>     *主题:*Re: [PATCH 1/1] C-SKY:Fix dynamic linker's name when
>     mfloat-abi=softfp.
>
>
>
>         On 15/10/2020 23:56, Cooper Qu via Libc-alpha wrote:
>         > The dynamic linker should be chosen according to float abi, the
>         > predefined macro __CSKY_HARD_FLOAT__ stand for architecure not
>         > abi.
>         >
>         > * sysdeps/csky/preconfigure: Use __CSKY_HARD_FLOAT_ABI__ instead
>         > of __CSKY_HARD_FLOAT__.
>
>         Is this really correct? On a gcc built for csky-linux-gnuabiv2 using
>         build-many-glibcs.py:
>
>         $ csky-glibc-linux-gnuabiv2-gcc --version
>         csky-glibc-linux-gnuabiv2-gcc (GCC) 9.3.1 20200415 [releases/gcc-9 revision 54ab0a7d757:262f0d53795:1eccf9955614a6f0597bf624bbc88788b8b0fdc5]
>         [...]
>
>         $ csky-glibc-linux-gnuabiv2-gcc test.c -E -dM < /dev/null  | grep __CSKY_HARD_FLOAT_ABI__ ; echo $?
>
>         $ csky-glibc-linux-gnuabiv2-gcc test.c -E -dM < /dev/null  | grep __CSKY_HARD_FLOAT__ ; echo $?
>         #define __CSKY_HARD_FLOAT__ 1
>         0
>
>         It seems this flags was added along with -mfloat-abi=soft option on gcc11
>         (commit 01d56aeaffa1) which means that building a patched glibc with
>
>         older gcc version will always set the 'float_abi' to always use soft-fp.
>
Yes, it cannot be compatible with the old version GCC.
>
>
>         I think to get full backwards compatible you will need to handle
>         and __CSKY_HARD_FLOAT_FPU_SF__ to check whether - mfloat-abi is used, something
>
>         like the below (untested):
>
>         ---
>
>           hard_float=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
>                sed -n 's/^#define __CSKY_HARD_FLOAT__ \(.*\)/\1/p'`
>           hard_float_fpu_sf=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
>                sed -n 's/^#define __CSKY_HARD_FLOAT_FPU_SF__ \(.*\)/\1/p'`
>
>           # __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 set).
>           if test -n $hard_float; then
>             if test -z $hard_float_fpu_sf; then
>               float_abi=1
>             else
>               float_abi=0
>             fi
>           else
>             float_abi=0
>           fi
>
This is a  feasible method, I will verify and fix it.Thanks very much!


Cooper



More information about the Libc-alpha mailing list