2012-10-29 Steve Ellcey <sellcey@mips.com>
authorSteve Ellcey <sellcey@mips.com>
Mon, 29 Oct 2012 18:42:39 +0000 (11:42 -0700)
committerSteve Ellcey <sellcey@mips.com>
Mon, 29 Oct 2012 18:42:39 +0000 (11:42 -0700)
* sysdeps/unix/sysv/linux/mips/mips32/Makefile: Remove.
* sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile: Remove.
* sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile: Remove.
* sysdeps/unix/sysv/linux/mips/configure.in: Create default_abi.make.
* sysdeps/unix/sysv/linux/mips/configure: Regenerate.
* sysdeps/unix/sysv/linux/mips/Makefile: Include default_abi.make.
(abi-variants): Add hard and soft float versions.
(abi-o32-options): Remove.
(abi-o32-condition): Remove.
(abi-n32-options): Remove.
(abi-n32-condition): Remove.
(abi-n64-options): Remove.
(abi-n64-condition): Remove.
(abi-o32_soft-options): New.
(abi-o32_soft-condition): New.
(abi-o32_hard-options): New.
(abi-o32_hard-condition): New.
(abi-n32_soft-options): New.
(abi-n32_soft-condition): New.
(abi-n32_hard-options): New.
(abi-n32_hard-condition): New.
(abi-n64_soft-options): New.
(abi-n64_soft-condition): New.
(abi-n64_hard-options): New.
(abi-n64_hard-condition): New.

ports/ChangeLog.mips
ports/sysdeps/unix/sysv/linux/mips/Makefile
ports/sysdeps/unix/sysv/linux/mips/configure
ports/sysdeps/unix/sysv/linux/mips/configure.in

index a6aecad24e3e010a1b54cc3924213a6fbd817bc3..76f2703881391a48f191bd104d6dfbeb67dcb9f5 100644 (file)
@@ -1,3 +1,31 @@
+2012-10-29  Steve Ellcey  <sellcey@mips.com>
+
+       * sysdeps/unix/sysv/linux/mips/mips32/Makefile: Remove.
+       * sysdeps/unix/sysv/linux/mips/mips64/n32/Makefile: Remove.
+       * sysdeps/unix/sysv/linux/mips/mips64/n64/Makefile: Remove.
+       * sysdeps/unix/sysv/linux/mips/configure.in: Create default_abi.make.
+       * sysdeps/unix/sysv/linux/mips/configure: Regenerate.
+       * sysdeps/unix/sysv/linux/mips/Makefile: Include default_abi.make.
+       (abi-variants): Add hard and soft float versions.
+       (abi-o32-options): Remove.
+       (abi-o32-condition): Remove.
+       (abi-n32-options): Remove.
+       (abi-n32-condition): Remove.
+       (abi-n64-options): Remove.
+       (abi-n64-condition): Remove.
+       (abi-o32_soft-options): New.
+       (abi-o32_soft-condition): New.
+       (abi-o32_hard-options): New.
+       (abi-o32_hard-condition): New.
+       (abi-n32_soft-options): New.
+       (abi-n32_soft-condition): New.
+       (abi-n32_hard-options): New.
+       (abi-n32_hard-condition): New.
+       (abi-n64_soft-options): New.
+       (abi-n64_soft-condition): New.
+       (abi-n64_hard-options): New.
+       (abi-n64_hard-condition): New.
+
 2012-10-19  Roland McGrath  <roland@hack.frob.com>
 
        * sysdeps/unix/sysv/linux/mips/mips32/nptl/libc.abilist
index 99c554ff6764787a79a0b7f7a3189cd46d625701..66ba621dae1a2827bda5c6e4f2e2d3b2e8dc5494 100644 (file)
@@ -8,15 +8,42 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set
 sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
 endif
 
-# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
-abi-variants := o32 n32 n64
+# Get value of default-abi.
+include $(common-objpfx)default-abi.make
+
+abi-variants := o32_soft o32_hard n32_soft n32_hard n64_soft n64_hard
+
+ifeq (,$(filter $(default-abi),$(abi-variants)))
+Unknown ABI, must be one of $(abi-variants)
+endif
+
 abi-includes := sgidefs.h
