diff -Nu h8300/old/extfloatlib.c h8300/extfloatlib.c
--- h8300/old/extfloatlib.c	1970-01-01 01:00:00.000000000 +0100
+++ h8300/extfloatlib.c	2004-02-03 22:03:14.000000000 +0100
@@ -0,0 +1,74 @@
+/* from /gcc/config/m68k/fpgnulib.c */
+
+/* the following deal with IEEE single-precision numbers */
+#define EXCESS		126
+#define SIGNBIT		0x80000000
+#define HIDDEN		(1 << 23)
+#define SIGN(fp)	((fp) & SIGNBIT)
+#define EXP(fp)		(((fp) >> 23) & 0xFF)
+#define MANT(fp)	(((fp) & 0x7FFFFF) | HIDDEN)
+#define PACK(s,e,m)	((s) | ((e) << 23) | (m))
+
+/* the following deal with IEEE double-precision numbers */
+#define EXCESSD		1022
+#define HIDDEND		(1 << 20)
+#define EXPD(fp)	(((fp.l.upper) >> 20) & 0x7FF)
+#define SIGND(fp)	((fp.l.upper) & SIGNBIT)
+#define MANTD(fp)	(((((fp.l.upper) & 0xFFFFF) | HIDDEND) << 10) | \
+				(fp.l.lower >> 22))
+#define HIDDEND_LL	((long long)1 << 52)
+#define MANTD_LL(fp)	((fp.ll & (HIDDEND_LL-1)) | HIDDEND_LL)
+#define PACKD_LL(s,e,m)	(((long long)((s)+((e)<<20))<<32)|(m))
+
+
+union double_long {
+    double d;
+    struct {
+      long upper;
+      unsigned long lower;
+    } l;
+    long long ll;
+};
+
+union float_long
+  {
+    float f;
+    long l;
+  };
+/* convert float to double */
+double
+__extendsfdf2 (float a1)
+{
+  union float_long fl1;
+  union double_long dl;
+  int exp;
+
+  fl1.f = a1;
+
+  if (!fl1.l)
+    {
+      dl.l.upper = dl.l.lower = 0;
+      return (dl.d);
+    }
+
+  dl.l.upper = SIGN (fl1.l);
+  exp = EXP (fl1.l) - EXCESS + EXCESSD;
+  dl.l.upper |= exp << 20;
+  dl.l.upper |= (MANT (fl1.l) & ~HIDDEN) >> 3;
+  dl.l.lower = MANT (fl1.l) << 29;
+
+  return (dl.d);
+}
+
+
+/* convert float to int */
+long
+__fixdfsi (double a1);
+int
+__fixsfsi (float a1)
+{
+  double foo = a1;
+  return __fixdfsi (foo);
+}
+
+
diff -Nu h8300/old/float-h8300.h h8300/float-h8300.h
--- h8300/old/float-h8300.h	1970-01-01 01:00:00.000000000 +0100
+++ h8300/float-h8300.h	2004-02-03 18:37:48.000000000 +0100
@@ -0,0 +1,128 @@
+/* float.h for target h8300-elf with optional IEEE 32 bit double format: based float-sh.h */
+#ifndef _FLOAT_H_
+#define _FLOAT_H_
+#include "config/h8300/h8300.h"
+
+/* Produced by enquire version 4.3, CWI, Amsterdam */
+
+   /* Radix of exponent representation */
+#undef FLT_RADIX
+#define FLT_RADIX 2
+   /* Number of base-FLT_RADIX digits in the significand of a float */
+#undef FLT_MANT_DIG
+#define FLT_MANT_DIG 24
+   /* Number of decimal digits of precision in a float */
+#undef FLT_DIG
+#define FLT_DIG 6
+   /* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
+#undef FLT_ROUNDS
+#define FLT_ROUNDS 1
+   /* Difference between 1.0 and the minimum float greater than 1.0 */
+#undef FLT_EPSILON
+#define FLT_EPSILON 1.19209290e-07F
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
+#undef FLT_MIN_EXP
+#define FLT_MIN_EXP (-125)
+   /* Minimum normalised float */
+#undef FLT_MIN
+#define FLT_MIN 1.17549435e-38F
+   /* Minimum int x such that 10**x is a normalised float */
+#undef FLT_MIN_10_EXP
+#define FLT_MIN_10_EXP (-37)
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
+#undef FLT_MAX_EXP
+#define FLT_MAX_EXP 128
+   /* Maximum float */
+#undef FLT_MAX
+#define FLT_MAX 3.40282347e+38F
+   /* Maximum int x such that 10**x is a representable float */
+#undef FLT_MAX_10_EXP
+#define FLT_MAX_10_EXP 38
+
+   /* Number of base-FLT_RADIX digits in the significand of a double */
+#undef DBL_MANT_DIG
+#define DBL_MANT_DIG (DOUBLE_TYPE_SIZE == 64?53:24)
+   /* Number of decimal digits of precision in a double */
+#undef DBL_DIG
+#define DBL_DIG (DOUBLE_TYPE_SIZE == 64?15:6)
+   /* Difference between 1.0 and the minimum double greater than 1.0 */
+#undef DBL_EPSILON
+#define DBL_EPSILON (DOUBLE_TYPE_SIZE == 64?2.2204460492503131e-16:1.19209290e-07F)
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
+#undef DBL_MIN_EXP
+#define DBL_MIN_EXP (DOUBLE_TYPE_SIZE == 64?(-1021):(-125))
+   /* Minimum normalised double */
+#undef DBL_MIN
+#define DBL_MIN (DOUBLE_TYPE_SIZE == 64?2.2250738585072014e-308:1.17549435e-38F)
+   /* Minimum int x such that 10**x is a normalised double */
+#undef DBL_MIN_10_EXP
+#define DBL_MIN_10_EXP (DOUBLE_TYPE_SIZE == 64?(-307):(-37))
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
+#undef DBL_MAX_EXP
+#define DBL_MAX_EXP (DOUBLE_TYPE_SIZE == 64?1024:128)
+   /* Maximum double */
+#undef DBL_MAX
+#define DBL_MAX (DOUBLE_TYPE_SIZE == 64?1.7976931348623157e+308:3.40282347e+38F)
+   /* Maximum int x such that 10**x is a representable double */
+#undef DBL_MAX_10_EXP
+#define DBL_MAX_10_EXP (DOUBLE_TYPE_SIZE == 64?308:38)
+
+/* Because -m3e and -m4-single-only have 32-bit doubles, we append L
+   to the doubles below, so that they're not truncated.  */
+
+   /* Number of base-FLT_RADIX digits in the significand of a long double */
+#undef LDBL_MANT_DIG
+#define LDBL_MANT_DIG (DOUBLE_TYPE_SIZE == 64?53:24)
+   /* Number of decimal digits of precision in a long double */
+#undef LDBL_DIG
+#define LDBL_DIG (DOUBLE_TYPE_SIZE == 64?15:6)
+   /* Difference between 1.0 and the minimum long double greater than 1.0 */
+#undef LDBL_EPSILON
+#define LDBL_EPSILON (DOUBLE_TYPE_SIZE == 64?2.2204460492503131e-16L:1.19209290e-07F)
+   /* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
+#undef LDBL_MIN_EXP
+#define LDBL_MIN_EXP (DOUBLE_TYPE_SIZE == 64?(-1021):(-125))
+   /* Minimum normalised long double */
+#undef LDBL_MIN
+#define LDBL_MIN (DOUBLE_TYPE_SIZE == 64?2.2250738585072014e-308L:1.17549435e-38F)
+   /* Minimum int x such that 10**x is a normalised long double */
+#undef LDBL_MIN_10_EXP
+#define LDBL_MIN_10_EXP (DOUBLE_TYPE_SIZE == 64?(-307):(-37))
+   /* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
+#undef LDBL_MAX_EXP
+#define LDBL_MAX_EXP (DOUBLE_TYPE_SIZE == 64?1024:128)
+   /* Maximum long double */
+#undef LDBL_MAX
+#define LDBL_MAX (DOUBLE_TYPE_SIZE == 64?1.7976931348623157e+308L:3.40282347e+38F)
+   /* Maximum int x such that 10**x is a representable long double */
+#undef LDBL_MAX_10_EXP
+#define LDBL_MAX_10_EXP (DOUBLE_TYPE_SIZE == 64?308:38)
+
+#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+   /* The floating-point expression evaluation method.
+        -1  indeterminate
+         0  evaluate all operations and constants just to the range and
+            precision of the type
+         1  evaluate operations and constants of type float and double
+            to the range and precision of the double type, evaluate
+            long double operations and constants to the range and
+            precision of the long double type
+         2  evaluate all operations and constants to the range and
+            precision of the long double type
+   */
+#undef FLT_EVAL_METHOD
+#define FLT_EVAL_METHOD	0
+
+   /* Number of decimal digits to enable rounding to the given number of
+      decimal digits without loss of precision.
+         if FLT_RADIX == 10^n:  #mantissa * log10 (FLT_RADIX)
+         else                :  ceil (1 + #mantissa * log10 (FLT_RADIX))
+      where #mantissa is the number of bits in the mantissa of the widest
+      supported floating-point type.
+   */
+#undef DECIMAL_DIG
+#define DECIMAL_DIG	17
+
+#endif	/* C99 */
+
+#endif /*  _FLOAT_H_ */
\ No newline at end of file
diff -Nu h8300/old/h8300.h h8300/h8300.h
--- h8300/old/h8300.h	2003-12-31 13:56:04.000000000 +0100
+++ h8300/h8300.h	2004-02-03 18:46:18.000000000 +0100
@@ -104,6 +104,8 @@
 #define MASK_H8300H		0x00001000
 #define MASK_ALIGN_300		0x00002000
 #define MASK_EXR		0x00004000
