mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG] x86: 2.6.27-rc1 does not build with gcc-3.2.3 any more
@ 2008-07-30 11:02 Mikael Pettersson
  2008-07-30 11:10 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Pettersson @ 2008-07-30 11:02 UTC (permalink / raw)
  To: hpa, mingo, tglx; +Cc: linux-kernel

Attempting to build 2.6.27-rc1 on x86 with gcc-3.2.3 fails with:

  gcc -Wp,-MD,init/.main.o.d  -nostdinc -isystem /home/mikpe/pkgs/linux-x86/gnu/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.2.3/include -D__KERNEL__ -Iinclude  -I/tmp/tmp/linux-2.6.27-rc1/arch/x86/include -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -O2 -m32 -msoft-float -mregparm=3 -freg-struct-return -mpreferred-stack-boundary=2 -march=i486 -ffreestanding -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Iinclude/asm-x86/mach-default -fomit-frame-pointer  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(main)"  -D"KBUILD_MODNAME=KBUILD_STR(main)" -c -o init/main.o init/main.c
In file included from include/asm/dma.h:12,
                 from include/linux/bootmem.h:8,
                 from init/main.c:26:
include/asm/io.h: In function `readb':
include/asm/io.h:32: syntax error before string constant
include/asm/io.h: In function `readw':
include/asm/io.h:33: syntax error before string constant
include/asm/io.h: In function `readl':
include/asm/io.h:34: syntax error before string constant
include/asm/io.h: In function `__readb':
include/asm/io.h:36: syntax error before string constant
include/asm/io.h: In function `__readw':
include/asm/io.h:37: syntax error before string constant
include/asm/io.h: In function `__readl':
include/asm/io.h:38: syntax error before string constant
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2

The preprocessor tricks now used to create readb() et al in io.h
results in code like (reformatted for readability):

static inline __attribute__((always_inline))
unsigned char readb(const volatile void *addr)
{
	unsigned char ret;
	asm volatile("mov" "b" " %1,%0"
		     : "=" "q" (ret)
		     : "m" (*(volatile unsigned char *)addr)
		     : "memory");
	return ret;
}

The problem is that "=q" has been broken up into two adjacent
string literals, and apparently gcc-3.2.3 hasn't done string
literal concatenation at the time it processes the asm().
Hence the syntax error. (This is clearly a gcc bug.)

Switching to gcc-3.3.6 or newer fixes the problem.

The question is, should the kernel be fixed to compile with 3.2.3
again (by generating "=q" not "=" "q"), or should the minimum supported
gcc version be bumped to 3.3.6?

I have no strong feeling about this, except that I want to use the
oldest (== least bloated) gcc possible on my 486 test box.

/Mikael

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

* Re: [BUG] x86: 2.6.27-rc1 does not build with gcc-3.2.3 any more
  2008-07-30 11:02 [BUG] x86: 2.6.27-rc1 does not build with gcc-3.2.3 any more Mikael Pettersson
@ 2008-07-30 11:10 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-07-30 11:10 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: hpa, mingo, tglx, linux-kernel


* Mikael Pettersson <mikpe@it.uu.se> wrote:

> static inline __attribute__((always_inline))
> unsigned char readb(const volatile void *addr)
> {
> 	unsigned char ret;
> 	asm volatile("mov" "b" " %1,%0"
> 		     : "=" "q" (ret)
> 		     : "m" (*(volatile unsigned char *)addr)
> 		     : "memory");
> 	return ret;
> }
> 
> The problem is that "=q" has been broken up into two adjacent
> string literals, and apparently gcc-3.2.3 hasn't done string
> literal concatenation at the time it processes the asm().
> Hence the syntax error. (This is clearly a gcc bug.)
> 
> Switching to gcc-3.3.6 or newer fixes the problem.
> 
> The question is, should the kernel be fixed to compile with 3.2.3
> again (by generating "=q" not "=" "q"), or should the minimum supported
> gcc version be bumped to 3.3.6?
> 
> I have no strong feeling about this, except that I want to use the
> oldest (== least bloated) gcc possible on my 486 test box.

yeah, please send a fix. We could move the '=' from build_mmio_read into 
the argument (explicitly).

	Ingo

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

end of thread, other threads:[~2008-07-30 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-30 11:02 [BUG] x86: 2.6.27-rc1 does not build with gcc-3.2.3 any more Mikael Pettersson
2008-07-30 11:10 ` Ingo Molnar

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

all inboxes | Powered by JetHome®