This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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] Cleanup MIPS preconfigure script


On Fri, 2014-09-05 at 00:23 +0100, Maciej W. Rozycki wrote:

>  Hmm, I never thought of such use and I keep considering it weird, but 
> having looked through the current script again we already permit e.g. 
> `mips64-linux-gnuabi32' to select o32, so I take my concern back, no need 
> for any checks here.

OK, that shrinks the preconfigure script even more.

>  Good.  Frankly (with the observation I made above) I think there should 
> be no difference between configuring for `mips-linux-gnu' and 
> `mips64-linux-gnuabi32'.

I agree, here is a new patch.  I complete removed the setting of
base_machine since it is not used and I removed the line:

machine=$machine/$config_machine

that was in my earlier patch because that did serve any purpose
that I could find, it was part of the original 32 bit mips preconfigure
path, which is why I originally had left it in.

Steve Ellcey
sellcey@mips.com


2014-09-05  Steve Ellcey  <sellcey@mips.com>

	* sysdeps/mips/preconfigure: Modify ABI tests.


diff --git a/sysdeps/mips/preconfigure b/sysdeps/mips/preconfigure
index b215eb2..343ef16 100644
--- a/sysdeps/mips/preconfigure
+++ b/sysdeps/mips/preconfigure
@@ -1,34 +1,20 @@
-case "$machine" in
-mips64*)	base_machine=mips64
-		case "$CC $CFLAGS $CPPFLAGS " in
-		*" -mabi=n32 "*) mips_cc_abi=n32 ;;
-		*" -mabi=64 "*|*" -mabi=n64 "*) mips_cc_abi=64 ;;
-		*" -mabi=32 "*|*" -mabi=o32 "*) mips_cc_abi=32 ;;
-		*) mips_cc_abi=default ;;
-		esac
-		case $config_os in
-		*abin32*) mips_config_abi=n32 ;;
-		*abi64*|*abin64*) mips_config_abi=64 ;;
-		*abi32*|*abio32*) mips_config_abi=32 ;;
-		*) mips_config_abi=$mips_cc_abi ;;
-		esac
-		case $mips_config_abi in
-		default) machine=mips/mips64/n32 mips_config_abi=n32 ;;
-		n32) machine=mips/mips64/n32 ;;
-		64) machine=mips/mips64/n64 ;;
-		32) machine=mips/mips32/kern64 ;;
-		esac
-		machine=$machine/$config_machine
-		if test $mips_config_abi != $mips_cc_abi; then
-		  # This won't make it to config.make, but we want to
-		  # set this in case configure tests depend on it.
-		  CPPFLAGS="$CPPFLAGS -mabi=$mips_config_abi"
-		fi
-		;;
-mips*)		base_machine=mips
-		case "$CC $CFLAGS $CPPFLAGS " in
-		*" -mips16 "*) machine=mips/mips32/mips16/$machine ;;
-		*) machine=mips/mips32/$machine ;;
-		esac
-		;;
-esac
+abiflag=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define _MIPS_SIM \(.*\)/\1/p'`
+mips16flag=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __mips16 \(.*\)/\1/p'`
+
+if test "$abiflag" = "_ABIO32" ; then
+	if test "$mips16flag" = "1" ; then
+		machine=mips/mips32/mips16
+	else
+		machine=mips/mips32
+	fi
+elif test "$abiflag" = "_ABIN32" ; then
+	machine=mips/mips64/n32
+elif test "$abiflag" = "_ABI64" ; then
+	machine=mips/mips64/n64
+else
+	as_fn_error $? "Unable to determine ABI." "$LINENO" 5
+fi
+
+if test "$abiflag" != "_ABIO32" -a "$mips16flag" = "1"; then
+	as_fn_error $? "mips16 is only supported with the O32 ABI." "$LINENO" 5
+fi



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