Commit ffd0cf49 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Add `gcc -Os' config option

From: Adrian Bunk <bunk@fs.tum.de>

Allow the kernel to be built with `-Os'.

It requires CONFIG_EMBEDDED.  This is to make it "hard to get at" because
one gcc version (3.2.x I think) from RH9 generates crashy kernels with this
option set.
parent a93fabd3
......@@ -275,7 +275,7 @@ NOSTDINC_FLAGS = -nostdinc -iwithprefix include
CPPFLAGS := -D__KERNEL__ -Iinclude \
$(if $(KBUILD_SRC),-Iinclude2 -I$(srctree)/include)
CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs -O2 \
CFLAGS := -Wall -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common
AFLAGS := -D__ASSEMBLY__
......@@ -431,6 +431,12 @@ libs-y := $(libs-y1) $(libs-y2)
# ---------------------------------------------------------------------------
ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
CFLAGS += -Os
else
CFLAGS += -O2
endif
ifndef CONFIG_FRAME_POINTER
CFLAGS += -fomit-frame-pointer
endif
......
......@@ -14,8 +14,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 -mapcs -mno-sched-prolog
endif
......
......@@ -5,6 +5,10 @@
mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration"
config H8300
bool
default y
config MMU
bool
default n
......
......@@ -34,7 +34,7 @@ cflags-$(CONFIG_CPU_H8S) := -ms
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\"
......
......@@ -196,6 +196,19 @@ config EPOLL
source "drivers/block/Kconfig.iosched"
config CC_OPTIMIZE_FOR_SIZE
bool "Optimize for size" if EMBEDDED
default y if ARM || H8300
default n
help
Enabling this option will pass "-Os" instead of "-O2" to gcc
resulting in a smaller kernel.
WARNING: some versions of gcc may generate incorrect code with this
option. If problems are observed, a gcc upgrade may be needed.
If unsure, say N.
endmenu # General setup
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment