On Sun, Mar 25, 2012 at 2:27 PM, Nathanael Nerode (GCC)
<ncn_gc...@fastmail.fm> wrote:
>
>> Hi,
>>
>> Can any build maintainers review this patch?
>
> I don't feel comfortable reviewing this, because I don't fully
> comprehend the intricacy of the interactions in this area.  It *looks*
> good, but I don't trust my review abilities here.  If this has been
> tested *in each of the possible modes* on x86-64, then I would approve
> it, but there are an awful lot of combinations, and "Tested on
> Linux/x32" does not tell me whether it works correctly on all of them.
>
> Perhaps someone else will be more able to review this by reading through
> the logic tree.
>
>>
>> Thanks.
>>
>

Since OPTION_MASK_ABI_64 and OPTION_MASK_ABI_X32 have
been added, the --with-abi= patch is much simpler.  It just includes
i386/biarchx32.h instead of i386/biarch64.h when --with-abi={x32|mx32}
or --with-multilib-list=mx32 is used.  OK for trunk?

Thanks.


-- 
H.J.
---
2012-03-28  H.J. Lu  <hongjiu...@intel.com>

        * config.gcc: Use i386/biarchx32.h instead of i386/biarch64.h
        for --with-abi={x32|mx32} or --with-multilib-list=mx32.
        (supported_defaults): Add abi for i[34567]86-*-* and x86_64-*-*.

        * config/i386/biarchx32.h: New.
2012-03-28  H.J. Lu  <hongjiu...@intel.com>

	* config.gcc: Use i386/biarchx32.h instead of i386/biarch64.h
	for --with-abi={x32|mx32} or --with-multilib-list=mx32.
	(supported_defaults): Add abi for i[34567]86-*-* and x86_64-*-*.

	* config/i386/biarchx32.h: New.

diff --git a/gcc/config.gcc b/gcc/config.gcc
index 1f2baee..5bce2c1 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -488,6 +488,10 @@ fi
 
 case ${target} in
 i[34567]86-*-*)
+	if test "x$with_abi" != x; then
+		echo "This target does not support --with-abi."
+		exit 1
+	fi
 	if test "x$enable_cld" = xyes; then
 		tm_defines="${tm_defines} USE_IX86_CLD=1"
 	fi
@@ -497,7 +501,24 @@ i[34567]86-*-*)
 	tm_file="vxworks-dummy.h ${tm_file}"
 	;;
 x86_64-*-*)
-	tm_file="i386/biarch64.h ${tm_file}"
+	case ${with_abi} in
+	"")
+		if test "x$with_multilib_list" = xmx32; then
+			tm_file="i386/biarchx32.h ${tm_file}"
+		else
+			tm_file="i386/biarch64.h ${tm_file}"
+		fi
+		;;
+	64 | m64)
+		tm_file="i386/biarch64.h ${tm_file}"
+		;;
+	x32 | mx32)
+		tm_file="i386/biarchx32.h ${tm_file}"
+		;;
+	*)
+		echo "Unknown ABI used in --with-abi=$with_abi"
+		exit 1
+	esac
 	if test "x$enable_cld" = xyes; then
 		tm_defines="${tm_defines} USE_IX86_CLD=1"
 	fi
@@ -3137,7 +3158,7 @@ case "${target}" in
 		;;
 
 	i[34567]86-*-* | x86_64-*-*)
-		supported_defaults="arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64"
+		supported_defaults="abi arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64"
 		for which in arch arch_32 arch_64 cpu cpu_32 cpu_64 tune tune_32 tune_64; do
 			eval "val=\$with_$which"
 			case ${val} in
diff --git a/gcc/config/i386/biarchx32.h b/gcc/config/i386/biarchx32.h
new file mode 100644
index 0000000..69d6722
--- /dev/null
+++ b/gcc/config/i386/biarchx32.h
@@ -0,0 +1,28 @@
+/* Make configure files to produce biarch compiler defaulting to x32 mode.
+   This file must be included very first, while the OS specific file later
+   to overwrite otherwise wrong defaults.
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+#define TARGET_64BIT_DEFAULT (OPTION_MASK_ISA_64BIT | OPTION_MASK_ABI_X32)
+#define TARGET_BI_ARCH 2

Reply via email to