From e2e51c08f641467cc7c928f6e6bb350cbc1c1d74 Mon Sep 17 00:00:00 2001 From: Deomid rojer Ryabkov Date: Sun, 30 Mar 2025 00:24:12 +0200 Subject: [PATCH] change(xtensa): Add -mno-target-align to size-optimized builds Saves space, about 6K in our application Merges https://github.com/espressif/esp-idf/pull/15677 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b94636212..d21d2a38ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,9 @@ if(BOOTLOADER_BUILD) endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU") list(APPEND compile_options "-freorder-blocks") + if(CONFIG_IDF_TARGET_ARCH_XTENSA) + list(APPEND compile_options "-mno-target-align") + endif() endif() elseif(CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og") @@ -52,6 +55,9 @@ else() endif() if(CMAKE_C_COMPILER_ID MATCHES "GNU") list(APPEND compile_options "-freorder-blocks") + if(CONFIG_IDF_TARGET_ARCH_XTENSA) + list(APPEND compile_options "-mno-target-align") + endif() endif() elseif(CONFIG_COMPILER_OPTIMIZATION_DEBUG) list(APPEND compile_options "-Og")