Re: PATCH: Add x32 support to config.guess

2012-08-18 Thread Ben Elliston
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


signature.asc
Description: Digital signature


Re: PATCH: Add x32 support to config.guess

2012-08-18 Thread H.J. Lu
On Sat, Aug 18, 2012 at 5:49 AM, Ben Elliston b...@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.


Re: PATCH: Add x32 support to config.guess

2012-08-18 Thread Mike Stump
On Aug 18, 2012, at 6:52 AM, H.J. Lu hjl.to...@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.


Re: PATCH: Add x32 support to config.guess

2012-08-18 Thread Mike Frysinger
On Saturday 18 August 2012 13:32:59 Mike Stump wrote:
 On Aug 18, 2012, at 6:52 AM, H.J. Lu hjl.to...@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


signature.asc
Description: This is a digitally signed message part.


Re: PATCH: Add x32 support to config.guess

2012-08-18 Thread H.J. Lu
On Sat, Aug 18, 2012 at 10:40 AM, Mike Frysinger vap...@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.to...@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.


Re: PATCH: Add x32 support to config.guess

2012-08-18 Thread Mike Frysinger
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.to...@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


signature.asc
Description: This is a digitally signed message part.


PATCH: Add x32 support to config.guess

2012-08-16 Thread H.J. Lu
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...@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