public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* CONFIG_ALPHA_GENERIC problem with gcc-4.1
@ 2005-07-11 14:09 Dan Kegel
  2005-07-13 15:30 ` Dan Kegel
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Kegel @ 2005-07-11 14:09 UTC (permalink / raw)
  To: Linux Kernel Mailing List

I've been doing builds of linux-2.6.11 as a sanity check
for new versions of gcc, and a problem just popped up
in arch/alpha/Makefile (see http://gcc.gnu.org/ml/gcc/2005-07/msg00397.html)
I think I can work around this myself by using CONFIG_ALPHA_EV6
instead of CONFIG_ALPHA_GENERIC, but here's my analysis
of the problem; maybe the alpha kernel maintainer can take it from here?

Take the following with a grain of salt; I don't know much
about alpha or gcc, I'm just doing a little QA.

arch/alpha/Makefile says:
36   # If GENERIC, make sure to turn off any instruction set extensions that
37   # the host compiler might have on by default.  Given that EV4 and EV5
38   # have the same instruction set, prefer EV5 because an EV5 schedule is
39   # more likely to keep an EV4 processor busy than vice-versa.
40   ifeq ($(CONFIG_ALPHA_GENERIC),y)
41     mcpu := ev5
42     mcpu_done := y
43   endif
...
84 # For TSUNAMI, we must have the assembler not emulate our instructions.
85 # The same is true for IRONGATE, POLARIS, PYXIS.
86 # BWX is most important, but we don't really want any emulation ever.
87 CFLAGS += $(cflags-y) -Wa,-mev6

Thus when you pick CONFIG_ALPHA_GENERIC, gcc is invoked with
the contradictory options -mcpu=ev5 -Wa,-mev6

This probably means that even on ev5, some ev6 instructions are used.
In particular, see include/asm-alpha/compiler.h:

#if defined(__alpha_bwx__)
#define __kernel_ldbu(mem)      (mem)
#define __kernel_ldwu(mem)      (mem)
#define __kernel_stb(val,mem)   ((mem) = (val))
#define __kernel_stw(val,mem)   ((mem) = (val))
#else
#define __kernel_ldbu(mem)                              \
   ({ unsigned char __kir;                               \
      __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem));    \
      __kir; })

That inline assembly is fine on ev5, but only if the assembler
is emulating the ldbu instruction with a macro -- exactly
the kind of thing arch/alpha/Makefile is trying to
inhibit when it says -Wa,-mev6.

This is an issue now because building the kernel with CONFIG_ALPHA_GENERIC
fails on the current gcc-4.1 snapshot with

 > {standard input}:496: Error: macro requires $at register while noat in effect
 > make[1]: *** [arch/alpha/kernel/core_cia.o] Error 1

and it looks like a kernel problem, not a gcc problem:
don't try to use ev6 instructions on ev5 or earlier processors.

That probably means conditionalizing that -Wa,ev6 properly,
but if that's hard, maybe it means dropping support for ev4 and ev5 processors,
and mapping CONFIG_ALPHA_GENERIC to ev6.  I wouldn't know...
- Dan

-- 
Trying to get a job as a c++ developer?  See http://kegel.com/academy/getting-hired.html

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

* Re: CONFIG_ALPHA_GENERIC problem with gcc-4.1
  2005-07-11 14:09 CONFIG_ALPHA_GENERIC problem with gcc-4.1 Dan Kegel
@ 2005-07-13 15:30 ` Dan Kegel
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Kegel @ 2005-07-13 15:30 UTC (permalink / raw)
  To: Dan Kegel; +Cc: Linux Kernel Mailing List

Dan Kegel wrote:
> I've been doing builds of linux-2.6.11 as a sanity check
> for new versions of gcc, and a problem just popped up
> in arch/alpha/Makefile (see 
> http://gcc.gnu.org/ml/gcc/2005-07/msg00397.html)

Never mind.  rth kindly explained to me that
it's a gcc or binutils problem.
The alpha kernel compiles in instructions
for ev6 machines even when building for generic/ev5,
and then uses them at runtime only if it
detects that it's safe.
- Dan

-- 
Trying to get a job as a c++ developer?  See http://kegel.com/academy/getting-hired.html

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

end of thread, other threads:[~2005-07-13 15:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-11 14:09 CONFIG_ALPHA_GENERIC problem with gcc-4.1 Dan Kegel
2005-07-13 15:30 ` Dan Kegel

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