]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] ppc: prevent GCC 4 from generating AltiVec instructions in kernel
authorLee Nicks <allinux@gmail.com>
Sat, 29 Oct 2005 00:46:09 +0000 (17:46 -0700)
committerPaul Mackerras <paulus@samba.org>
Sat, 29 Oct 2005 03:55:19 +0000 (13:55 +1000)
Depending on how GCC is built, GCC 4 may generate altivec instructions without
user explicitly requesting vector operations in the code.  Although this is a
performance booster for user applications, it is a problem for kernel.

This patch explicitly instruct GCC to NOT generate altivec instructions while
building the kernel.

Here are some test cases I ran.

(1) build gcc 4.0.1 with '--with-cpu=7450 --enable-altivec
    --enable-cxx-flags=-mcpu=7450', and use this gcc to build kernel WITHOUT
    this kernel patch.  Kernel fail to boot up on a 7450 board because of
    altivec instructions in kernel.

(2) build gcc 4.0.1 with "--with-cpu=7450 --enable-altivec
    --enable-cxx-flags=-mcpu=7450", and use this gcc to build kernel WITH this
    kernel patch.  Kernel boot up on a 7450 board without any problem.

(3) build gcc 4.0.1 with "--with-cpu=750 --enable-cxx-flags=-mcpu=750",
    and use this gcc to build kernel with or without this kernel patch.
    Kernel boot up on a 7450 board without any problem.

This patch should also work with GCC 3 or even earlier GCC 2.95.3.

Signed-off-by: Lee Nicks <allinux@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/ppc/Makefile
arch/ppc64/Makefile

index 121d2347b89fd1a69a82eb298c3ec01c6a9a7679..94d5716fa7c34aa1b668d7e786fe65f486b862f4 100644 (file)
@@ -26,6 +26,10 @@ CPPFLAGS     += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
 AFLAGS         += -Iarch/$(ARCH)
 CFLAGS         += -Iarch/$(ARCH) -msoft-float -pipe \
                -ffixed-r2 -mmultiple
+
+# No AltiVec instruction when building kernel
+CFLAGS         += $(call cc-option, -mno-altivec)
+
 CPP            = $(CC) -E $(CFLAGS)
 # Temporary hack until we have migrated to asm-powerpc
 LINUXINCLUDE    += -Iarch/$(ARCH)/include
index 743f0dbdebf346984a0342a583a6f7446d7ddc7e..db1b25cdb5beef969b7b2ce91a4fa0b89c7fd75f 100644 (file)
@@ -75,6 +75,9 @@ else
        CFLAGS += $(call cc-option,-mtune=power4)
 endif
 
+# No AltiVec instruction when building kernel
+CFLAGS += $(call cc-option, -mno-altivec)
+
 # Enable unit-at-a-time mode when possible. It shrinks the
 # kernel considerably.
 CFLAGS += $(call cc-option,-funit-at-a-time)