Where's ".div" implemented?

Doug Evans dje@transmeta.com
Tue Jun 3 15:34:00 GMT 2003

Nick Patavalis writes:
 > On Tue, Jun 03, 2003 at 07:25:03AM -0700, Doug Evans wrote:
 > > .div is in gcc/config/sparc/lb1spc.asm in the gcc sources.
 > > 
 > > I'm guessing no one's tried running linux on an old v7 machine
 > > because the linux configurations don't include lb1spc.asm in libgcc.a.
 > > [not surprising]
 > Actually my target processor is a quite new LEON, which is compliant
 > with sparc-v8, but with the integer multiply / divide instructions
 > disabled (according to the gcc-manual is the only difference between
 > v7 / v8, as far as gcc is concerned). 


 > As I am planning on eventually running linux on it, I would like to
 > have a single toolkit. I also figure that since gcc accepts the
 > "-mcpu=v7" the integet mul/div instructions *should* de included in
 > libgcc.a (i.e. not including them could be considered a "bug" of
 > sorts).
 > Do you know how to make gcc build with these functions included in
 > "libgcc.a". I mean what build-scripts, config-files, etc should be
 > changed to make this happen?

Essentially what you want to do is add

LIB1ASMSRC = sparc/lb1spc.asm
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3

to some "t-*" file in gcc.

In the gcc-3.2 tree (I'm guessing 3.3 is equivalent),
the entry for sparc-linux in gcc/config.gcc is

sparc-*-linux*)		# Sparc's running GNU/Linux, libc6
	tm_file="${tm_file} dbxelf.h elfos.h svr4.h sparc/sysv4.h sparc/linux.h"
	tmake_file="t-slibgcc-elf-ver t-linux sparc/t-crtfm"
	extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"

I'd say create file gcc/config/sparc/t-linux that contains

LIB1ASMSRC = sparc/lb1spc.asm
LIB1ASMFUNCS = _mulsi3 _divsi3 _modsi3

and then modify the above:

-	tmake_file="t-slibgcc-elf-ver t-linux sparc/t-crtfm"
+	tmake_file="t-slibgcc-elf-ver t-linux sparc/t-crtfm sparc/t-linux"

and give it a shot.
Haven't tried it of course, but it feels right.

Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com

More information about the crossgcc mailing list