Re: Memory Rusting Effect [re: Linux hostile to poverty]

Mikael Pettersson (mikpe@csd.uu.se)
Wed, 22 Jul 1998 02:40:25 +0200 (MET DST)


On Wed, 22 Jul 1998, Chris Wedgwood wrote:
> > Compile drivers/scsi/scsi_debug.c after defining "SCSI_DATARATE" and
> > "SCSI_SETUP_LATENCY".
> >
> > This generates floating-point code in kernel, on intel something like:
> >
> > fldl .LC25
> > fmulp %st,%st(1)
> > fldl .LC26
> > fdivr %st,%st(1)
>
> Hmm... its probably not the only place.
>
> It might be a good idea if somebody has the time to hack the makefile so all
> .c targets are moved through .s targets where its possible to grep for
> nasties like the above.

A simpler approach is to use gcc's "-msoft-float" flag. This causes
all (almost, see the gcc info pages) floating-point operations to be
emitted as calls to external library routines. Since neither gcc
nor the linux kernel supply these by default, code using f.p. will
trigger linker errors. I've tried this on the i386 and it catches
f.p. use both in the resident part of the kernel and in modules.

This patch won't catch explicit f.p. insns in assembly code, but it
should catch all cases of "accidental" f.p. use.

If gcc's "-msoft-float" feature is spelled the same on all targets
then this should probably be moved to the main Makefile.

/Mikael

--- linux-2.1.110/arch/i386/Makefile.orig Wed Jul 22 01:29:08 1998
+++ linux-2.1.110/arch/i386/Makefile Wed Jul 22 01:30:04 1998
@@ -23,6 +23,8 @@
CFLAGS_NSR := -fno-strength-reduce
CFLAGS := $(CFLAGS) $(CFLAGS_PIPE) $(CFLAGS_NSR)

+CFLAGS := $(CFLAGS) -msoft-float
+
ifdef CONFIG_M386
CFLAGS := $(CFLAGS) -m386 -DCPU=386
endif

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html