zephyr/include/linker/thread-local-storage.ld
Daniel Leung 3180fc0ecc linker: add linker sections for thread local storage
This adds the tdata and tbss sections required for thread local
storage. They are in ROM area as these sections are not to be
directly accessed, but copied to thread local storage area at
thread creation.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-10-24 10:52:00 -07:00

30 lines
838 B
Plaintext

/* SPDX-License-Identifier: Apache-2.0 */
SECTION_DATA_PROLOGUE(tdata,,)
{
*(.tdata .tdata.* .gnu.linkonce.td.*);
} GROUP_LINK_IN(ROMABLE_REGION)
SECTION_DATA_PROLOGUE(tbss,,)
{
*(.tbss .tbss.* .gnu.linkonce.tb.* .tcommon);
} GROUP_LINK_IN(ROMABLE_REGION)
/*
* These needs to be outside of the tdata/tbss
* sections or else they would be considered
* thread-local variables, and the code would use
* the wrong values.
*/
PROVIDE(__tdata_start = LOADADDR(tdata));
PROVIDE(__tdata_size = SIZEOF(tdata));
PROVIDE(__tdata_end = __tdata_start + __tdata_size);
PROVIDE(__tbss_start = LOADADDR(tbss));
PROVIDE(__tbss_size = SIZEOF(tbss));
PROVIDE(__tbss_end = __tbss_start + __tbss_size);
PROVIDE(__tls_start = __tdata_start);
PROVIDE(__tls_end = __tbss_end);
PROVIDE(__tls_size = __tbss_end - __tdata_start);