On Thu, 18 Sep 2003, Atsushi Nemoto wrote: > macro> I wanted to avoid that as the resulting code would be ugly. I > macro> guess there is no other choice, although I think that's a bug > macro> in gcc. > > I have no idea that is a gcc bug, but I think align_mod() inline > function is not so beautiful because it can not be compiled anyway if > non-constant value was passed. Well, the asm statement requires immediates, so if macros are used variables won't work anyway, but the the code will look more obscurely. > macro> Can you quote the exact command line used for building the > macro> file? > > mips64el-linux-gcc -D__KERNEL__ -I/home/anemo/work/linux/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -I /home/anemo/work/linux/include/asm/gcc -mabi=64 -G 0 -mno-abicalls -fno-pic -Wa,--trap -pipe -march=r4600 -nostdinc -iwithprefix include -DKBUILD_BASENAME=cpu_probe -c -o cpu-probe.o cpu-probe.c > > I also tried with -finline-limit=100000 but no luck. It looks like gcc insists on forcing the constants into registers. The following patch should work for gcc 3.x. A few warnings will still be emitted, but the code will get build properly. I'm applying the change to the CVS as it's good anyway. Maciej -- + Maciej W. Rozycki, Technical University of Gdansk, Poland + +--------------------------------------------------------------+ + e-mail: macro@ds2.pg.gda.pl, PGP key available + patch-mips-2.4.22-20030916-mips-bugs-gcc3-0 diff -up --recursive --new-file linux-mips-2.4.22-20030916.macro/arch/mips64/kernel/cpu-probe.c linux-mips-2.4.22-20030916/arch/mips64/kernel/cpu-probe.c --- linux-mips-2.4.22-20030916.macro/arch/mips64/kernel/cpu-probe.c 2003-09-12 01:18:01.000000000 +0000 +++ linux-mips-2.4.22-20030916/arch/mips64/kernel/cpu-probe.c 2003-09-18 22:14:19.000000000 +0000 @@ -113,7 +113,7 @@ static inline void check_wait(void) } } -static inline void align_mod(int align, int mod) +static inline void align_mod(const int align, const int mod) { asm volatile( ".set push\n\t" @@ -124,11 +124,11 @@ static inline void align_mod(int align, ".endr\n\t" ".set pop" : - : "i" (align), "i" (mod)); + : "n" (align), "n" (mod)); } static inline void mult_sh_align_mod(long *v1, long *v2, long *w, - int align, int mod) + const int align, const int mod) { unsigned long flags; int m1, m2;