From: Adrian Bunk <bunk@fs.tum.de>
To: linux-kernel@vger.kernel.org
Cc: spyro@f2s.com, linux-arm-kernel@lists.arm.linux.org.uk,
Yoshinori Sato <ysato@users.sourceforge.jp>
Subject: [2.6 patch] add a config option for -Os
Date: Tue, 26 Aug 2003 00:47:17 +0200 [thread overview]
Message-ID: <20030825224717.GZ7038@fs.tum.de> (raw)
The patch below adds a config option for compiling the kernel with -Os.
Compared to the last patch, the option moved to the embedded to the
General Setup menu and depends on EXPERIMENTAL instead of EMBEDDED
(retionale: it might even produce a faster kernel but it's less tested).
I removed the special cases in the arm, arm26 and h8300 Makefiles, users
on these architectures can now use OPTIMIZE_FOR_SIZE.
Compiling with this option enabled produced a working kernel for me on
i386.
cu
Adrian
--- linux-2.6.0-test4/init/Kconfig.old 2003-08-24 14:51:15.000000000 +0200
+++ linux-2.6.0-test4/init/Kconfig 2003-08-24 14:55:45.000000000 +0200
@@ -48,6 +48,15 @@
menu "General setup"
+config OPTIMIZE_FOR_SIZE
+ bool "Optimize for size" if EXPERIMENTAL
+ default n
+ help
+ Enabling this option will pass "-Os" instead of "-O2" to gcc
+ resulting in a smaller kernel.
+
+ If unsure, say N.
+
config SWAP
bool "Support for paging of anonymous memory"
depends on MMU
--- 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
--- linux-2.6.0-test4/arch/arm26/Makefile.old 2003-08-24 14:50:45.000000000 +0200
+++ linux-2.6.0-test4/arch/arm26/Makefile 2003-08-24 14:56:15.000000000 +0200
@@ -13,7 +13,6 @@
OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
GZFLAGS :=-9
#CFLAGS +=-pipe
-CFLAGS :=$(CFLAGS:-O2=-Os)
ifeq ($(CONFIG_FRAME_POINTER),y)
CFLAGS +=-fno-omit-frame-pointer -mno-sched-prolog
--- linux-2.6.0-test4/arch/arm/Makefile.old 2003-08-24 14:56:41.000000000 +0200
+++ linux-2.6.0-test4/arch/arm/Makefile 2003-08-24 14:56:57.000000000 +0200
@@ -14,8 +14,6 @@
GZFLAGS :=-9
#CFLAGS +=-pipe
-CFLAGS :=$(CFLAGS:-O2=-Os)
-
ifeq ($(CONFIG_FRAME_POINTER),y)
CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog
endif
--- linux-2.6.0-test4/arch/h8300/Makefile.old 2003-08-24 14:59:42.000000000 +0200
+++ linux-2.6.0-test4/arch/h8300/Makefile 2003-08-24 15:00:18.000000000 +0200
@@ -34,7 +34,7 @@
ldflags-$(CONFIG_CPU_H8S) := -mh8300self
CFLAGS += $(cflags-y)
-CFLAGS += -mint32 -fno-builtin -Os
+CFLAGS += -mint32 -fno-builtin
CFLAGS += -g
CFLAGS += -D__linux__
CFLAGS += -DUTS_SYSNAME=\"uClinux\"
next reply other threads:[~2003-08-25 22:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-25 22:47 Adrian Bunk [this message]
2003-08-26 14:41 ` [2.6 patch] add a config option for -Os Yoshinori Sato
2003-08-26 14:58 ` Valdis.Kletnieks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030825224717.GZ7038@fs.tum.de \
--to=bunk@fs.tum.de \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=spyro@f2s.com \
--cc=ysato@users.sourceforge.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.