Skip to content

Commit

Permalink
Split CONFIG_CC_OPTIMIZE_FOR_SIZE into two configs
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
  • Loading branch information
sean-anderson-seco authored and trini committed Mar 25, 2022
1 parent e47bbf7 commit f38cb2a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
17 changes: 14 additions & 3 deletions Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion arch/sh/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f38cb2a

Please sign in to comment.