Messages in this thread Patch in this message | | | Date | Sun, 17 Oct 2004 02:38:08 +0200 | From | Sam Ravnborg <> | Subject | Re: [PATCH] Make gcc -align options .config-settable |
| |
On Fri, Oct 01, 2004 at 03:17:51PM -0700, Andrew Morton wrote: > Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua> wrote: > > > > With all alignment options set to 1 (minimum alignment), > > I've got 5% smaller vmlinux compared to one built with > > default code alignment. > > > > Sam, can you process this one? > > > > > > > +GCC_VERSION = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh $(CC)) > > It bugs me that we're evaluating the same thing down in arch/i386/Makefile. > Perhaps we should evaluate GCC_VERSION once only, as some top-level kbuild > thing. So everyone can assume that it's present and correct?
Started looking into this. gcc does not document what happens if -falign-functions=x is specified more than once. It works but I have not checked the effect. It will occur for some CPU's
Sam
Current patch to top-level Makefile looks like this.
===== Makefile 1.542 vs edited ===== --- 1.542/Makefile 2004-10-17 02:00:48 +02:00 +++ edited/Makefile 2004-10-17 02:29:56 +02:00 @@ -295,6 +295,11 @@ cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) +# cc-option-align +# Prefix align with either -falign or -malign +cc-option-align = $(subst -functions=0,,\ + $(call cc-option,-falign-functions=0,-malign-functions=0)) + # cc-version # Usage gcc-ver := $(call cc-version $(CC)) cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ @@ -497,6 +502,13 @@ else CFLAGS += -O2 endif + +#Add aling options in CONFIG_CC_ not equal to 0 +add-align = $(if $(filter-out 0,$($(1))),$(cc-option-align)$(2)=$($(1))) +CFLAGS += $(call add-align,CONFIG_CC_ALIGN_FUNCTIONS,-functions) +CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LABELS,-labels) +CFLAGS += $(call add-align,CONFIG_CC_ALIGN_LOOPS,-loops) +CFLAGS += $(call add-align,CONFIG_CC_ALIGN_JUMPS,-jumps) ifdef CONFIG_FRAME_POINTER CFLAGS += -fno-omit-frame-pointer - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |