Linux MIPS Architecture development
 help / color / mirror / Atom feed
* MIPS toolchain
@ 2008-07-16  7:32 Dmitri Vorobiev
  2008-07-16 10:45 ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitri Vorobiev @ 2008-07-16  7:32 UTC (permalink / raw)
  To: linux-mips

Hi,

The linux-mips.org Web site recommends gcc 3.4.4 to build the MIPS kernel. However:

<<<<<<<<<<<<<<<<<<

[dmitri.vorobiev@amber linux-2.6]$ mips-unknown-linux-gnu-gcc -v
Reading specs from /home/dmitri.vorobiev/Projects/misc/zoo/lib/gcc/mips-unknown-linux-gnu/3.4.4/specs
Configured with: ../src/gcc-3.4.4/configure --prefix=/home/dmitri.vorobiev/Projects/misc/zoo --target=mips-unknown-linux-gnu --disable-nls --without-headers --with-gnu-ld --with-gnu-as --disable-shared --disable-threads
Thread model: single
gcc version 3.4.4
[dmitri.vorobiev@amber linux-2.6]$ make ARCH=mips CROSS_COMPILE=mips-unknown-linux-gnu-
  CHK     include/linux/version.h
  CHK     include/linux/utsrelease.h
  CALL    scripts/checksyscalls.sh
  CC      init/main.o
include/asm/bitops.h: In function `start_kernel':
include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
include/asm/bitops.h:76: error: impossible constraint in `asm'
include/asm/bitops.h:76: error: impossible constraint in `asm'
include/asm/bitops.h:76: error: impossible constraint in `asm'
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
[dmitri.vorobiev@amber linux-2.6]$

<<<<<<<<<<<<<<<<<<

Kernel build goes smoothly for me with this gcc version:

<<<<<<<<<<<<<<<<<<

[dmitri.vorobiev@amber linux-2.6]$ mips-unknown-linux-gnu-gcc -v
Using built-in specs.
Target: mips-unknown-linux-gnu
Configured with: ../gcc-4.3.0/configure --target=mips-unknown-linux-gnu --disable-nls --disable-threads --disable-shared --disable-multilib --disable-libmudflap --disable-libssp --prefix=/home/dmitri.vorobiev/Projects/misc/zoo/4.3-toolchain --with-gmp=/home/dmitri.vorobiev/Projects/misc/zoo/ --with-mfpr=/home/dmitri.vorobiev/Projects/misc/zoo --without-headers --with-gnu-as=/tmp/cross/ --with-gnu-ld=/tmp/cross/ --disable-libgcc --enable-languages=c --disable-libgomp
Thread model: single
gcc version 4.3.0 (GCC)
[dmitri.vorobiev@amber linux-2.6]$

<<<<<<<<<<<<<<<<<<

What I would like to know is which gcc/binutils versions are currently the blessed ones. Thanks.

Regards,
Dmitri

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS toolchain
  2008-07-16  7:32 MIPS toolchain Dmitri Vorobiev
@ 2008-07-16 10:45 ` Ralf Baechle
  2008-07-16 11:02   ` Dmitri Vorobiev
  0 siblings, 1 reply; 6+ messages in thread
From: Ralf Baechle @ 2008-07-16 10:45 UTC (permalink / raw)
  To: Dmitri Vorobiev; +Cc: linux-mips

On Wed, Jul 16, 2008 at 10:32:28AM +0300, Dmitri Vorobiev wrote:

