[PATCH] Set cpu explicitly in kernel compiles
Olaf Hering
olh at suse.de
Mon Apr 3 05:40:45 EST 2006
On Wed, 2005-05-04, Paul Mackeras wrote:
> 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
> biarch).
Compile the 32bit kernel with -mcpu=powerpc. This reduces the imagesize
when a compiler is used that defaults to -mtune=power4. It inserts lots
of nops to please the 64bit cpu instruction scheduling. But all these nops
are not needed for 32bit kernels.
Example with SLES10 gcc 4.1.0 and arch/powerpc/configs/pmac32_defconfig:
vmlinux vmlinux.strip vmlinux.gz
-O2 4980515 4187528 1846829
-Os 4618801 3827084 1673333
-O2 -mcpu=powerpc 4738851 3945868 1816253
-Os -mcpu=powerpc 4532785 3741068 1664688
Signed-off-by: Olaf Hering <olh at suse.de>
---
arch/powerpc/Makefile | 1 +
1 file changed, 1 insertion(+)
Index: linux-2.6.16-olh/arch/powerpc/Makefile
===================================================================
--- linux-2.6.16-olh.orig/arch/powerpc/Makefile
+++ linux-2.6.16-olh/arch/powerpc/Makefile
@@ -107,6 +107,7 @@ endif
cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
cpu-as-$(CONFIG_4xx) += -Wa,-m405
cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
+cpu-as-$(CONFIG_6xx) += -mcpu=powerpc
cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
cpu-as-$(CONFIG_E500) += -Wa,-me500
cpu-as-$(CONFIG_E200) += -Wa,-me200
More information about the Linuxppc-dev
mailing list