From: Greg B. <gb...@po...> - 2001-08-08 06:44:49
|
NIIBE Yutaka wrote: > > Yes, I had thought that, and have been using -m4-nofpu with su. But > looking the code deeply this time, it's SH-3 actually, and __sh3__ > definition seems correct. It's quite counter-intuitive, and confusing > though. Well, I've objdump-ed the .o produced by -m4-nofpu, and found > that the architecture is set to "SH3" not "SH4". Ummm... "M. R. Brown" wrote: > > Well, it's clear-cut what it does in gcc, it generates code for a sh3 and > below, but acts as if it had sh4 hardware: > > {"4-nofpu", SH3_BIT|SH2_BIT|SH1_BIT|HARD_SH4_BIT, "" } > > gcc won't generate code for anything higher than a sh3, and since the sh3 > can't generate fpu code, this is (somewhat) of an alias for a sh4 without > fp support. So the __sh3__ predefine is correct, because if you define > __SH4__ you'll pull in fp code into libgcc, and you'll get link errors. > Ok, now I'm more confused than I was yesterday. Firstly, the gcc I have here (rather old) doesn't define __sh3__ when you give it -m4-nofpu. This might be because we have one of Kaz' patches. What it does define is: sh-linux-gnu-gcc --verbose -m3 -o foo-m3.o -c foo.c [...] -D__SH3__ -D__sh3__ -ml -m3 sh-linux-gnu-gcc --verbose -m4 -o foo-m4.o -c foo.c [...] -D__SH4__ -ml -m4 sh-linux-gnu-gcc --verbose -m4-nofpu -o foo-m4-nofpu.o -c foo.c [...] -D__SH4__ -D__SH4_NOFPU__ -ml -m4-nofpu Which looks pretty sensible to me. The architecture in the ELF files is pretty screwed up, but it's *consistently* screwed up so everything still works. The -m4-nofpu option uses the same integer division millicode as -m3, which is correct. Secondly, defining __sh3__ is the *wrong* thing to do for the kernel. One obvious problem is that with __sh3__ defined, lots of stuff in the kernel breaks completely because the SH internal module registers have different addresses for SH3 and SH4. For example: #if defined(__sh3__) #define TMU_TOCR 0xfffffe90 /* Byte access */ #define TMU_TSTR 0xfffffe92 /* Byte access */ #define TMU0_TCOR 0xfffffe94 /* Long access */ #define TMU0_TCNT 0xfffffe98 /* Long access */ #define TMU0_TCR 0xfffffe9c /* Word access */ #define FRQCR 0xffffff80 #elif defined(__SH4__) #define TMU_TOCR 0xffd80000 /* Byte access */ #define TMU_TSTR 0xffd80004 /* Byte access */ #define TMU0_TCOR 0xffd80008 /* Long access */ #define TMU0_TCNT 0xffd8000c /* Long access */ #define TMU0_TCR 0xffd80010 /* Word access */ #define FRQCR 0xffc00000 #endif (I'm using an old kernel too) What the kernel needs is an option that generates SH4 code with __SH4__ defined, but no FPU code used from libgcc.a. With the gcc I'm using here, -m4-nofpu is that option. So I'm very confused. Niibe-san, does your gcc behave differently to mine? Greg. -- If it's a choice between being a paranoid, hyper-suspicious global village idiot, or a gullible, mega-trusting sheep, I don't look good in mint sauce. - jd, slashdot, 11Feb2000. |