-LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/fixunssfsi.c
-
-# We do not have DF or DI types, so fake out the libgcc2 compilation.
-TARGET_LIBGCC2_CFLAGS = -DDF=SF -DDI=SI
+LIB2FUNCS_EXTRA = $(srcdir)/config/h8300/fixunssfsi.c $(srcdir)/config/h8300/extfloatlib.c
# 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