[PATCH] Set cpu explicitly in kernel compiles

Paul Mackerras paulus at samba.org
Wed May 4 17:05:51 EST 2005

What do people think of this patch?  The motivation for it is that a
biarch gcc-4.0 will by default tune for POWER4, even for a 32-bit
compile, meaning that we end up with a lot of nops we don't need.
This also takes out -mstring.

With this, the text size reduces by about 120k for my normal config
when compiling with a biarch gcc-4.0.  The text size also reduces
slightly when compiling with the Debian gcc-3.3.5 (32-bit only, not

If there are no objections I'll send this to Andrew and Linus.


diff -urN linux-2.6/arch/ppc/Makefile pmac-2.5/arch/ppc/Makefile
--- linux-2.6/arch/ppc/Makefile	2005-05-02 08:29:36.000000000 +1000
+++ pmac-2.5/arch/ppc/Makefile	2005-05-03 16:45:57.000000000 +1000
@@ -23,15 +23,14 @@
 LDFLAGS_vmlinux	:= -Ttext $(KERNELLOAD) -Bstatic
 CPPFLAGS	+= -Iarch/$(ARCH)
 AFLAGS		+= -Iarch/$(ARCH)
-CFLAGS		+= -Iarch/$(ARCH) -msoft-float -pipe \
-		-ffixed-r2 -mmultiple
+CFLAGS		+= -Iarch/$(ARCH) -msoft-float -pipe -ffixed-r2 -mmultiple
 CPP		= $(CC) -E $(CFLAGS)
 CHECKFLAGS	+= -D__powerpc__
-ifndef CONFIG_E500
-CFLAGS		+= -mstring
+cpu-opt-$(CONFIG_6xx)		+= -mcpu=750 -mtune=7450
+CFLAGS += $(cpu-opt-y)
 cpu-as-$(CONFIG_PPC64BRIDGE)	+= -Wa,-mppc64bridge
 cpu-as-$(CONFIG_4xx)		+= -Wa,-m405

More information about the Linuxppc-dev mailing list