From: Andi Kleen <ak@muc.de>

gcc 3.4 current has switched to default -fno-unit-at-a-time mode for -O2. 
The 3.3-Hammer branch compiler used in some distributions also does this.

Unfortunately the kernel doesn't compile with unit-at-a-time currently,
it cannot tolerate the reordering of functions in relation to inline
assembly.

This patch just turns it off when gcc supports the option.

I only did it for i386 for now. The problem is actually not i386 specific
(other architectures break too), so it may make sense to move the check_gcc 



 arch/i386/Makefile |    4 ++++
 1 files changed, 4 insertions(+)

diff -puN arch/i386/Makefile~no-unit-at-a-time arch/i386/Makefile
--- 25/arch/i386/Makefile~no-unit-at-a-time	2003-09-04 18:02:28.000000000 -0700
+++ 25-akpm/arch/i386/Makefile	2003-09-04 18:02:28.000000000 -0700
@@ -26,6 +26,10 @@ check_gcc = $(shell if $(CC) $(1) -S -o 
 # prevent gcc from keeping the stack 16 byte aligned
 CFLAGS += $(call check_gcc,-mpreferred-stack-boundary=2,)
 
+# gcc 3.4/3.3-hammer support -funit-at-a-time mode, but the Kernel is not ready
+# for it yet
+CFLAGS += $(call check_gcc,-fno-unit-at-a-time,)
+
 align := $(subst -functions=0,,$(call check_gcc,-falign-functions=0,-malign-functions=0))
 
 cflags-$(CONFIG_M386)		+= -march=i386

_