public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] C-SKY: Make dynamic linker's name compitable with the older gcc.
@ 2020-10-20 15:09 Cooper Qu
  2020-10-20 20:29 ` Adhemerval Zanella
  0 siblings, 1 reply; 2+ messages in thread
From: Cooper Qu @ 2020-10-20 15:09 UTC (permalink / raw)
  To: libc-alpha, han_mao; +Cc: adhemerval.zanella, Cooper Qu

__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.

* sysdeps/csky/preconfigure : Make it compitable with the older gcc.
---
 sysdeps/csky/preconfigure | 35 ++++++++++++++++++++++++++---------
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/sysdeps/csky/preconfigure b/sysdeps/csky/preconfigure
index 11b887f..5f22416 100644
--- a/sysdeps/csky/preconfigure
+++ b/sysdeps/csky/preconfigure
@@ -2,7 +2,11 @@ case "$machine" in
 csky*)
     abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
       sed -n 's/^#define __CSKYABI__ \(.*\)/\1/p'`
-    float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
+    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'`
+    hard_float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
       sed -n 's/^#define __CSKY_HARD_FLOAT_ABI__ \(.*\)/\1/p'`
 
     case "$abi" in
@@ -19,14 +23,27 @@ csky*)
         ;;
     esac
 
-    case "$float_abi" in
-    1)
-        with_fp_cond=1
-        ;;
-    *)
-        with_fp_cond=0
-        ;;
-    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 test -n "$hard_float_abi"; then
+		with_fp_cond=1
+	    else
+		with_fp_cond=0
+	    fi
+	fi
+    else
+	with_fp_cond=0
+    fi
 
     base_machine=csky
     machine=csky/$machine
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] C-SKY: Make dynamic linker's name compitable with the older gcc.
  2020-10-20 15:09 [PATCH] C-SKY: Make dynamic linker's name compitable with the older gcc Cooper Qu
@ 2020-10-20 20:29 ` Adhemerval Zanella
  0 siblings, 0 replies; 2+ messages in thread
From: Adhemerval Zanella @ 2020-10-20 20:29 UTC (permalink / raw)
  To: Cooper Qu, libc-alpha, han_mao



On 20/10/2020 12:09, Cooper Qu wrote:
> __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.
> 
> * sysdeps/csky/preconfigure : Make it compitable with the older gcc.

Ok, just to summarize if I got this correctly:

             __CSKY_HARD_FLOAT__ |  __CSKY_HARD_FLOAT_FPU_SF__ | __CSKY_HARD_FLOAT_ABI__ | fp_cond
1. gcc9/10 |          X          |                             |                         |    1
2. gcc9/10 |                     |                             |                         |    0
3. gcc11   |          X          |              X              |                         |    0
4. gcc11   |          X          |                             |            X            |    1  
5. gcc11   |                     |                             |                         |    0
6. gcc11   |                     |                             |                         |    0

LGTM.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/csky/preconfigure | 35 ++++++++++++++++++++++++++---------
>  1 file changed, 26 insertions(+), 9 deletions(-)
> 
> diff --git a/sysdeps/csky/preconfigure b/sysdeps/csky/preconfigure
> index 11b887f..5f22416 100644
> --- a/sysdeps/csky/preconfigure
> +++ b/sysdeps/csky/preconfigure
> @@ -2,7 +2,11 @@ case "$machine" in
>  csky*)
>      abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
>        sed -n 's/^#define __CSKYABI__ \(.*\)/\1/p'`
> -    float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
> +    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'`
> +    hard_float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null |
>        sed -n 's/^#define __CSKY_HARD_FLOAT_ABI__ \(.*\)/\1/p'`
>  
>      case "$abi" in
> @@ -19,14 +23,27 @@ csky*)
>          ;;
>      esac
>  
> -    case "$float_abi" in
> -    1)
> -        with_fp_cond=1
> -        ;;
> -    *)
> -        with_fp_cond=0
> -        ;;
> -    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

Ok, this is the 1. on the table I compiled.

> +	else
> +	    if test -n "$hard_float_abi"; then
> +		with_fp_cond=1

Ok, this is the 4.

> +	    else
> +		with_fp_cond=0

Ok, this is the 3.

> +	    fi
> +	fi
> +    else
> +	with_fp_cond=0

Ok, this handles 2., 5., and 6.

> +    fi
>  
>      base_machine=csky
>      machine=csky/$machine
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-20 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 15:09 [PATCH] C-SKY: Make dynamic linker's name compitable with the older gcc Cooper Qu
2020-10-20 20:29 ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).