public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Add x32 support to config.guess
@ 2012-08-16 17:27 H.J. Lu
  2012-08-18 12:49 ` Ben Elliston
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2012-08-16 17:27 UTC (permalink / raw)
  To: config-patches, gcc-patches, binutils

Hi,

GCC on Linux/x86-64 may be configured for x32:

https://sites.google.com/site/x32abi/

by default and the Linux/x32 target should be x86_64-VENDOR-linux-gnux32.
This patch adds x32 support to config.guess.  OK to install?

Thanks.


H.J.
---
2012-08-16  H.J. Lu  <hongjiu.lu@intel.com>

	* config.guess (x86_64:Linux:*:*): Append x32 if compiler is
	configured for 32-bit  objects.

diff --git a/config.guess b/config.guess
index b02565c..4b0f7c2 100755
--- a/config.guess
+++ b/config.guess
@@ -984,7 +984,18 @@ EOF
 	echo ${UNAME_MACHINE}-dec-linux-gnu
 	exit ;;
     x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
+	eval $set_cc_for_build
+	X86_64_ABI=
+	# If there is a compiler, see if it is configured for 32-bit objects.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_X32 >/dev/null
+	    then
+		X86_64_ABI=x32
+	    fi
+	fi
+	echo x86_64-unknown-linux-gnu${X86_64_ABI}
 	exit ;;
     xtensa*:Linux:*:*)
 	echo ${UNAME_MACHINE}-unknown-linux-gnu

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

* Re: PATCH: Add x32 support to config.guess
  2012-08-16 17:27 PATCH: Add x32 support to config.guess H.J. Lu
@ 2012-08-18 12:49 ` Ben Elliston
  2012-08-18 13:52   ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Ben Elliston @ 2012-08-18 12:49 UTC (permalink / raw)
  To: H.J. Lu; +Cc: config-patches, gcc-patches, binutils