> The linux-mips.org Web site recommends gcc 3.4.4 to build the MIPS kernel. However:
> 
> <<<<<<<<<<<<<<<<<<
> 
> [dmitri.vorobiev@amber linux-2.6]$ mips-unknown-linux-gnu-gcc -v
> Reading specs from /home/dmitri.vorobiev/Projects/misc/zoo/lib/gcc/mips-unknown-linux-gnu/3.4.4/specs
> Configured with: ../src/gcc-3.4.4/configure --prefix=/home/dmitri.vorobiev/Projects/misc/zoo --target=mips-unknown-linux-gnu --disable-nls --without-headers --with-gnu-ld --with-gnu-as --disable-shared --disable-threads
> Thread model: single
> gcc version 3.4.4
> [dmitri.vorobiev@amber linux-2.6]$ make ARCH=mips CROSS_COMPILE=mips-unknown-linux-gnu-
>   CHK     include/linux/version.h
>   CHK     include/linux/utsrelease.h
>   CALL    scripts/checksyscalls.sh
>   CC      init/main.o
> include/asm/bitops.h: In function `start_kernel':
> include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
> include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
> include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
> include/asm/bitops.h:76: error: impossible constraint in `asm'
> include/asm/bitops.h:76: error: impossible constraint in `asm'
> include/asm/bitops.h:76: error: impossible constraint in `asm'
> make[1]: *** [init/main.o] Error 1
> make: *** [init] Error 2
> [dmitri.vorobiev@amber linux-2.6]$
> 
> <<<<<<<<<<<<<<<<<<
> 
> Kernel build goes smoothly for me with this gcc version:
> 
> <<<<<<<<<<<<<<<<<<
> 
> [dmitri.vorobiev@amber linux-2.6]$ mips-unknown-linux-gnu-gcc -v
> Using built-in specs.
> Target: mips-unknown-linux-gnu
> Configured with: ../gcc-4.3.0/configure --target=mips-unknown-linux-gnu --disable-nls --disable-threads --disable-shared --disable-multilib --disable-libmudflap --disable-libssp --prefix=/home/dmitri.vorobiev/Projects/misc/zoo/4.3-toolchain --with-gmp=/home/dmitri.vorobiev/Projects/misc/zoo/ --with-mfpr=/home/dmitri.vorobiev/Projects/misc/zoo --without-headers --with-gnu-as=/tmp/cross/ --with-gnu-ld=/tmp/cross/ --disable-libgcc --enable-languages=c --disable-libgomp
> Thread model: single
> gcc version 4.3.0 (GCC)
> [dmitri.vorobiev@amber linux-2.6]$
> 
> <<<<<<<<<<<<<<<<<<
> 
> What I would like to know is which gcc/binutils versions are currently the blessed ones. Thanks.

Anything from gcc 3.2 to 4.3 is supposed to work for 32-bit kernels; 3.3
to 4.3 are the blessed ones for 64-bit kernels.

I'll look into that build problem ...   hmm...  First thing I'm hitting
with 3.4.6 and binutils 2.18 is:

[ralf@denk linux-mips]$ make malta_defconfig
[ralf@denk linux-mips]$ nice -19 make
cc1: error: unrecognized command line option "-fno-stack-protector"
scripts/kconfig/conf -s arch/mips/Kconfig
cc1: error: unrecognized command line option "-fno-stack-protector"

With the offending line in the main Makefile commented out I get the same
error messages as you.  Initial fix below.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
index 9a7274b..49df8c4 100644
--- a/include/asm-mips/bitops.h
+++ b/include/asm-mips/bitops.h
@@ -82,7 +82,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
 		"2:	b	1b					\n"
 		"	.previous					\n"
 		: "=&r" (temp), "=m" (*m)
