From 1a832eb554f6f7e504698138922935b51554872f Mon Sep 17 00:00:00 2001 From: hanqiyuan Date: Sun, 20 Aug 2023 22:36:56 +0800 Subject: [PATCH] xtensa: enable -Oz for xtensa to reduce codesize --- arch/xtensa/Kconfig | 2 +- arch/xtensa/src/lx7/Toolchain.defs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index 48ff80958e..e74a095b96 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -307,7 +307,7 @@ config XTENSA_TOOLCHAIN_XCC config XTENSA_TOOLCHAIN_XCLANG bool "Xtensa Toolchain use CLANG as front end" - select ARCH_TOOLCHAIN_GNU + select ARCH_TOOLCHAIN_CLANG config XTENSA_TOOLCHAIN_ESP bool "ESP toolchain for xtensa" diff --git a/arch/xtensa/src/lx7/Toolchain.defs b/arch/xtensa/src/lx7/Toolchain.defs index 0f9bef98c5..f8719643fe 100644 --- a/arch/xtensa/src/lx7/Toolchain.defs +++ b/arch/xtensa/src/lx7/Toolchain.defs @@ -58,7 +58,11 @@ endif ifeq ($(CONFIG_DEBUG_CUSTOMOPT),y) ARCHOPTIMIZATION += $(CONFIG_DEBUG_OPTLEVEL) else ifeq ($(CONFIG_DEBUG_FULLOPT),y) - ARCHOPTIMIZATION += -Os + ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) + ARCHOPTIMIZATION += -Oz + else + ARCHOPTIMIZATION += -Os + endif endif ifneq ($(CONFIG_DEBUG_NOOPT),y)