This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Auto detect HOST_64BIT_TYPE and HOST_U_64BIT_TYPE


On Thu, Sep 18, 2003 at 10:27:02AM -0700, Ian Lance Taylor wrote:
> "H. J. Lu" <hjl@lucon.org> writes:
> 
> > On Thu, Sep 18, 2003 at 10:19:07AM -0700, Ian Lance Taylor wrote:
> > > "H. J. Lu" <hjl@lucon.org> writes:
> > > 
> > > > There is no need to hard code HOST_64BIT_TYPE nor HOST_U_64BIT_TYPE. We
> > > > can auto detect them. Here is the patch.
> > > 
> > > I think we might as well eliminate host64 at the same time.  It
> > > doesn't add much, and will simplify configure.host even more.  We can
> > > set host64 if sizeof(long) == 8, if that seems helpful.
> > > 
> > 
> > On some systems, long is 4 bytes and long long is 8 bytes. But long
> > long is as fast as long.
> 
> Yes, I know.  I agree that not setting host64 will change cross-tools
> built on some systems.  But what difference does it really make?
> 

How about this?


H.J.
----
2003-09-18  H.J. Lu  <hongjiu.lu@intel.com>

	* acinclude.m4: Include ../config/accross.m4.
	* aclocal.m4: Regenerated.

	* configure.host (HOST_64BIT_TYPE): Remove if it is set to long
	or long long.
	(HOST_U_64BIT_TYPE): Remove if it is set to unsigned long long.
	(host64): Remove if HOST_64BIT_TYPE is set to long.

	* configure.in (HOST_64BIT_TYPE): Set according to the size of
	long and long long.
	(HOST_U_64BIT_TYPE): Likewise.
	(host64): Likewise.
	* configure: Regenerated.

--- bfd/acinclude.m4.ll	2003-05-03 08:51:46.000000000 -0700
+++ bfd/acinclude.m4	2003-09-18 09:29:24.000000000 -0700
@@ -1,3 +1,5 @@
+sinclude(../config/accross.m4)
+
 dnl See whether we need to use fopen-bin.h rather than fopen-same.h.
 AC_DEFUN(BFD_BINARY_FOPEN,
 [AC_REQUIRE([AC_CANONICAL_SYSTEM])
--- bfd/configure.host.ll	2003-07-17 16:56:18.000000000 -0700
+++ bfd/configure.host	2003-09-18 11:16:29.000000000 -0700
@@ -19,22 +19,13 @@ HOST_U_64BIT_TYPE=
 
 case "${host}" in
 
-alpha*-*-*)		host64=true; HOST_64BIT_TYPE=long ;;
-
-hppa*64*-*-hpux*)	HDEFINES=-DHOST_HPPAHPUX;
-			host64=true; HOST_64BIT_TYPE=long ;;
 hppa*-*-hpux*)		HDEFINES=-DHOST_HPPAHPUX ;;
 hppa*-*-hiux*)		HDEFINES=-DHOST_HPPAHPUX ;;
-hppa*64*-*-linux*)	host64=true; HOST_64BIT_TYPE=long ;;
 hppa*-*-mpeix*)		HDEFINES=-DHOST_HPPAMPEIX ;;
 hppa*-*-bsd*)		HDEFINES=-DHOST_HPPABSD ;;
 hppa*-*-osf*)		HDEFINES=-DHOST_HPPAOSF ;;
 
-ia64-*-linux*)		host64=true; HOST_64BIT_TYPE=long ;;
-ia64-*-hpux*)		host64=true
-			HOST_64BIT_TYPE="long long";
-			HOST_U_64BIT_TYPE="unsigned long long";
-			;;
+ia64-*-*)		host64=true;;
 
 i[3-7]86-sequent-bsd*)	HDEFINES=-Dshared=genshared ;;
 i[3-7]86-sequent-sysv4*) ;;
@@ -45,28 +36,14 @@ mips*-*-openbsd*)	;;
 mips*-dec-*)		HDEFINES="-G 4"	;;
 mips*-sgi-irix3*)	HDEFINES="-G 4" ;;
 mips*-sgi-irix4*)	HDEFINES="-G 4" ;;
-mips*-sgi-irix6*)	host64=true
-			HOST_64BIT_TYPE="long long";
-			HOST_U_64BIT_TYPE="unsigned long long";
-			;;
-mips64*-*-linux*)	host64=true
-			HOST_64BIT_TYPE="long long";
-			HOST_U_64BIT_TYPE="unsigned long long";
-			;;
+mips*-sgi-irix6*)	host64=true;;
+mips64*-*-linux*)	host64=true;;
 mips*-*-sysv4*)		;;
 mips*-*-sysv*)		HDEFINES="-G 4" ;;
 mips*-*-riscos*)	HDEFINES="-G 4" ;;
 
 m68*-hp-hpux*)		HDEFINES=-DHOST_HP300HPUX ;;
 
-*-*-aix*)		HOST_64BIT_TYPE="long long"
-			HOST_U_64BIT_TYPE="unsigned long long"
-			;;
-
-*-*-solaris*)		HOST_64BIT_TYPE="long long"
-			HOST_U_64BIT_TYPE="unsigned long long"
-			;;
-
 *-*-windows*)
 			HOST_64BIT_TYPE=__int64
 			HOST_U_64BIT_TYPE="unsigned __int64"
--- bfd/configure.in.ll	2003-09-16 09:26:06.000000000 -0700
+++ bfd/configure.in	2003-09-18 11:13:19.000000000 -0700
@@ -117,13 +117,6 @@ BFD_HOST_LONG_LONG=0
 BFD_HOST_64_BIT_DEFINED=0
 BFD_HOST_64_BIT=
 BFD_HOST_U_64_BIT=
-if test "x${HOST_64BIT_TYPE}" = "xlong"; then
-  BFD_HOST_64BIT_LONG=1
-elif test "x${HOST_64BIT_TYPE}" != "x"; then
-  BFD_HOST_64_BIT_DEFINED=1
-  BFD_HOST_64_BIT=${HOST_64BIT_TYPE}
-  BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE}
-fi
 
 AC_MSG_CHECKING([for long long])
 AC_CACHE_VAL(bfd_cv_has_long_long,
@@ -133,6 +126,24 @@ bfd_cv_has_long_long=yes, bfd_cv_has_lon
 AC_MSG_RESULT($bfd_cv_has_long_long)
 if test $bfd_cv_has_long_long = yes; then
   BFD_HOST_LONG_LONG=1
+  AC_COMPILE_CHECK_SIZEOF(long long)
+fi
+
+AC_COMPILE_CHECK_SIZEOF(long)
+if test "x${ac_cv_sizeof_long}" = "x8"; then
+  host64=true
+  HOST_64BIT_TYPE="long"
+elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
+  HOST_64BIT_TYPE="long long"
+  HOST_U_64BIT_TYPE="unsigned long long"
+fi
+
+if test "x${HOST_64BIT_TYPE}" = "xlong"; then
+  BFD_HOST_64BIT_LONG=1
+elif test "x${HOST_64BIT_TYPE}" != "x"; then
+  BFD_HOST_64_BIT_DEFINED=1
+  BFD_HOST_64_BIT=${HOST_64BIT_TYPE}
+  BFD_HOST_U_64_BIT=${HOST_U_64BIT_TYPE}
 fi
 
 AC_SUBST(BFD_HOST_64BIT_LONG)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]