diff mbox series

[3/7] cgcc: simpler handling of hard-float ARM

Message ID 20190217153131.94556-4-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show
Series cgcc: use gcc -dumpmachine | expand

Commit Message

Luc Van Oostenryck Feb. 17, 2019, 3:31 p.m. UTC
There is an ABI for ARM with hard floats and one for soft floats
(as well as one for a sort of mix between hard & soft).
For the hard fp, the preprocessor symbol '__ARM_PCS_VFP' needs to
be defined. This is added as an additional check in the code
returning the 'specs' for ARM.

To facilitate some incoming changes and code reuses here, create
a pseudo-arch 'arm+hf' for define the symbol.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 cgcc | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Ramsay Jones Feb. 20, 2019, 1:45 a.m. UTC | #1
On 17/02/2019 15:31, Luc Van Oostenryck wrote:
> There is an ABI for ARM with hard floats and one for soft floats
> (as well as one for a sort of mix between hard & soft).
> For the hard fp, the preprocessor symbol '__ARM_PCS_VFP' needs to
> be defined. This is added as an additional check in the code
> returning the 'specs' for ARM.
> 
> To facilitate some incoming changes and code reuses here, create

s/incoming/upcoming/; s/reuses/reuse/

> a pseudo-arch 'arm+hf' for define the symbol.

s/for define the symbol/to represent the hard-float abi/ ?

ATB,
Ramsay Jones

> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  cgcc | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/cgcc b/cgcc
> index 7ae6e5c6d..5336ae3ce 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -326,15 +326,10 @@ sub add_specs {
>  		&define_size_t ("long unsigned int") .
>  		' -D__SIZEOF_POINTER__=' . ($m64 ? '8' : '4'));
>      } elsif ($spec eq 'arm') {
> -	chomp (my $gccmachine = `$ccom -dumpmachine`);
> -	my $cppsymbols = ' -m32';
> -
> -	if ($gccmachine eq 'arm-linux-gnueabihf') {
> -	    $cppsymbols .= ' -mfloat-abi=hard';
> -	}
> -
> -	return ($cppsymbols .
> +	return (' -m32' .
>  		&float_types (1, 1, 36, [24,8], [53,11], [53, 11]));
> +    } elsif ($spec eq 'arm+hf') {
> +	return &add_specs ('arm') . ' -mfloat-abi=hard';
>      } elsif ($spec eq 'aarch64') {
>  	return (' -m64' .
>  		&float_types (1, 1, 36, [24,8], [53,11], [113,15]));
> @@ -362,6 +357,10 @@ sub add_specs {
>  	} elsif ($arch =~ /^(sparc64)$/i) {
>  	    return &add_specs ('sparc64');
>  	} elsif ($arch =~ /^arm(?:v[78]l)?$/i) {
> +	    chomp (my $gccmachine = `$ccom -dumpmachine`);
> +	    if ($gccmachine eq 'arm-linux-gnueabihf') {
> +		return &add_specs ('arm+hf');
> +	    }
>  	    return &add_specs ('arm');
>  	} elsif ($arch =~ /^(aarch64)$/i) {
>  	    return &add_specs ('aarch64');
>
diff mbox series

Patch

diff --git a/cgcc b/cgcc
index 7ae6e5c6d..5336ae3ce 100755
--- a/cgcc
+++ b/cgcc
@@ -326,15 +326,10 @@  sub add_specs {
 		&define_size_t ("long unsigned int") .
 		' -D__SIZEOF_POINTER__=' . ($m64 ? '8' : '4'));
     } elsif ($spec eq 'arm') {
-	chomp (my $gccmachine = `$ccom -dumpmachine`);
-	my $cppsymbols = ' -m32';
-
-	if ($gccmachine eq 'arm-linux-gnueabihf') {
-	    $cppsymbols .= ' -mfloat-abi=hard';
-	}
-
-	return ($cppsymbols .
+	return (' -m32' .
 		&float_types (1, 1, 36, [24,8], [53,11], [53, 11]));
+    } elsif ($spec eq 'arm+hf') {
+	return &add_specs ('arm') . ' -mfloat-abi=hard';
     } elsif ($spec eq 'aarch64') {
 	return (' -m64' .
 		&float_types (1, 1, 36, [24,8], [53,11], [113,15]));
@@ -362,6 +357,10 @@  sub add_specs {
 	} elsif ($arch =~ /^(sparc64)$/i) {
 	    return &add_specs ('sparc64');
 	} elsif ($arch =~ /^arm(?:v[78]l)?$/i) {
+	    chomp (my $gccmachine = `$ccom -dumpmachine`);
+	    if ($gccmachine eq 'arm-linux-gnueabihf') {
+		return &add_specs ('arm+hf');
+	    }
 	    return &add_specs ('arm');
 	} elsif ($arch =~ /^(aarch64)$/i) {
 	    return &add_specs ('aarch64');