This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports 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]

[patch, mips] Fix stubs files for hard float vs. soft float


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)


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