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>
This commit is contained in:
parent
97db4ac0ca
commit
3180fc0ecc
|
@ -291,6 +291,18 @@ extern char z_user_stacks_start[];
|
|||
extern char z_user_stacks_end[];
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
#ifdef CONFIG_THREAD_LOCAL_STORAGE
|
||||
extern char __tdata_start[];
|
||||
extern char __tdata_end[];
|
||||
extern char __tdata_size[];
|
||||
extern char __tbss_start[];
|
||||
extern char __tbss_end[];
|
||||
extern char __tbss_size[];
|
||||
extern char __tls_start[];
|
||||
extern char __tls_end[];
|
||||
extern char __tls_size[];
|
||||
#endif /* CONFIG_THREAD_LOCAL_STORAGE */
|
||||
|
||||
#endif /* ! _ASMLANGUAGE */
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_LINKER_LINKER_DEFS_H_ */
|
||||
|
|
29
include/linker/thread-local-storage.ld
Normal file
29
include/linker/thread-local-storage.ld
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* 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);
|
Loading…
Reference in a new issue