diff --git a/include/zephyr/linker/common-rom/common-rom-logging.ld b/include/zephyr/linker/common-rom/common-rom-logging.ld index f39fed01b21f51..4e146375b43baa 100644 --- a/include/zephyr/linker/common-rom/common-rom-logging.ld +++ b/include/zephyr/linker/common-rom/common-rom-logging.ld @@ -2,7 +2,14 @@ #include +#ifdef CONFIG_LOG_FMT_SECTION_STRIP + SECTION_PROLOGUE(log_strings,(COPY),SUBALIGN(4)) + { + Z_LINK_ITERABLE(log_strings); + } GROUP_ROM_LINK_IN(DEVNULL_REGION, DEVNULL_REGION) +#else ITERABLE_SECTION_ROM(log_strings, 4) +#endif ITERABLE_SECTION_ROM(log_const, 4) diff --git a/subsys/logging/Kconfig.misc b/subsys/logging/Kconfig.misc index 74b629f54ae97c..0dc5831e5282c6 100644 --- a/subsys/logging/Kconfig.misc +++ b/subsys/logging/Kconfig.misc @@ -65,6 +65,13 @@ config LOG_FMT_SECTION removing strings from final binary and should be used for dictionary logging. +config LOG_FMT_SECTION_STRIP + bool "Strip log strings from binary" + depends on !LOG_OUTPUT + depends on LOG_FMT_SECTION + depends on LINKER_DEVNULL_SUPPORT + imply LINKER_DEVNULL_MEMORY + config LOG_USE_TAGGED_ARGUMENTS bool "Using tagged arguments for packaging" depends on !PICOLIBC