diff --git a/arch/x86_64/src/common/Toolchain.defs b/arch/x86_64/src/common/Toolchain.defs index d4c1717575..7d00e0e444 100644 --- a/arch/x86_64/src/common/Toolchain.defs +++ b/arch/x86_64/src/common/Toolchain.defs @@ -22,10 +22,10 @@ ifeq ($(CONFIG_DEBUG_SYMBOLS),y) ARCHOPTIMIZATION = -g endif -ifneq ($(CONFIG_DEBUG_NOOPT),y) - ARCHOPTIMIZATION += -O2 -fno-optimize-sibling-calls - ARCHOPTIMIZATION += -fno-omit-frame-pointer -fno-crossjumping - ARCHOPTIMIZATION += -fno-delete-null-pointer-checks +ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) + ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL) +else ifeq ($(CONFIG_DEBUG_FULLOPT),y) + ARCHOPTIMIZATION += -Os endif ARCHCPUFLAGS = -fPIC -fno-stack-protector -mno-red-zone -mrdrnd