[-- Attachment #1: Type: text/plain, Size: 505 bytes --]

On Thu, Aug 16, 2012 at 10:26:48AM -0700, H.J. Lu wrote:

> GCC on Linux/x86-64 may be configured for x32:
> https://sites.google.com/site/x32abi/
> by default and the Linux/x32 target should be x86_64-VENDOR-linux-gnux32.
> This patch adds x32 support to config.guess.  OK to install?

> +	eval $set_cc_for_build

I am working to eliminate the use of $set_cc_for_build and am not
really willing to accept any new patches which make this further
entrenched.  Can you please find another way?

Thanks,
Ben

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

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

* Re: PATCH: Add x32 support to config.guess
  2012-08-18 12:49 ` Ben Elliston
@ 2012-08-18 13:52   ` H.J. Lu
  2012-08-18 17:34     ` Mike Stump
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2012-08-18 13:52 UTC (permalink / raw)
  To: Ben Elliston; +Cc: config-patches, gcc-patches, binutils

On Sat, Aug 18, 2012 at 5:49 AM, Ben Elliston <bje@air.net.au> wrote:
> On Thu, Aug 16, 2012 at 10:26:48AM -0700, H.J. Lu wrote:
>
>> GCC on Linux/x86-64 may be configured for x32:
>> https://sites.google.com/site/x32abi/
>> by default and the Linux/x32 target should be x86_64-VENDOR-linux-gnux32.
>> This patch adds x32 support to config.guess.  OK to install?
>
>> +     eval $set_cc_for_build
>
> I am working to eliminate the use of $set_cc_for_build and am not
> really willing to accept any new patches which make this further
> entrenched.  Can you please find another way?
>

In case of x32, the only difference between x32 and x86-64 is
the default output of CC.  What do you recommend how to
detect x32?

Thanks.


-- 
H.J.

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

* Re: PATCH: Add x32 support to config.guess
  2012-08-18 13:52   ` H.J. Lu
@ 2012-08-18 17:34     ` Mike Stump
  2012-08-18 17:41       ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Stump @ 2012-08-18 17:34 UTC (permalink / raw)
  To: H.J. Lu; +Cc: Ben Elliston, config-patches, gcc-patches, binutils

On Aug 18, 2012, at 6:52 AM, "H.J. Lu" <hjl.tools@gmail.com> wrote:
> In case of x32, the only difference between x32 and x86-64 is
> the default output of CC.  What do you recommend how to
> detect x32?

So, is there a cpp symbol that is defined for code-gen?  If so, something like

  If [ $(gcc -x c /dev/null -dM -E | grep x32) = x32 ]; then fi

Would do it.

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

* Re: PATCH: Add x32 support to config.guess
  2012-08-18 17:34     ` Mike Stump
@ 2012-08-18 17:41       ` Mike Frysinger
  2012-08-18 18:02         ` H.J. Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2012-08-18 17:41 UTC (permalink / raw)
  To: binutils; +Cc: Mike Stump, H.J. Lu, Ben Elliston, config-patches, gcc-patches

[-- Attachment #1: Type: Text/Plain, Size: 591 bytes --]

On Saturday 18 August 2012 13:32:59 Mike Stump wrote:
> On Aug 18, 2012, at 6:52 AM, "H.J. Lu" <hjl.tools@gmail.com> wrote:
> > In case of x32, the only difference between x32 and x86-64 is
> > the default output of CC.  What do you recommend how to
> > detect x32?
> 
> So, is there a cpp symbol that is defined for code-gen?  If so, something
> like
> 
>   If [ $(gcc -x c /dev/null -dM -E | grep x32) = x32 ]; then fi
> 
> Would do it.

how is executing `gcc` any better than $CC_FOR_BUILD ?

your code suggestion here is pretty much what H.J. Lu is already doing.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: PATCH: Add x32 support to config.guess
  2012-08-18 17:41       ` Mike Frysinger
@ 2012-08-18 18:02         ` H.J. Lu
  2012-08-18 18:53           ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: H.J. Lu @ 2012-08-18 18:02 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: binutils, Mike Stump, Ben Elliston, config-patches, gcc-patches

On Sat, Aug 18, 2012 at 10:40 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Saturday 18 August 2012 13:32:59 Mike Stump wrote:
>> On Aug 18, 2012, at 6:52 AM, "H.J. Lu" <hjl.tools@gmail.com> wrote:
>> > In case of x32, the only difference between x32 and x86-64 is
>> > the default output of CC.  What do you recommend how to
>> > detect x32?
>>
>> So, is there a cpp symbol that is defined for code-gen?  If so, something
>> like
>>
>>   If [ $(gcc -x c /dev/null -dM -E | grep x32) = x32 ]; then fi
>>
>> Would do it.
>
> how is executing `gcc` any better than $CC_FOR_BUILD ?
>
> your code suggestion here is pretty much what H.J. Lu is already doing.
> -mike

There are 12 existing set_cc_for_build usages in config.guess.
I don't think it is reasonable to require x32 not to use it without
providing an alternative.  If you want to remove set_cc_for_build,
one extra usage doesn't make it much harder to do.

-- 
H.J.

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

* Re: PATCH: Add x32 support to config.guess
  2012-08-18 18:02         ` H.J. Lu
@ 2012-08-18 18:53           ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2012-08-18 18:53 UTC (permalink / raw)
  To: H.J. Lu; +Cc: binutils, Mike Stump, Ben Elliston, config-patches, gcc-patches

[-- Attachment #1: Type: Text/Plain, Size: 1082 bytes --]

On Saturday 18 August 2012 14:01:57 H.J. Lu wrote:
> On Sat, Aug 18, 2012 at 10:40 AM, Mike Frysinger wrote:
> > On Saturday 18 August 2012 13:32:59 Mike Stump wrote:
> >> On Aug 18, 2012, at 6:52 AM, "H.J. Lu" <hjl.tools@gmail.com> wrote:
> >> > In case of x32, the only difference between x32 and x86-64 is
> >> > the default output of CC.  What do you recommend how to
> >> > detect x32?
> >> 
> >> So, is there a cpp symbol that is defined for code-gen?  If so,
> >> something like
> >> 
> >>   If [ $(gcc -x c /dev/null -dM -E | grep x32) = x32 ]; then fi
> >> 
> >> Would do it.
> > 
> > how is executing `gcc` any better than $CC_FOR_BUILD ?
> > 
> > your code suggestion here is pretty much what H.J. Lu is already doing.
> 
> There are 12 existing set_cc_for_build usages in config.guess.
> I don't think it is reasonable to require x32 not to use it without
> providing an alternative.  If you want to remove set_cc_for_build,
> one extra usage doesn't make it much harder to do.

(in case it wasn't clear, i'm in favor of H.J. Lu's patch)
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-08-18 18:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-16 17:27 PATCH: Add x32 support to config.guess H.J. Lu
2012-08-18 12:49 ` Ben Elliston
2012-08-18 13:52   ` H.J. Lu
2012-08-18 17:34     ` Mike Stump
2012-08-18 17:41       ` Mike Frysinger
2012-08-18 18:02         ` H.J. Lu
2012-08-18 18:53           ` Mike Frysinger

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