+#define MASK_ECOS		0x00008000
+
 
 /* Macros used in the machine description to test the flags.  */
 
@@ -136,6 +138,10 @@
    alignment.  */
 #define TARGET_ALIGN_300 (target_flags & MASK_ALIGN_300)
 
+
+#define TARGET_MODE (target_flags & 16384)
+
+
 /*
  * Behaviour of RTE instruction depends on H8S model and operation mode.
  * 
@@ -144,6 +150,13 @@
  * */
 #define TARGET_EXR (target_flags & MASK_EXR)
 
+/*
+ * Force a long alignment for all char arrays. This is required for building
+ * open source realtime OS eCos.
+ * */
+#define TARGET_ECOS (target_flags & MASK_ECOS)
+
+
 /* Macro to define tables used to set the flags.
    This is a list in braces of pairs in braces,
    each pair being { "NAME", VALUE }
@@ -170,6 +183,7 @@
   {"align-300",		 MASK_ALIGN_300, N_("Use H8/300 alignment rules")}, \
   {"exr",		 MASK_EXR, N_("Push exr on stack")},                \
   {"no-exr",	        -MASK_EXR, N_("Do not push exr on stack")},	    \
+  {"ecos",		 MASK_ECOS, N_("Use eCos alignment rules")},	    \
   { "",			 TARGET_DEFAULT, NULL}}
 
 #ifdef IN_LIBGCC2
@@ -251,7 +265,7 @@
 #define LONG_TYPE_SIZE		32
 #define LONG_LONG_TYPE_SIZE	64
 #define FLOAT_TYPE_SIZE	32
-#define DOUBLE_TYPE_SIZE	32
+#define DOUBLE_TYPE_SIZE	(TARGET_INT32 ? 64 : 32)
 #define LONG_DOUBLE_TYPE_SIZE	DOUBLE_TYPE_SIZE
 
 #define MAX_FIXED_MODE_SIZE	32
@@ -284,6 +298,15 @@
 /* On the H8/300, longs can be aligned on halfword boundaries, but not
    byte boundaries.  */
 #define STRICT_ALIGNMENT 1
