This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Cleanup MIPS preconfigure script
- From: Steve Ellcey <sellcey at mips dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>, <matthew dot fortune at imgtec dot com>, Catherine Moore <clm at codesourcery dot com>
- Date: Fri, 5 Sep 2014 13:17:16 -0700
- Subject: Re: [PATCH] Cleanup MIPS preconfigure script
- Authentication-results: sourceware.org; auth=none
- References: <6b5ce132-2a69-4ee9-aaa5-d07792e72b50 at BAMAIL02 dot ba dot imgtec dot org> <alpine dot DEB dot 1 dot 10 dot 1409042322000 dot 27075 at tp dot orcam dot me dot uk> <1409871127 dot 2740 dot 76 dot camel at ubuntu-sellcey> <alpine dot DEB dot 1 dot 10 dot 1409050002390 dot 27075 at tp dot orcam dot me dot uk>
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