[Top] [All Lists]

Re: mips64 cpu-probe.c compile failure

To: Atsushi Nemoto <>
Subject: Re: mips64 cpu-probe.c compile failure
From: "Maciej W. Rozycki" <>
Date: Fri, 19 Sep 2003 13:55:45 +0200 (MET DST)
In-reply-to: <>
Organization: Technical University of Gdansk
Original-recipient: rfc822;
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 W. Rozycki, Technical University of Gdansk, Poland   +
+        e-mail:, PGP key available        +

diff -up --recursive --new-file 
--- 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, 
                ".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;

<Prev in Thread] Current Thread [Next in Thread>