lkml.org 
[lkml]   [2003]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[2.6 patch] add an -Os config option
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/
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.147 / U:1.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site