From patchwork Thu Aug 16 17:26:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PATCH: Add x32 support to config.guess Date: Thu, 16 Aug 2012 07:26:48 -0000 From: "H.J. Lu" X-Patchwork-Id: 178054 Message-Id: <20120816172648.GA7120@intel.com> To: config-patches@gnu.org, gcc-patches@gcc.gnu.org, binutils@sourceware.org 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 * 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