+
+/* If we compile for eCos then arrays should be long-aligned */
+#define ECOS_ARRAY_ALIGNMENT 32
+
+/* Make any array at least long aligned if we compile for eCos */
+#define DATA_ALIGNMENT(TYPE, ALIGN)                                  \
+(TARGET_ECOS && TREE_CODE (TYPE) == ARRAY_TYPE                       \
+&& (ALIGN) < ECOS_ARRAY_ALIGNMENT ? ECOS_ARRAY_ALIGNMENT : (ALIGN))
+
 
 /* Standard register usage.  */
 
@@ -1330,4 +1353,20 @@
 
 #define MOVE_RATIO 3
 
+#ifdef IN_LIBGCC2
+#undef LONG_LONG_TYPE_SIZE
+#undef DOUBLE_TYPE_SIZE
+#undef LONG_DOUBLE_TYPE_SIZE
+#if __INT_MAX__ == 32767
+#define DI SI
+#define DF SF
+#define LONG_LONG_TYPE_SIZE 32
+#define DOUBLE_TYPE_SIZE 32
+#else
+#define LONG_LONG_TYPE_SIZE 64
+#define DOUBLE_TYPE_SIZE 64
+#endif
+#define LONG_DOUBLE_TYPE_SIZE	DOUBLE_TYPE_SIZE
+#endif
+
 #endif /* ! GCC_H8300_H */
