From 38b0291efa48f2c5d0cc78f80f22cd63df2470da Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 6 Jun 2025 15:26:44 -0700 Subject: [PATCH] riscv: Use -O2 by default for riscv gcc 14.3 has bus compiling with -Os on riscv, use -O2 by default. Is there some way to prevent applications from selecting -Os? Signed-off-by: Keith Packard --- cmake/zephyr/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/zephyr/Kconfig b/cmake/zephyr/Kconfig index 86a70119..9c0400ec 100644 --- a/cmake/zephyr/Kconfig +++ b/cmake/zephyr/Kconfig @@ -23,6 +23,9 @@ config PICOLIBC_DEFAULT help Zephyr SDK >=0.17.1 always uses Picolibc +# libstdc++ is built without exception support in -Os mode +# gcc 14.3 has bugs compiling with -Os on riscv choice COMPILER_OPTIMIZATIONS default SPEED_OPTIMIZATIONS if ("$(TOOLCHAIN_VARIANT_COMPILER)" = "gnu") && CPP_EXCEPTIONS + default SPEED_OPTIMIZATIONS if ("$(TOOLCHAIN_VARIANT_COMPILER)" = "gnu") && RISCV endchoice