diff mbox series

[5/7] cgcc: add support for x86-x32

Message ID 20190217153131.94556-6-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
Detect when the target is x86-64 and use the appropriate flag '-mx32'.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 cgcc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ramsay Jones Feb. 20, 2019, 1:55 a.m. UTC | #1
On 17/02/2019 15:31, Luc Van Oostenryck wrote:
> Detect when the target is x86-64 and use the appropriate flag '-mx32'.

Hmm, 'Detect when the target is 32-bit user-space on an x86-64 and
pass the appropriate '-mx32' flag.'

Maybe.

[I told you the comments were minor (apart from the last two
patches, of course). ;-) ]

ATB,
Ramsay Jones

> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> ---
>  cgcc | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/cgcc b/cgcc
> index 69380c60d..d178e3bc3 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -356,7 +356,9 @@ sub add_specs {
>  	    return &add_specs ('ppc64+le');
>  	} elsif ($gccmachine =~ '^s390x-') {
>  	    return &add_specs ('s390x');
> -	} elsif ($gccmachine eq 'x86_64-linux-gnu') {
> +	} elsif ($gccmachine eq 'x86_64-linux-gnux32') {
> +	    return &add_specs ('x86_64') . ' -mx32';
> +	} elsif ($gccmachine =~ '^x86_64-') {
>  	    return &add_specs ('x86_64');
>  	}
>  
>
diff mbox series

Patch

diff --git a/cgcc b/cgcc
index 69380c60d..d178e3bc3 100755
--- a/cgcc
+++ b/cgcc
@@ -356,7 +356,9 @@  sub add_specs {
 	    return &add_specs ('ppc64+le');
 	} elsif ($gccmachine =~ '^s390x-') {
 	    return &add_specs ('s390x');
-	} elsif ($gccmachine eq 'x86_64-linux-gnu') {
+	} elsif ($gccmachine eq 'x86_64-linux-gnux32') {
+	    return &add_specs ('x86_64') . ' -mx32';
+	} elsif ($gccmachine =~ '^x86_64-') {
 	    return &add_specs ('x86_64');
 	}