Common subdirectories: h8300/old/old and h8300/old
diff -Nu h8300/old/t-h8300 h8300/t-h8300
--- h8300/old/t-h8300	2003-12-29 12:26:38.000000000 +0100
+++ h8300/t-h8300	2004-02-03 20:38:04.000000000 +0100
@@ -3,31 +3,48 @@
 # from libgcc2.c.  They do not actually exist in lib1funcs.asm.
 LIB1ASMSRC = h8300/lib1funcs.asm
 LIB1ASMFUNCS = _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3 \
-  _fixunssfsi_asm
+  _floatdisf _fixsfdi _fixunssfdi _fixunssfsi_asm
 
 LIB2FUNCS_EXTRA = \
 	$(srcdir)/config/h8300/clzhi2.c \
 	$(srcdir)/config/h8300/ctzhi2.c \
 	$(srcdir)/config/h8300/parityhi2.c \
 	$(srcdir)/config/h8300/popcounthi2.c \
-	$(srcdir)/config/h8300/fixunssfsi.c
+	$(srcdir)/config/h8300/fixunssfsi.c \
+	$(srcdir)/config/h8300/extfloatlib.c
 
-# We do not have DF type, so fake out the libgcc2 compilation.
-TARGET_LIBGCC2_CFLAGS = -DDF=SF
 
 # 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
+
+dp-bit.c: $(srcdir)/config/fp-bit.c
+	echo '#define SMALL_MACHINE' >> dp-bit.c
+	echo '#ifdef __H8300__' >> dp-bit.c
+	echo '#define CMPtype HItype' >> dp-bit.c
+	echo '#else' >> dp-bit.c
+	echo '#define CMPtype SItype' >> dp-bit.c
+	echo '#endif' >> dp-bit.c
+	echo '#if __INT_MAX__ == 32767' >> dp-bit.c
+	echo '#define NO_DI_MODE' >> 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 '#if __INT_MAX__ != 32767' >> fp-bit.c
 	echo '#define FLOAT_ONLY' >> fp-bit.c
+	echo '#endif' >> fp-bit.c
 	echo '#define SMALL_MACHINE' >> fp-bit.c
 	echo '#ifdef __H8300__' >> fp-bit.c
 	echo '#define CMPtype HItype' >> fp-bit.c
 	echo '#else' >> fp-bit.c
 	echo '#define CMPtype SItype' >> fp-bit.c
 	echo '#endif' >> fp-bit.c
+	echo '#if __INT_MAX__ == 32767' >> fp-bit.c
+	echo '#define NO_DI_MODE' >> fp-bit.c
+	echo '#endif' >> fp-bit.c
 	cat $(srcdir)/config/fp-bit.c >> fp-bit.c
 
 MULTILIB_OPTIONS = mh/ms mn mint32
