public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
From: Steve Ellcey <sellcey@mips.com>
To: Roland McGrath <roland@hack.frob.com>
Cc: Andreas Schwab <schwab@linux-m68k.org>,
	       "Joseph S. Myers"	<joseph@codesourcery.com>,
	       <libc-ports@sourceware.org>
Subject: Re: [patch, mips] Fix stubs files for hard float vs. soft float
Date: Thu, 25 Oct 2012 00:00:00 -0000	[thread overview]
Message-ID: <1351123186.15035.57.camel@ubuntu-sellcey> (raw)
In-Reply-To: <20121024172501.AA6E52C0A5@topped-with-meat.com>


OK, Here is my latest attempt at this patch.  I think I have addressed
all the issues raised.  FYI, I tried putting the AC_MSG_ERROR calls
directly into the last 'else' part of the nested AC_COMPILE_IFELSE
macros but that always resulted in an error during configure, that is
why I do a separate check and AC_MSG_ERROR call outside of the
AC_COMPILE_IFELSE macros.

Steve Ellcey
sellcey@mips.com

2012-10-24  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.


diff --git a/ports/sysdeps/unix/sysv/linux/mips/Makefile b/ports/sysdeps/unix/sysv/linux/mips/Makefile
index 99c554f..9f7d702 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/ports/sysdeps/unix/sysv/linux/mips/Makefile
@@ -8,15 +8,36 @@ 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 abi-default
+#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 := -D_MIPS_SIM=1 -D__mips_soft_float
+abi-o32_soft-condition := defined(__mips_soft_float) \
+			   && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-o32_hard-options := -D_MIPS_SIM=1 -D__mips_hard_float
+abi-o32_hard-condition := defined(__mips_hard_float) \
+			  && (_MIPS_SIM == _MIPS_SIM_ABI32)
+abi-n32_soft-options := -D_MIPS_SIM=2 -D__mips_soft_float
+abi-n32_soft-condition := defined(__mips_soft_float) \
+			  && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n32_hard-options := -D_MIPS_SIM=2 -D__mips_hard_float
+abi-n32_hard-condition := defined(__mips_hard_float) \
+			  && (_MIPS_SIM == _MIPS_SIM_NABI32)
+abi-n64_soft-options := -D_MIPS_SIM=3 -D__mips_soft_float
+abi-n64_soft-condition := defined(__mips_soft_float) \
+			  && (_MIPS_SIM == _MIPS_SIM_ABI64)
+abi-n64_hard-options := -D_MIPS_SIM=3 -D__mips_hard_float
+abi-n64_hard-condition := defined(__mips_hard_float) \
+			  && (_MIPS_SIM == _MIPS_SIM_ABI64)
 
 ifeq ($(subdir),elf)
 ifeq ($(build-shared),yes)
diff --git a/ports/sysdeps/unix/sysv/linux/mips/configure.in b/ports/sysdeps/unix/sysv/linux/mips/configure.in
index 18e8bbc..07cffa3 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/configure.in
+++ b/ports/sysdeps/unix/sysv/linux/mips/configure.in
@@ -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=64],
+      [])])])
+
+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.



  reply	other threads:[~2012-10-25  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-15 20:15 Steve Ellcey 
2012-10-15 21:15 ` Andreas Schwab
2012-10-15 21:23   ` Andreas Schwab
2012-10-15 22:08 ` Joseph S. Myers
2012-10-15 23:06   ` Steve Ellcey
2012-10-15 23:31     ` Joseph S. Myers
2012-10-22 23:31       ` Steve Ellcey
2012-10-22 23:38         ` Joseph S. Myers
2012-10-23 20:20           ` Steve Ellcey
2012-10-23 21:32             ` Roland McGrath
2012-10-23 22:14               ` Steve Ellcey
2012-10-23 22:48                 ` Roland McGrath
2012-10-24 16:19                   ` Steve Ellcey
2012-10-24 16:37                     ` Andreas Schwab
2012-10-24 17:13                       ` Steve Ellcey
2012-10-24 17:25                         ` Roland McGrath
2012-10-25  0:00                           ` Steve Ellcey [this message]
2012-10-25 12:41                             ` Joseph S. Myers
2012-10-25 20:36                               ` Steve Ellcey
2012-10-26 21:06                               ` Steve Ellcey
2012-10-26 22:11                                 ` Joseph S. Myers
2012-10-26 23:00                                   ` Roland McGrath
2012-10-24 16:41                     ` Joseph S. Myers
2012-10-24  0:05             ` Joseph S. Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351123186.15035.57.camel@ubuntu-sellcey \
    --to=sellcey@mips.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-ports@sourceware.org \
    --cc=roland@hack.frob.com \
    --cc=schwab@linux-m68k.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).