]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Split CONFIG_CC_OPTIMIZE_FOR_SIZE into two configs
authorSean Anderson <sean.anderson@seco.com>
Tue, 22 Feb 2022 17:19:24 +0000 (12:19 -0500)
committerTom Rini <trini@konsulko.com>
Fri, 25 Mar 2022 17:35:50 +0000 (13:35 -0400)
This adds a separate CONFIG_CC_OPTIMIZE_FOR_SPEED option in a choice,
in preparation for adding another optimization option. Also convert SH's
makefile to use this new option.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Kconfig
Makefile
arch/sh/lib/Makefile

diff --git a/Kconfig b/Kconfig
index 9dd9ec7f6dfb38a469ef52700b742814f9f3fda4..8159c596c018bb375f2a7578bde3b3bd00829fef 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -72,15 +72,26 @@ config CLANG_VERSION
        int
        default $(shell,$(srctree)/scripts/clang-version.sh $(CC))
 
+choice
+       prompt "Optimization level"
+       default CC_OPTIMIZE_FOR_SIZE
+
 config CC_OPTIMIZE_FOR_SIZE
        bool "Optimize for size"
-       default y
        help
-         Enabling this option will pass "-Os" instead of "-O2" to gcc
-         resulting in a smaller U-Boot image.
+         Enabling this option will pass "-Os" to gcc, resulting in a smaller
+         U-Boot image.
 
          This option is enabled by default for U-Boot.
 
+config CC_OPTIMIZE_FOR_SPEED
+       bool "Optimize for speed"
+       help
+         Enabling this option will pass "-O2" to gcc, resulting in a faster
+         U-Boot image.
+
+endchoice
+
 config OPTIMIZE_INLINING
        bool "Allow compiler to uninline functions marked 'inline' in full U-Boot"
        help
index 06572ac07eec93a0c23b0ff13f1a0dbc005c839f..c04b58d46a799cad5742b300d14add598c1ffd9a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -683,7 +683,9 @@ endif
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS  += -Os
-else
+endif
+
+ifdef CONFIG_CC_OPTIMIZE_FOR_SPEED
 KBUILD_CFLAGS  += -O2
 endif
 
index 9618da1cb36cddb1163e26d474c31f1a6399b46a..e7520a328d5427f70e55b501278e1a6a0b80f758 100644 (file)
@@ -12,7 +12,7 @@ obj-$(CONFIG_CMD_SH_ZIMAGEBOOT) += zimageboot.o
 
 udivsi3-y                      := udivsi3_i4i-Os.o
 
-ifneq ($(CONFIG_CC_OPTIMIZE_FOR_SIZE),y)
+ifeq ($(CONFIG_CC_OPTIMIZE_FOR_SPEED),y)
 udivsi3-$(CONFIG_CPU_SH4)      := udivsi3_i4i.o
 endif
 udivsi3-y                      += udivsi3.o