board/sim: add support of custom optimization level

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-03-14 19:20:08 +08:00 committed by Xiang Xiao
parent d21d02c65d
commit 22e71e2d71
2 changed files with 8 additions and 1 deletions

View File

@ -85,6 +85,7 @@ config ARCH_SIM
select ARCH_HAVE_TESTSET select ARCH_HAVE_TESTSET
select ARCH_HAVE_VFORK select ARCH_HAVE_VFORK
select ARCH_HAVE_SETJMP select ARCH_HAVE_SETJMP
select ARCH_HAVE_CUSTOMOPT
select ARCH_SETJMP_H select ARCH_SETJMP_H
select ALARM_ARCH select ALARM_ARCH
select ONESHOT select ONESHOT

View File

@ -45,8 +45,14 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
ARCHOPTIMIZATIONRUST = -g ARCHOPTIMIZATIONRUST = -g
endif endif
ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y)
MAXOPTIMIZATION := $(CONFIG_DEBUG_OPTLEVEL)
else
MAXOPTIMIZATION ?= -O2
endif
ifneq ($(CONFIG_DEBUG_NOOPT),y) ifneq ($(CONFIG_DEBUG_NOOPT),y)
ARCHOPTIMIZATION += -O2 -fno-strict-aliasing ARCHOPTIMIZATION += $(MAXOPTIMIZATION) -fno-strict-aliasing
else else
ARCHOPTIMIZATIONRUST += -C opt-level=0 ARCHOPTIMIZATIONRUST += -C opt-level=0
endif endif