From 642c495fcb8e0ad4790abb1cb3e5bd8f54a39956 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 2 Mar 2023 12:58:15 -0800 Subject: [PATCH] Demo/CORTEX_M3_MPS2_QEMU_GCC: Add TLS support to linker script Allocate ROM for initialized thread local storage variables. Allocate TLS offsets for all thread local storage variables. Signed-off-by: Keith Packard --- .../scripts/mps2_m3.ld | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/scripts/mps2_m3.ld b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/scripts/mps2_m3.ld index 0c5fa6dd77..7725e3fc7e 100644 --- a/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/scripts/mps2_m3.ld +++ b/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC/scripts/mps2_m3.ld @@ -74,6 +74,27 @@ SECTIONS . = ALIGN(4); } >FLASH + .tdata : { + *(.tdata .tdata.*) + } >FLASH + + .tbss (NOLOAD) : { + *(.tbss .tbss.* .gnu.linkonce.tb.*) + *(.tcommon) + PROVIDE( __tbss_end = . ); + PROVIDE( __tls_end = . ); + } >FLASH + PROVIDE( __tdata_source = LOADADDR(.tdata) ); + PROVIDE( __tdata_source_end = LOADADDR(.tdata) + SIZEOF(.tdata) ); + PROVIDE( __tdata_size = SIZEOF(.tdata) ); + PROVIDE( __tbss_offset = ADDR(.tbss) - ADDR(.tdata) ); + PROVIDE( __tbss_start = ADDR(.tbss) ); + PROVIDE( __tbss_size = SIZEOF(.tbss) ); + PROVIDE( __tls_size = __tls_end - ADDR(.tdata) ); + PROVIDE( __tls_align = MAX(ALIGNOF(.tdata), ALIGNOF(.tbss)) ); + PROVIDE( __arm32_tls_tcb_offset = MAX(8, __tls_align) ); + PROVIDE( __arm64_tls_tcb_offset = MAX(16, __tls_align) ); + .interrupts_ram : { . = ALIGN(4);