[2.6 patch] add an -Os config option

From: Adrian Bunk (bunk_at_fs.tum.de)
Date: 08/11/03

  • Next message: Jean Tourrilhes: "IrDA patches for 2.6.X, resend"
    Date:	Mon, 11 Aug 2003 23:11:45 +0200
    To: linux-kernel@vger.kernel.org
    
    

    The patch below adds an option OPTIMIZE_FOR_SIZE (depending on EMBEDDED)
    that changes the optimization from -O2 to -Os.

    cu
    Adrian

    --- linux-2.6.0-test3/init/Kconfig.old 2003-08-11 01:33:31.000000000 +0200
    +++ linux-2.6.0-test3/init/Kconfig 2003-08-11 01:46:48.000000000 +0200
    @@ -118,6 +118,17 @@
               a "non-standard" kernel. Only use this if you really know what you
               are doing.
     
    +config OPTIMIZE_FOR_SIZE
    + bool "Optimize for size" if EMBEDDED
    + default n
    + help
    + Enabling this option will pass "-Os" instead of "-O2" to gcc
    + resulting in a smaller kernel.
    +
    + The resulting kernel might be significantly slower.
    +
    + If unsure, say N.
    +
     config KALLSYMS
              bool "Load all symbols for debugging/kksymoops" if EMBEDDED
              default y
    --- linux-2.6.0-test3/Makefile.old 2003-08-11 01:34:41.000000000 +0200
    +++ linux-2.6.0-test3/Makefile 2003-08-11 01:37:16.000000000 +0200
    @@ -223,7 +223,7 @@
     NOSTDINC_FLAGS = -nostdinc -iwithprefix include
     
     CPPFLAGS := -D__KERNEL__ -Iinclude
    -CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
    +CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \
                          -fno-strict-aliasing -fno-common
     AFLAGS := -D__ASSEMBLY__
     
    @@ -318,6 +318,12 @@
     
     -include .config.cmd
     
    +ifdef CONFIG_OPTIMIZE_FOR_SIZE
    +CFLAGS += -Os
    +else
    +CFLAGS += -O2
    +endif
    +
     ifndef CONFIG_FRAME_POINTER
     CFLAGS += -fomit-frame-pointer
     endif
    -
    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/


  • Next message: Jean Tourrilhes: "IrDA patches for 2.6.X, resend"

    Relevant Pages