]> git.sur5r.net Git - u-boot/commitdiff
kconfig: add CONFIG_CC_OPTIMIZE_FOR_SIZE
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Fri, 22 Aug 2014 10:42:29 +0000 (19:42 +0900)
committerTom Rini <trini@ti.com>
Thu, 28 Aug 2014 21:18:48 +0000 (17:18 -0400)
Copy the Kconfig option from "init/Kconfig" of Linux v3.16 tag
and adjust the help document.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Kconfig
Makefile

diff --git a/Kconfig b/Kconfig
index ea2c836115277788decab3d81c821f9370898a1f..cbb691e160868a16293229854cd13517c79bcde4 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -46,6 +46,16 @@ config LOCALVERSION_AUTO
 
          which is done within the script "scripts/setlocalversion".)
 
+config CC_OPTIMIZE_FOR_SIZE
+       bool "Optimize for size"
+       depends on !SPL_BUILD
+       default y
+       help
+         Enabling this option will pass "-Os" instead of "-O2" to gcc
+         resulting in a smaller U-Boot image.
+
+         This option is enabled by default for U-Boot.
+
 endmenu                # General setup
 
 menu "Boot images"
index 0fea5c2681b59fa311d86e0baec28da935a2e969..9646859083a4414ac50c1378726ecb8a51548228 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -529,7 +529,11 @@ else
 include/config/auto.conf: ;
 endif # $(dot-config)
 
-KBUILD_CFLAGS += -Os #-fomit-frame-pointer
+ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+KBUILD_CFLAGS  += -Os
+else
+KBUILD_CFLAGS  += -O2
+endif
 
 ifdef BUILD_TAG
 KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'