This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: [patch, mips] Fix stubs files for hard float vs. soft float
On Mon, 2012-10-22 at 23:37 +0000, Joseph S. Myers wrote:
> On Mon, 22 Oct 2012, Steve Ellcey wrote:
>
> > > OK, those do look like correct differences (unless and until MIPS
> > > soft-float is made to support exceptions and rounding modes along the
> > > lines of the support for them with Power soft-float).
> >
> > Does that mean the patch is OK or do you want me to get rid of the use
> > of $(shell) as Roland suggested? If so, I need some help because I
>
> I mean that the principle of generating separate headers for these cases
> is OK, subject to taking into account both Roland's and Andreas's
> comments.
>
> The generated file should only need to set the default-abi variable, not
> have any targets, be included from sysdeps/unix/sysv/linux/mips/Makefile
> where the ABI conditions are defined, and can be generated by a configure
> script fragment.
OK, Here is a new patch that uses preconfigure to create a Makefile that
is included in sysdeps/unix/sysv/linux/mips/Makefile. I also addressed
Andreas's comment about my check of whether or not default-abi is good
or not. I am still testing it but it looks good so far.
2012-10-23 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/mips/preconfigure: Create default_abi.make.
* sysdeps/unix/sysv/linux/mips/Makefile: Include default_abi.make.
* (abi-variants): Add hard and soft float versions.
* (abi-*-options): update with hard and soft flags.
* (abi-*-condition): Ditto.
diff --git a/ports/sysdeps/mips/preconfigure b/ports/sysdeps/mips/preconfigure
index 9190eee..3b633bd 100644
--- a/ports/sysdeps/mips/preconfigure
+++ b/ports/sysdeps/mips/preconfigure
@@ -1,3 +1,24 @@
+
+cat > conftest.c <<EOF
+#if defined(__mips_soft_float) && (_MIPS_SIM == _ABIO32)
+o32_soft
+#elif defined(__mips_hard_float) && (_MIPS_SIM == _ABIO32)
+o32_hard
+#elif defined(__mips_soft_float) && (_MIPS_SIM == _ABIN32)
+n32_soft
+#elif defined(__mips_hard_float) && (_MIPS_SIM == _ABIN32)
+n32_hard
+#elif defined(__mips_soft_float) && (_MIPS_SIM == _ABI64)
+n64_soft
+#elif defined(__mips_hard_float) && (_MIPS_SIM == _ABI64)
+n64_hard
+#else
+ERROR
+#endif
+EOF
+default_abi=`$CC $CFLAGS $CPPFLAGS -E -P conftest.c`
+echo "default-abi := $default_abi" >> default_abi.make
+
case "$machine" in
mips64*) base_machine=mips64
case "$CC $CFLAGS $CPPFLAGS " in
diff --git a/ports/sysdeps/unix/sysv/linux/mips/Makefile b/ports/sysdeps/unix/sysv/linux/mips/Makefile
index 99c554f..f0beeb3 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)