-abi-o32-options := -D_MIPS_SIM=1
-abi-o32-condition := _MIPS_SIM == _MIPS_SIM_ABI32
-abi-n32-options := -D_MIPS_SIM=2
-abi-n32-condition := _MIPS_SIM == _MIPS_SIM_NABI32
-abi-n64-options := -D_MIPS_SIM=3
-abi-n64-condition := _MIPS_SIM == _MIPS_SIM_ABI64
+
+# _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
+abi-o32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+                       -D__mips_soft_float -U__mips_hard_float
+abi-o32_soft-condition := defined(__mips_soft_float) \
+                          && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=1 \
+                       -D__mips_hard_float -U__mips_soft_float
+abi-o32_hard-condition := defined(__mips_hard_float) \
+                         && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-n32_soft-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+                       -D__mips_soft_float -U__mips_hard_float
+abi-n32_soft-condition := defined(__mips_soft_float) \
+                         && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_hard-options := -U_MIPS_SIM -D_MIPS_SIM=2 \
+                       -D__mips_hard_float -U__mips_soft_float
+abi-n32_hard-condition := defined(__mips_hard_float) \
+                         && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n64_soft-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+                       -D__mips_soft_float -U__mips_hard_float
+abi-n64_soft-condition := defined(__mips_soft_float) \
+                         && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_hard-options := -U_MIPS_SIM -D_MIPS_SIM=3 \
+                       -D__mips_hard_float -U__mips_soft_float
+abi-n64_hard-condition := defined(__mips_hard_float) \
+                         && (_MIPS_SIM == _MIPS_SIM_ABI64)
 
 ifeq ($(subdir),elf)
 ifeq ($(build-shared),yes)
index 051432df88eac17f9f1e29402bb16acce4fb071c..36757e880b2fe27fa30bb2b8cc4baf6b39a8f840 100644 (file)
@@ -1,6 +1,112 @@
 # This file is generated from configure.in by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/unix/sysv/linux/mips.
 
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    #if (_MIPS_SIM != _ABIO32)
+    #error Not O32 ABI
+    #endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_mips_abi=o32
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+      #if (_MIPS_SIM != _ABIN32)
+      #error Not N32 ABI
+      #endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_mips_abi=n32
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+        #if (_MIPS_SIM != _ABI64)
+        #error Not 64 ABI
+        #endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_mips_abi=n64
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test -z "$libc_mips_abi"; then
+  as_fn_error "could not determine what ABI the compiler is using" "$LINENO" 5
+fi
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+    #if !defined(__mips_soft_float)
+    #error Not soft ABI
+    #endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_mips_float=soft
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+      #if !defined(__mips_hard_float)
+      #error Not hard ABI
+      #endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  libc_mips_float=hard
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test -z "$libc_mips_float"; then
+  as_fn_error "could not determine if compiler is using hard or soft floating point ABI" "$LINENO" 5
+fi
+
+echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make
+
 case "$prefix" in
 /usr | /usr/)
   # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.
index 18e8bbc5c3084eec5746c567fc15228b1211ea70..167779eaf94e8bdd945bee717da5f76507ddaa4a 100644 (file)
@@ -2,6 +2,50 @@ sinclude(./aclocal.m4)dnl Autoconf lossage
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/unix/sysv/linux/mips.
 
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([
+    #if (_MIPS_SIM != _ABIO32)
+    #error Not O32 ABI
+    #endif])],
+  [libc_mips_abi=o32],
+  [AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([
+      #if (_MIPS_SIM != _ABIN32)
+      #error Not N32 ABI
+      #endif])],
+    [libc_mips_abi=n32],
+    [AC_COMPILE_IFELSE(
+      [AC_LANG_PROGRAM([
+        #if (_MIPS_SIM != _ABI64)
+        #error Not 64 ABI
+        #endif])],
+      [libc_mips_abi=n64],
+      [])])])
+
+if test -z "$libc_mips_abi"; then
+  AC_MSG_ERROR([could not determine what ABI the compiler is using])
+fi
+
+AC_COMPILE_IFELSE(
+  [AC_LANG_PROGRAM([
+    #if !defined(__mips_soft_float)
+    #error Not soft ABI
+    #endif])],
+  [libc_mips_float=soft],
+  [AC_COMPILE_IFELSE(
+    [AC_LANG_PROGRAM([
+      #if !defined(__mips_hard_float)
+      #error Not hard ABI
+      #endif])],
+    [libc_mips_float=hard],
+    [])])
+
+if test -z "$libc_mips_float"; then
+  AC_MSG_ERROR([could not determine if compiler is using hard or soft floating point ABI])
+fi
+
+echo "default-abi := ${libc_mips_abi}_${libc_mips_float}" > default-abi.make
+
 case "$prefix" in
 /usr | /usr/)
   # 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib.