aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLee Nicks <allinux@gmail.com>2005-10-28 20:46:09 -0400
committerPaul Mackerras <paulus@samba.org>2005-10-28 23:55:19 -0400
commit9e3699ea7b8d63eabde7fefa9892e3a258c9c27d (patch)
tree66f9318c92f0f88fdf0dc1b2948faec1d429e8a8 /arch
parentf78541dcec327b0c46b150ee7d727f3db80275c4 (diff)
[PATCH] ppc: prevent GCC 4 from generating AltiVec instructions in kernel
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/ppc/Makefile4
-rw-r--r--arch/ppc64/Makefile3
2 files changed, 7 insertions, 0 deletions
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 121d2347b89f..94d5716fa7c3 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -26,6 +26,10 @@ CPPFLAGS += -Iarch/$(ARCH) -Iarch/$(ARCH)/include
26AFLAGS += -Iarch/$(ARCH) 26AFLAGS += -Iarch/$(ARCH)
27CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \ 27CFLAGS += -Iarch/$(ARCH) -msoft-float -pipe \
28 -ffixed-r2 -mmultiple 28 -ffixed-r2 -mmultiple
29
30# No AltiVec instruction when building kernel
31CFLAGS += $(call cc-option, -mno-altivec)
32
29CPP = $(CC) -E $(CFLAGS) 33CPP = $(CC) -E $(CFLAGS)
30# Temporary hack until we have migrated to asm-powerpc 34# Temporary hack until we have migrated to asm-powerpc
31LINUXINCLUDE += -Iarch/$(ARCH)/include 35LINUXINCLUDE += -Iarch/$(ARCH)/include
diff --git a/arch/ppc64/Makefile b/arch/ppc64/Makefile
index 743f0dbdebf3..db1b25cdb5be 100644
--- a/arch/ppc64/Makefile
+++ b/arch/ppc64/Makefile
@@ -75,6 +75,9 @@ else
75 CFLAGS += $(call cc-option,-mtune=power4) 75 CFLAGS += $(call cc-option,-mtune=power4)
76endif 76endif
77 77
78# No AltiVec instruction when building kernel
79CFLAGS += $(call cc-option, -mno-altivec)
80
78# Enable unit-at-a-time mode when possible. It shrinks the 81# Enable unit-at-a-time mode when possible. It shrinks the
79# kernel considerably. 82# kernel considerably.
80CFLAGS += $(call cc-option,-funit-at-a-time) 83CFLAGS += $(call cc-option,-funit-at-a-time)