Patchwork [x32] PATCH: Add --enable-ia32

login
register
mail settings
Submitter H.J. Lu
Date Feb. 21, 2011, 9:06 p.m.
Message ID <20110221210639.GA2772@intel.com>
Download mbox | patch
Permalink /patch/83877/
State New
Headers show

Comments

H.J. Lu - Feb. 21, 2011, 9:06 p.m.
On Sun, Feb 13, 2011 at 03:13:46PM -0800, H.J. Lu wrote:
> Hi,
> 
> I checked this patch into x32 branch so that we can build x32 libraries.
> 

I checked this patch into x32 branch so that we can disable ia32
libraries.


H.J.
--
From 53cdb22776f119902289cd25bda774b18eb30185 Mon Sep 17 00:00:00 2001
From: H.J. Lu <hjl.tools@gmail.com>
Date: Mon, 21 Feb 2011 13:03:39 -0800
Subject: [PATCH] Add --enable-ia32.

---
 gcc/ChangeLog.x32             |    9 +++++++++
 gcc/config.gcc                |   24 ++++++++++++++++++------
 gcc/config/i386/t-linux64-x32 |   34 ++++++++++++++++++++++++++++++++++
 gcc/configure                 |   15 +++++++++++++--
 gcc/configure.ac              |    5 +++++
 5 files changed, 79 insertions(+), 8 deletions(-)
 create mode 100644 gcc/config/i386/t-linux64-x32

Patch

diff --git a/gcc/ChangeLog.x32 b/gcc/ChangeLog.x32
index 364851c..b1e6753 100644
--- a/gcc/ChangeLog.x32
+++ b/gcc/ChangeLog.x32
@@ -1,3 +1,12 @@ 
+2011-02-21  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config.gcc: Support --enable-ia32 for x86 Linux targets.
+
+	* configure.ac: Support --enable-ia32.
+	* configure: Regenerated.
+
+	* config/i386/t-linux64-x32: New.
+
 2011-02-20  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* longlong.h (count_leading_zeros): Use long long builtin for
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 6496914..ab5a7ed 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1257,11 +1257,17 @@  i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i
 		if test x$enable_targets = xall; then
 			tm_file="${tm_file} i386/x86-64.h i386/linux64.h"
 			tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-			if test x$enable_x32 = xyes; then
+			case x${enable_x32}${enable_ia32} in
+			xyesyes)
 				tmake_file="${tmake_file} i386/t-linuxx32"
-			else
+				;;
+			xyesno)
+				tmake_file="${tmake_file} i386/t-linux64-x32"
+				;;
+			*)
 				tmake_file="${tmake_file} i386/t-linux64"
-			fi
+				;;
+			esac
 			need_64bit_hwint=yes
 			need_64bit_isa=yes
 			case X"${with_cpu}" in
@@ -1298,11 +1304,17 @@  x86_64-*-linux* | x86_64-*-kfreebsd*-gnu | x86_64-*-knetbsd*-gnu)
 	x86_64-*-kfreebsd*-gnu) tm_file="${tm_file} kfreebsd-gnu.h" ;;
 	x86_64-*-knetbsd*-gnu) tm_file="${tm_file} knetbsd-gnu.h" ;;
 	esac
-	if test x$enable_x32 = xyes; then
+	case x${enable_x32}${enable_ia32} in
+	xyesyes)
 		tmake_file="${tmake_file} i386/t-linuxx32"
-	else
+		;;
+	xyesno)
+		tmake_file="${tmake_file} i386/t-linux64-x32"
+		;;
+	*)
 		tmake_file="${tmake_file} i386/t-linux64"
-	fi
+		;;
+	esac
 	tmake_file="${tmake_file} i386/t-crtstuff i386/t-crtpc i386/t-crtfm t-dfprules"
 	;;
 i[34567]86-pc-msdosdjgpp*)
diff --git a/gcc/config/i386/t-linux64-x32 b/gcc/config/i386/t-linux64-x32
new file mode 100644
index 0000000..3a4d1de
--- /dev/null
+++ b/gcc/config/i386/t-linux64-x32
@@ -0,0 +1,34 @@ 
+# Copyright (C) 2011 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.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# To support x86-64 and x32 libraries, the directory structrue
+# should be:
+#
+# 	/lib64 has x86-64 libraries.
+# 	/libx32 has x32 libraries.
+#
+MULTILIB_OPTIONS = m64/mx32
+MULTILIB_DIRNAMES = 64 x32
+MULTILIB_OSDIRNAMES = ../lib64 ../libx32
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
+EXTRA_MULTILIB_PARTS=crtbegin.o crtend.o crtbeginS.o crtendS.o \
+		     crtbeginT.o crtprec32.o crtprec64.o crtprec80.o \
+		     crtfastmath.o
diff --git a/gcc/configure b/gcc/configure
index d678648..0f2cb9f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -872,6 +872,7 @@  enable_build_with_cxx
 with_stabs
 enable_multilib
 enable_x32
+enable_ia32
 enable___cxa_atexit
 enable_decimal_float
 enable_fixed_point
@@ -1574,6 +1575,7 @@  Optional Features:
   --enable-build-with-cxx build with C++ compiler instead of C compiler
   --enable-multilib       enable library support for multiple ABIs
   --enable-x32            enable x32 library support for multiple ABIs
+  --enable-ia32           enable ia32 library support for multiple ABIs
   --enable-__cxa_atexit   enable __cxa_atexit for C++
   --enable-decimal-float={no,yes,bid,dpd}
 			enable decimal float extension to C.  Selecting 'bid'
@@ -6885,6 +6887,15 @@  else
 fi
 
 
+# With ia32 support
+# Check whether --enable-ia32 was given.
+if test "${enable_ia32+set}" = set; then :
+  enableval=$enable_ia32;
+else
+  enable_ia32=yes
+fi
+
+
 # Enable __cxa_atexit for C++.
 # Check whether --enable-__cxa_atexit was given.
 if test "${enable___cxa_atexit+set}" = set; then :
@@ -17516,7 +17527,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17519 "configure"
+#line 17530 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -17622,7 +17633,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17625 "configure"
+#line 17636 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 74fe079..50d6a30 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -611,6 +611,11 @@  AC_ARG_ENABLE(x32,
 [  --enable-x32            enable x32 library support for multiple ABIs],
 [], [enable_x32=no])
 
+# With ia32 support
+AC_ARG_ENABLE(ia32,
+[  --enable-ia32           enable ia32 library support for multiple ABIs],
+[], [enable_ia32=yes])
+
 # Enable __cxa_atexit for C++.
 AC_ARG_ENABLE(__cxa_atexit,
 [  --enable-__cxa_atexit   enable __cxa_atexit for C++],