-		: "i" (bit), "m" (*m), "r" (~0));
+		: "ir" (bit), "m" (*m), "r" (~0));
 #endif /* CONFIG_CPU_MIPSR2 */
 	} else if (cpu_has_llsc) {
 		__asm__ __volatile__(
@@ -147,7 +147,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
 		"2:	b	1b					\n"
 		"	.previous					\n"
 		: "=&r" (temp), "=m" (*m)
-		: "i" (bit), "m" (*m));
+		: "ir" (bit), "m" (*m));
 #endif /* CONFIG_CPU_MIPSR2 */
 	} else if (cpu_has_llsc) {
 		__asm__ __volatile__(
@@ -428,7 +428,7 @@ static inline int test_and_clear_bit(unsigned long nr,
 		"2:	b	1b					\n"
 		"	.previous					\n"
 		: "=&r" (temp), "=m" (*m), "=&r" (res)
-		: "i" (bit), "m" (*m)
+		: "ir" (bit), "m" (*m)
 		: "memory");
 #endif
 	} else if (cpu_has_llsc) {

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: MIPS toolchain
  2008-07-16 10:45 ` Ralf Baechle
@ 2008-07-16 11:02   ` Dmitri Vorobiev
  2008-07-16 12:02     ` Ralf Baechle
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitri Vorobiev @ 2008-07-16 11:02 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: linux-mips

Ralf Baechle wrote:
> On Wed, Jul 16, 2008 at 10:32:28AM +0300, Dmitri Vorobiev wrote:
> 
>> The linux-mips.org Web site recommends gcc 3.4.4 to build the MIPS kernel. However:
>>
>> <<<<<<<<<<<<<<<<<<
>>
>> [dmitri.vorobiev@amber linux-2.6]$ mips-unknown-linux-gnu-gcc -v
>> Reading specs from /home/dmitri.vorobiev/Projects/misc/zoo/lib/gcc/mips-unknown-linux-gnu/3.4.4/specs
>> Configured with: ../src/gcc-3.4.4/configure --prefix=/home/dmitri.vorobiev/Projects/misc/zoo --target=mips-unknown-linux-gnu --disable-nls --without-headers --with-gnu-ld --with-gnu-as --disable-shared --disable-threads
>> Thread model: single
>> gcc version 3.4.4
>> [dmitri.vorobiev@amber linux-2.6]$ make ARCH=mips CROSS_COMPILE=mips-unknown-linux-gnu-
>>   CHK     include/linux/version.h
>>   CHK     include/linux/utsrelease.h
>>   CALL    scripts/checksyscalls.sh
>>   CC      init/main.o
>> include/asm/bitops.h: In function `start_kernel':
>> include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
>> include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
>> include/asm/bitops.h:76: warning: asm operand 2 probably doesn't match constraints
>> include/asm/bitops.h:76: error: impossible constraint in `asm'
>> include/asm/bitops.h:76: error: impossible constraint in `asm'
>> include/asm/bitops.h:76: error: impossible constraint in `asm'
>> make[1]: *** [init/main.o] Error 1
>> make: *** [init] Error 2
>> [dmitri.vorobiev@amber linux-2.6]$
>>
>> <<<<<<<<<<<<<<<<<<
>>
>> Kernel build goes smoothly for me with this gcc version:
>>
>> <<<<<<<<<<<<<<<<<<
>>
>> [dmitri.vorobiev@amber linux-2.6]$ mips-unknown-linux-gnu-gcc -v
>> Using built-in specs.
>> Target: mips-unknown-linux-gnu
>> Configured with: ../gcc-4.3.0/configure --target=mips-unknown-linux-gnu --disable-nls --disable-threads --disable-shared --disable-multilib --disable-libmudflap --disable-libssp --prefix=/home/dmitri.vorobiev/Projects/misc/zoo/4.3-toolchain --with-gmp=/home/dmitri.vorobiev/Projects/misc/zoo/ --with-mfpr=/home/dmitri.vorobiev/Projects/misc/zoo --without-headers --with-gnu-as=/tmp/cross/ --with-gnu-ld=/tmp/cross/ --disable-libgcc --enable-languages=c --disable-libgomp
>> Thread model: single
>> gcc version 4.3.0 (GCC)
>> [dmitri.vorobiev@amber linux-2.6]$
>>
>> <<<<<<<<<<<<<<<<<<
>>
>> What I would like to know is which gcc/binutils versions are currently the blessed ones. Thanks.
> 
> Anything from gcc 3.2 to 4.3 is supposed to work for 32-bit kernels; 3.3
> to 4.3 are the blessed ones for 64-bit kernels.
> 
> I'll look into that build problem ...   hmm...  First thing I'm hitting
> with 3.4.6 and binutils 2.18 is:
> 
> [ralf@denk linux-mips]$ make malta_defconfig
> [ralf@denk linux-mips]$ nice -19 make
> cc1: error: unrecognized command line option "-fno-stack-protector"
> scripts/kconfig/conf -s arch/mips/Kconfig
> cc1: error: unrecognized command line option "-fno-stack-protector"
> 
> With the offending line in the main Makefile commented out I get the same
> error messages as you.  Initial fix below.

With this fix applied on top of the current Linus git tree I was able to build and boot the kernel using my 4Kc. Thanks a lot!

Regards,
Dmitri

> 
>   Ralf
> 
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> 
> diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h
> index 9a7274b..49df8c4 100644
> --- a/include/asm-mips/bitops.h
> +++ b/include/asm-mips/bitops.h
> @@ -82,7 +82,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
>  		"2:	b	1b					\n"
>  		"	.previous					\n"
>  		: "=&r" (temp), "=m" (*m)
> -		: "i" (bit), "m" (*m), "r" (~0));
> +		: "ir" (bit), "m" (*m), "r" (~0));
>  #endif /* CONFIG_CPU_MIPSR2 */
>  	} else if (cpu_has_llsc) {
>  		__asm__ __volatile__(
> @@ -147,7 +147,7 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
>  		"2:	b	1b					\n"
>  		"	.previous					\n"
>  		: "=&r" (temp), "=m" (*m)
> -		: "i" (bit), "m" (*m));
> +		: "ir" (bit), "m" (*m));
>  #endif /* CONFIG_CPU_MIPSR2 */
>  	} else if (cpu_has_llsc) {
>  		__asm__ __volatile__(
> @@ -428,7 +428,7 @@ static inline int test_and_clear_bit(unsigned long nr,
>  		"2:	b	1b					\n"
>  		"	.previous					\n"
>  		: "=&r" (temp), "=m" (*m), "=&r" (res)
> -		: "i" (bit), "m" (*m)
> +		: "ir" (bit), "m" (*m)
>  		: "memory");
>  #endif
>  	} else if (cpu_has_llsc) {

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS toolchain
  2008-07-16 11:02   ` Dmitri Vorobiev
@ 2008-07-16 12:02     ` Ralf Baechle
  2008-07-16 15:19       ` Geert Uytterhoeven
  2008-07-16 19:22       ` Kyle McMartin
  0 siblings, 2 replies; 6+ messages in thread
From: Ralf Baechle @ 2008-07-16 12:02 UTC (permalink / raw)
  To: Linus Torvalds, linux-stable, Dmitri Vorobiev, Sam Ravnborg,
	Andrew Morton
  Cc: linux-mips, linux-kernel, Andi Kleen

Crosscompiling on a Fedora 9 machine running gcc 4.3.0 as its host compiler
and gcc 3.4.6 for the mips-linux target results in the following build
error:

$ make malta_defconfig
$ make
cc1: error: unrecognized command line option "-fno-stack-protector"
scripts/kconfig/conf -s arch/mips/Kconfig
cc1: error: unrecognized command line option "-fno-stack-protector"

The arch Makefile is included too late so the host compiler is feature
tested, not the crosscompiler as intended and thus the Makefile applies
adds -fno-stack-protector to crosscompiler's flags which fails for gcc
3.4.6.  The bug was introduced by e06b8b98da071f7dd78fb7822991694288047df0
in 2.6.25; 35bb5b1e0e84cfa1a8906f7e6a77f391ff315791 did add more flags
testing before the arch Makefile inclusion.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

diff --git a/Makefile b/Makefile
index bfde079..312fcaa 100644
--- a/Makefile
+++ b/Makefile
@@ -509,6 +509,8 @@ else
 KBUILD_CFLAGS	+= -O2
 endif
 
+include $(srctree)/arch/$(SRCARCH)/Makefile
+
 ifneq (CONFIG_FRAME_WARN,0)
 KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
 endif
@@ -517,8 +519,6 @@ endif
 # Arch Makefiles may override this setting
 KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
 
-include $(srctree)/arch/$(SRCARCH)/Makefile
-
 ifdef CONFIG_FRAME_POINTER
 KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
 else

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: MIPS toolchain
  2008-07-16 12:02     ` Ralf Baechle
@ 2008-07-16 15:19       ` Geert Uytterhoeven
  2008-07-16 19:22       ` Kyle McMartin
  1 sibling, 0 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2008-07-16 15:19 UTC (permalink / raw)
  To: Ralf Baechle, Michael Schmitz
  Cc: Linus Torvalds, linux-stable, Dmitri Vorobiev, Sam Ravnborg,
	Andrew Morton, Linux/MIPS Development, Linux Kernel Development,
	Andi Kleen, Linux/m68k

On Wed, 16 Jul 2008, Ralf Baechle wrote:
> Crosscompiling on a Fedora 9 machine running gcc 4.3.0 as its host compiler
> and gcc 3.4.6 for the mips-linux target results in the following build
> error:
> 
> $ make malta_defconfig
> $ make
> cc1: error: unrecognized command line option "-fno-stack-protector"
> scripts/kconfig/conf -s arch/mips/Kconfig
> cc1: error: unrecognized command line option "-fno-stack-protector"
> 
> The arch Makefile is included too late so the host compiler is feature
> tested, not the crosscompiler as intended and thus the Makefile applies
> adds -fno-stack-protector to crosscompiler's flags which fails for gcc
> 3.4.6.  The bug was introduced by e06b8b98da071f7dd78fb7822991694288047df0
> in 2.6.25; 35bb5b1e0e84cfa1a8906f7e6a77f391ff315791 did add more flags
> testing before the arch Makefile inclusion.
> 
> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
> 
> diff --git a/Makefile b/Makefile
> index bfde079..312fcaa 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -509,6 +509,8 @@ else
>  KBUILD_CFLAGS	+= -O2
>  endif
>  
> +include $(srctree)/arch/$(SRCARCH)/Makefile
> +
>  ifneq (CONFIG_FRAME_WARN,0)
>  KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
>  endif
> @@ -517,8 +519,6 @@ endif
>  # Arch Makefiles may override this setting
>  KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
>  
> -include $(srctree)/arch/$(SRCARCH)/Makefile
> -
>  ifdef CONFIG_FRAME_POINTER
>  KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
>  else

Thank you!

Michael Schmitz also saw this problem, but we never found what caused
it...

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS toolchain
  2008-07-16 12:02     ` Ralf Baechle
  2008-07-16 15:19       ` Geert Uytterhoeven
@ 2008-07-16 19:22       ` Kyle McMartin
  1 sibling, 0 replies; 6+ messages in thread
From: Kyle McMartin @ 2008-07-16 19:22 UTC (permalink / raw)
  To: Ralf Baechle
  Cc: Linus Torvalds, linux-stable, Dmitri Vorobiev, Sam Ravnborg,
	Andrew Morton, linux-mips, linux-kernel, Andi Kleen

On Wed, Jul 16, 2008 at 01:02:24PM +0100, Ralf Baechle wrote:
> +include $(srctree)/arch/$(SRCARCH)/Makefile
> +
>  ifneq (CONFIG_FRAME_WARN,0)
>  KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
>  endif
> @@ -517,8 +519,6 @@ endif
>  # Arch Makefiles may override this setting
>  KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
>  
> -include $(srctree)/arch/$(SRCARCH)/Makefile
> -
>  ifdef CONFIG_FRAME_POINTER
>  KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls

Cool, this explains something I saw with a crossbuild as well, but never
had time to debug.

r, Kyle

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-07-16 19:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-16  7:32 MIPS toolchain Dmitri Vorobiev
2008-07-16 10:45 ` Ralf Baechle
2008-07-16 11:02   ` Dmitri Vorobiev
2008-07-16 12:02     ` Ralf Baechle
2008-07-16 15:19       ` Geert Uytterhoeven
2008-07-16 19:22       ` Kyle McMartin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox