We need to do a few things differently if we are to support a virtual memory map, i.e. CONFIG_MMU where CONFIG_KERNEL_VM_BASE is not the same as CONFIG_SRAM_BASE_ADDRESS. - All sections must be specified with a VMA and LMA, where VMA is the virtual address and LMA is the physical memory location. - All sections must be specified with ALIGN_WITH_INPUT to keep VMAs and LMAs synchronized To do this, the existing linker macros need some adjustment: - GROUP_LINK_IN undefined when CONFIG_KERNEL_VM_BASE is not the same as CONFIG_SRAM_BASE_ADDRESS. - New macro GROUP_ROM_LINK_IN for text/rodata sections - New macro GROUP_NOLOAD_LINK_IN for bss/noinit sections - Implicit ALIGN_WITH_INPUT for all sections GROUP_FOLLOWS_AT is unused anywhere in the kernel for years now and has been removed. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com> Signed-off-by: Daniel Leung <daniel.leung@intel.com>
41 lines
1.1 KiB
Plaintext
41 lines
1.1 KiB
Plaintext
/* SPDX-License-Identifier: Apache-2.0 */
|
|
|
|
#ifdef CONFIG_THREAD_LOCAL_STORAGE
|
|
|
|
SECTION_DATA_PROLOGUE(tdata,,)
|
|
{
|
|
*(.tdata .tdata.* .gnu.linkonce.td.*);
|
|
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
|
|
|
SECTION_DATA_PROLOGUE(tbss,,)
|
|
{
|
|
*(.tbss .tbss.* .gnu.linkonce.tb.* .tcommon);
|
|
} GROUP_ROM_LINK_IN(RAMABLE_REGION, 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.
|
|
*/
|
|
#ifdef CONFIG_XIP
|
|
/* The "master copy" of tdata should be only in flash on XIP systems */
|
|
PROVIDE(__tdata_start = LOADADDR(tdata));
|
|
#else
|
|
PROVIDE(__tdata_start = ADDR(tdata));
|
|
#endif
|
|
PROVIDE(__tdata_size = SIZEOF(tdata));
|
|
PROVIDE(__tdata_end = __tdata_start + __tdata_size);
|
|
PROVIDE(__tdata_align = ALIGNOF(tdata));
|
|
|
|
PROVIDE(__tbss_start = ADDR(tbss));
|
|
PROVIDE(__tbss_size = SIZEOF(tbss));
|
|
PROVIDE(__tbss_end = __tbss_start + __tbss_size);
|
|
PROVIDE(__tbss_align = ALIGNOF(tbss));
|
|
|
|
PROVIDE(__tls_start = __tdata_start);
|
|
PROVIDE(__tls_end = __tbss_end);
|
|
PROVIDE(__tls_size = __tbss_end - __tdata_start);
|
|
|
|
#endif /* CONFIG_THREAD_LOCAL_STORAGE */
|