From 5890c7308734af08a6e94861beb7025c80bb0214 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 6 May 2025 19:30:09 -0700 Subject: [PATCH] linker: Place .tbss section in RAM, not FLASH If this section is placed in FLASH, the section gets marked as writable even though .tbss values will never be stored there. Signed-off-by: Keith Packard --- cmake/linker_script/common/thread-local-storage.cmake | 2 +- include/zephyr/linker/thread-local-storage.ld | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmake/linker_script/common/thread-local-storage.cmake b/cmake/linker_script/common/thread-local-storage.cmake index 6eb8dd417af..127b7f93023 100644 --- a/cmake/linker_script/common/thread-local-storage.cmake +++ b/cmake/linker_script/common/thread-local-storage.cmake @@ -13,7 +13,7 @@ if(CONFIG_THREAD_LOCAL_STORAGE) zephyr_linker_section_configure(SECTION .tbss INPUT ".tbss.*") zephyr_linker_section_configure(SECTION .tbss INPUT ".gnu.linkonce.tb.*") zephyr_linker_section_configure(SECTION .tbss INPUT ".tcommon") - # GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) + # GROUP_ROM_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) # # These needs to be outside of the tdata/tbss diff --git a/include/zephyr/linker/thread-local-storage.ld b/include/zephyr/linker/thread-local-storage.ld index d2bc2b2b334..c0eec73f4e1 100644 --- a/include/zephyr/linker/thread-local-storage.ld +++ b/include/zephyr/linker/thread-local-storage.ld @@ -8,10 +8,10 @@ *(.tdata .tdata.* .gnu.linkonce.td.*); } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) - SECTION_DATA_PROLOGUE(tbss,,) + SECTION_DATA_PROLOGUE(tbss,(NOLOAD),) { *(.tbss .tbss.* .gnu.linkonce.tb.* .tcommon); - } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) + } GROUP_ROM_LINK_IN(RAMABLE_REGION, RAMABLE_REGION) /* * These needs to be outside of the tdata/tbss