Merge branch 'feature/add_compiler_no_merge_constants_v5.2' into 'release/v5.2'

feat: add compiler config for not merging const sections (v5.2)

See merge request espressif/esp-idf!34087
This commit is contained in:
Aditya Patwardhan
2024-11-15 15:32:51 +08:00
3 changed files with 14 additions and 0 deletions

View File

@ -134,6 +134,10 @@ if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
list(APPEND compile_definitions "-DNDEBUG")
endif()
if(CONFIG_COMPILER_NO_MERGE_CONSTANTS)
list(APPEND compile_options "-fno-merge-constants")
endif()
if(CONFIG_COMPILER_STACK_CHECK_MODE_NORM)
list(APPEND compile_options "-fstack-protector")
elseif(CONFIG_COMPILER_STACK_CHECK_MODE_STRONG)

View File

@ -496,6 +496,15 @@ mainmenu "Espressif IoT Development Framework Configuration"
help
Stack smashing protection.
config COMPILER_NO_MERGE_CONSTANTS
bool "Disable merging const sections"
depends on IDF_TOOLCHAIN_GCC
help
Disable merging identical constants (string/floating-point) across compilation units.
This helps in better size analysis of the application binary as the rodata section
distribution is more uniform across libraries. On downside, it may increase
the binary size and hence should be used during development phase only.
config COMPILER_WARN_WRITE_STRINGS
bool "Enable -Wwrite-strings warning flag"
default "n"

View File

@ -0,0 +1 @@
CONFIG_COMPILER_NO_MERGE_CONSTANTS=y