forked from espressif/esp-idf
Merge branch 'feature/add_compiler_no_merge_constants' into 'master'
feat: add compiler config for not merging const sections See merge request espressif/esp-idf!32077
This commit is contained in:
@@ -136,6 +136,10 @@ if(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE)
|
|||||||
list(APPEND compile_definitions "-DNDEBUG")
|
list(APPEND compile_definitions "-DNDEBUG")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(CONFIG_COMPILER_NO_MERGE_CONSTANTS)
|
||||||
|
list(APPEND compile_options "-fno-merge-constants")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_COMPILER_STACK_CHECK_MODE_NORM)
|
if(CONFIG_COMPILER_STACK_CHECK_MODE_NORM)
|
||||||
list(APPEND compile_options "-fstack-protector")
|
list(APPEND compile_options "-fstack-protector")
|
||||||
elseif(CONFIG_COMPILER_STACK_CHECK_MODE_STRONG)
|
elseif(CONFIG_COMPILER_STACK_CHECK_MODE_STRONG)
|
||||||
|
9
Kconfig
9
Kconfig
@@ -510,6 +510,15 @@ mainmenu "Espressif IoT Development Framework Configuration"
|
|||||||
help
|
help
|
||||||
Stack smashing protection.
|
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
|
config COMPILER_WARN_WRITE_STRINGS
|
||||||
bool "Enable -Wwrite-strings warning flag"
|
bool "Enable -Wwrite-strings warning flag"
|
||||||
default "n"
|
default "n"
|
||||||
|
@@ -136,7 +136,7 @@ The table is sorted in descending order of the total contribution of the static
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The size of the ``.rodata`` section in the ``Flash Data`` memory type may appear very large for a single archive. This occurs due to linker relaxations. The linker may attempt to combine object file sections with ``MERGE`` and ``STRINGS`` flags from all archives into one to perform tail string optimization. Consequently, one archive may end up with a very large ``.rodata`` section, containing string literals from other archives. This is evident in the ``.rodata`` section of the ``libesp_app_format.a`` archive.
|
The size of the ``.rodata`` section in the ``Flash Data`` memory type may appear very large for a single archive. This occurs due to linker relaxations. The linker may attempt to combine object file sections with ``MERGE`` and ``STRINGS`` flags from all archives into one to perform tail string optimization. Consequently, one archive may end up with a very large ``.rodata`` section, containing string literals from other archives. This is evident in the ``.rodata`` section of the ``libesp_app_format.a`` archive. The specific compiler behavior here can be turned off by enabling :ref:`CONFIG_COMPILER_NO_MERGE_CONSTANTS` option (only for GCC toolchain), please read help for more details.
|
||||||
|
|
||||||
|
|
||||||
Source File Usage Summary ``idf.py size-files``
|
Source File Usage Summary ``idf.py size-files``
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
CONFIG_COMPILER_NO_MERGE_CONSTANTS=y
|
Reference in New Issue
Block a user