public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* [patch, mips] Fix stubs files for hard float vs. soft float
@ 2012-10-15 20:15 Steve Ellcey 
  2012-10-15 21:15 ` Andreas Schwab
  2012-10-15 22:08 ` Joseph S. Myers
  0 siblings, 2 replies; 24+ messages in thread
From: Steve Ellcey  @ 2012-10-15 20:15 UTC (permalink / raw)
  To: libc-ports

While working on various flavors of glibc, I found that building on MIPS 
with and without floating point enabled resulted in different stub files,
but the MIPS makefile did not handle this difference correctly (it would
always create a stubs-o32.h (or n32 or n64) header file and that file would
look different depending on whether or not you enabled floating point.

This patch creates different stub files for hard float vs. soft float, which
combined with o32, n32, and n64 results in 6 different stub files. Rather
then create 6 different Makefiles to set abi-default (there are 3 right now)
I changed mips to use the ARM method of setting abi-default by preprocessing
a C file.  This allowed me to remove the 3 Makefiles that did nothing but set
abi-default instead of having to add 3 more Makefiles to handle the soft vs.
hard differences.

Tested by building soft and hard float versions glibc on MIPS for o32, n32,
and n64 versions.

OK to checkin?

Steve Ellcey
sellcey@mips.com



2012-10-15  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/Makefile (default-abi): Set.
	* (abi-variants): Add hard and soft float versions.
	* (abi-*-options):  update with hard and soft flags.
	* (abi-*-condition): Ditto.


diff --git a/ports/sysdeps/unix/sysv/linux/mips/Makefile b/ports/sysdeps/unix/sysv/linux/mips/Makefile
index 99c554f..27f74fc 100644
--- a/ports/sysdeps/unix/sysv/linux/mips/Makefile
+++ b/ports/sysdeps/unix/sysv/linux/mips/Makefile
@@ -8,15 +8,60 @@ sysdep_routines += cachectl cacheflush sysmips _test_and_set
 sysdep_headers += sys/cachectl.h sys/sysmips.h sys/tas.h
 endif
 
+define default-abi-prog
+echo '#if defined(__mips_soft_float) && (_MIPS_SIM == _ABIO32)';
+echo 'o32_soft';
+echo '#elif defined(__mips_hard_float) && (_MIPS_SIM == _ABIO32)';
+echo 'o32_hard';
+echo '#elif defined(__mips_soft_float) && (_MIPS_SIM == _ABIN32)';
+echo 'n32_soft';
+echo '#elif defined(__mips_hard_float) && (_MIPS_SIM == _ABIN32)';
+echo 'n32_hard';
+echo '#elif defined(__mips_soft_float) && (_MIPS_SIM == _ABI64)';
+echo 'n64_soft';
+echo '#elif defined(__mips_hard_float) && (_MIPS_SIM == _ABI64)';
+echo 'n64_hard';
+echo '#endif'
+endef
+default-abi := $(strip $(shell \
+    ($(default-abi-prog)) | $(CC) $(CFLAGS) $(CPPFLAGS) -E -P -))
+
+ifneq ($(default-abi),o32_soft)
+ifneq ($(default-abi),o32_hard)
+ifneq ($(default-abi),n32_soft)
+ifneq ($(default-abi),n32_hard)
+ifneq ($(default-abi),n64_soft)
+ifneq ($(default-abi),n64_hard)
+Unknown ABI, must be "o32_soft", "o32_hard", "n32_soft", "n32_hard",
+"n64_soft", or "n64_hard"
+endif
+endif
+endif
+endif
+endif
+endif
+
 # _MIPS_SIM_ABI32 == 1, _MIPS_SIM_NABI32 == 2, _MIPS_SIM_ABI64 == 3
-abi-variants := o32 n32 n64
+abi-variants := o32_soft o32_hard n32_soft n32_hard n64_soft n64_hard
 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
+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)

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-10-26 23:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-15 20:15 [patch, mips] Fix stubs files for hard float vs. soft float 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
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

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).