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

Re: Floating Point emulation


Leandro Fanzone wrote:
I have an application built with eCos that doesn't run in a 386 without i387. A simple program that performs something as silly as "unsigned n = 500 * 1.5" hangs. I added the appropriate flags to prevent gcc to compile with 387 support (-msoft-float, etc.) and now I realize that I lack the emulation libraries.

You need to rebuild GCC to support soft-float. A patch similar to the one attached does the trick.

Perhaps the guys at eCosCentric could prepare i386 toolchains with soft-float support in future?

David Vrabel
--
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/
--- gcc-3.3.1/gcc/config/i386/i386elf.h.orig	2002-06-16 22:13:09.000000000 +0100
+++ gcc-3.3.1/gcc/config/i386/i386elf.h	2003-09-04 12:46:00.000000000 +0100
@@ -41,7 +41,7 @@
    || (VECTOR_MODE_P (TYPE_MODE (TYPE)) && int_size_in_bytes (TYPE) == 8))
 
 #undef CPP_SPEC
-#define CPP_SPEC ""
+#define CPP_SPEC "%{msoft-float:-D_SOFT_FLOAT}"
 
 #define ENDFILE_SPEC "crtend.o%s"
 
--- gcc-3.3.1/gcc/config/i386/t-i386elf.orig	2003-09-03 13:21:51.000000000 +0100
+++ gcc-3.3.1/gcc/config/i386/t-i386elf	2003-09-04 12:44:39.000000000 +0100
@@ -2,3 +2,37 @@
 # end labels to the .ctors and .dtors section when we link using gcc.
 
 EXTRA_PARTS=crtbegin.o crtend.o
+
+# We want fine grained libraries, so use the new code to build the
+# floating point emulation libraries.
+FPBIT = fp-bit.c
+DPBIT = dp-bit.c
+
+LIB2FUNCS_EXTRA = xp-bit.c
+
+dp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c
+	echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c
+	echo '#endif'           >> dp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> dp-bit.c
+
+fp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define FLOAT' > fp-bit.c
+	echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c
+	echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c
+	echo '#endif'           >> fp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> fp-bit.c
+
+xp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define EXTENDED_FLOAT_STUBS' > xp-bit.c
+	cat $(srcdir)/config/fp-bit.c >> xp-bit.c
+
+MULTILIB_OPTIONS = mcpu=i386 msoft-float mno-fp-ret-in-387
+MULTILIB_DIRNAMES= m386 soft-float nofp
+MULTILIB_MATCHES = msoft-float=mno-m80387
+MULTILIB_EXCEPTIONS = mno-fp-ret-in-387 mcpu=i386/mno-fp-ret-in-387
+
+EXTRA_MULTILIB_PARTS = crtbegin.o crtend.o
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

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