linker: align _image_rodata and _image_rom start/end/size linker symbols
Cleanup and preparation commit for linker script generator. Zephyr linker scripts provides start and end symbols for each larger areas in the linker script. The symbols _image_rom_start and _image_rom_end corresponds to the group ROMABLE_REGION defined in the ld linker scripts. The symbols _image_rodata_start and _image_rodata_end is not placed as independent group but covers common-rom.ld, thread-local-storage.ld, kobject-rom.ld and snippets-rodata.ld. This commit align those names and prepares for generation of groups in linker scripts. The symbols describing the ROMABLE_REGION will be renamed to: _image_rom_start -> __rom_region_start _image_rom_end -> __rom_region_end The rodata will also use the group symbol notation as: _image_rodata_start -> __rodata_region_start _image_rodata_end -> __rodata_region_end Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
510d7dbfb6
commit
c6aded2dcb
23 changed files with 86 additions and 86 deletions
|
@ -651,8 +651,8 @@ static const struct arm_mmu_flat_range mmu_zephyr_ranges[] = {
|
||||||
|
|
||||||
/* Mark rodata segment cacheable, read only and execute-never */
|
/* Mark rodata segment cacheable, read only and execute-never */
|
||||||
{ .name = "zephyr_rodata",
|
{ .name = "zephyr_rodata",
|
||||||
.start = _image_rodata_start,
|
.start = __rodata_region_start,
|
||||||
.end = _image_rodata_end,
|
.end = __rodata_region_end,
|
||||||
.attrs = MT_NORMAL | MT_P_RO_U_RO | MT_DEFAULT_SECURE_STATE },
|
.attrs = MT_NORMAL | MT_P_RO_U_RO | MT_DEFAULT_SECURE_STATE },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -229,11 +229,11 @@ void z_riscv_init_user_accesses(struct k_thread *thread)
|
||||||
{
|
{
|
||||||
unsigned char index;
|
unsigned char index;
|
||||||
unsigned char *uchar_pmpcfg;
|
unsigned char *uchar_pmpcfg;
|
||||||
ulong_t rom_start = (ulong_t) _image_rom_start;
|
ulong_t rom_start = (ulong_t) __rom_region_start;
|
||||||
#if defined(CONFIG_PMP_POWER_OF_TWO_ALIGNMENT)
|
#if defined(CONFIG_PMP_POWER_OF_TWO_ALIGNMENT)
|
||||||
ulong_t rom_size = (ulong_t) _image_rom_size;
|
ulong_t rom_size = (ulong_t) __rom_region_size;
|
||||||
#else /* CONFIG_PMP_POWER_OF_TWO_ALIGNMENT */
|
#else /* CONFIG_PMP_POWER_OF_TWO_ALIGNMENT */
|
||||||
ulong_t rom_end = (ulong_t) _image_rom_end;
|
ulong_t rom_end = (ulong_t) __rom_region_end;
|
||||||
#endif /* CONFIG_PMP_POWER_OF_TWO_ALIGNMENT */
|
#endif /* CONFIG_PMP_POWER_OF_TWO_ALIGNMENT */
|
||||||
index = 0U;
|
index = 0U;
|
||||||
uchar_pmpcfg = (unsigned char *) thread->arch.u_pmpcfg;
|
uchar_pmpcfg = (unsigned char *) thread->arch.u_pmpcfg;
|
||||||
|
|
|
@ -14,7 +14,7 @@ struct x86_memmap_exclusion x86_memmap_exclusions[] = {
|
||||||
{ "locore", _locore_start, _locore_end },
|
{ "locore", _locore_start, _locore_end },
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_XIP
|
#ifdef CONFIG_XIP
|
||||||
{ "rom", _image_rom_start, _image_rom_end },
|
{ "rom", __rom_region_start, __rom_region_end },
|
||||||
#endif
|
#endif
|
||||||
{ "ram", _image_ram_start, _image_ram_end },
|
{ "ram", _image_ram_start, _image_ram_end },
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
|
|
|
@ -23,7 +23,7 @@ vary:
|
||||||
- By default, the Present, Write, and Execute Disable bits are
|
- By default, the Present, Write, and Execute Disable bits are
|
||||||
set.
|
set.
|
||||||
- The _image_text region will have Present and User bits set
|
- The _image_text region will have Present and User bits set
|
||||||
- The _image_rodata region will have Present, User, and Execute
|
- The __rodata_region region will have Present, User, and Execute
|
||||||
Disable bits set
|
Disable bits set
|
||||||
- On x86_64, the _locore region will have Present set and
|
- On x86_64, the _locore region will have Present set and
|
||||||
the _lorodata region will have Present and Execute Disable set.
|
the _lorodata region will have Present and Execute Disable set.
|
||||||
|
@ -878,7 +878,7 @@ def main():
|
||||||
if is_generic_section_present:
|
if is_generic_section_present:
|
||||||
flags = flags | FLAG_P
|
flags = flags | FLAG_P
|
||||||
|
|
||||||
pt.set_region_perms("_image_rodata", flags)
|
pt.set_region_perms("__rodata_region", flags)
|
||||||
|
|
||||||
if isdef("CONFIG_LINKER_USE_BOOT_SECTION"):
|
if isdef("CONFIG_LINKER_USE_BOOT_SECTION"):
|
||||||
pt.set_region_perms("lnkr_boot_rodata", flags | FLAG_P)
|
pt.set_region_perms("lnkr_boot_rodata", flags | FLAG_P)
|
||||||
|
|
|
@ -590,7 +590,7 @@ SECTIONS
|
||||||
|
|
||||||
_image_text_end = .;
|
_image_text_end = .;
|
||||||
_image_text_size = _image_text_end - _image_text_start;
|
_image_text_size = _image_text_end - _image_text_start;
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#ifndef CONFIG_LINKER_USE_PINNED_SECTION
|
#ifndef CONFIG_LINKER_USE_PINNED_SECTION
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
|
@ -623,8 +623,8 @@ SECTIONS
|
||||||
|
|
||||||
MMU_PAGE_ALIGN_PERM
|
MMU_PAGE_ALIGN_PERM
|
||||||
/* ROM ends here, position counter will now be in RAM areas */
|
/* ROM ends here, position counter will now be in RAM areas */
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rodata_size = _image_rodata_end - _image_rodata_start;
|
__rodata_region_size = __rodata_region_end - __rodata_region_start;
|
||||||
GROUP_END(ROMABLE_REGION)
|
GROUP_END(ROMABLE_REGION)
|
||||||
/*
|
/*
|
||||||
* Needed for dynamic linking which we do not have, do discard
|
* Needed for dynamic linking which we do not have, do discard
|
||||||
|
|
|
@ -74,7 +74,7 @@ SECTIONS {
|
||||||
GROUP_START(ROMABLE_REGION)
|
GROUP_START(ROMABLE_REGION)
|
||||||
|
|
||||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,ALIGN(1024)) {
|
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,ALIGN(1024)) {
|
||||||
_image_rom_start = .;
|
__rom_region_start = .;
|
||||||
_image_text_start = .;
|
_image_text_start = .;
|
||||||
|
|
||||||
/* Located in generated directory. This file is populated by the
|
/* Located in generated directory. This file is populated by the
|
||||||
|
@ -96,7 +96,7 @@ SECTIONS {
|
||||||
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
|
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
|
||||||
|
|
||||||
_image_text_end = .;
|
_image_text_end = .;
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
@ -127,10 +127,10 @@ SECTIONS {
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
#endif /* __MWDT_LINKER_CMD__ */
|
#endif /* __MWDT_LINKER_CMD__ */
|
||||||
|
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
MPU_ALIGN(_image_rodata_end - _image_rom_start);
|
MPU_ALIGN(__rodata_region_end - __rom_region_start);
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
_image_rom_size = _image_rom_end - _image_rom_start;
|
__rom_region_size = __rom_region_end - __rom_region_start;
|
||||||
|
|
||||||
GROUP_END(ROMABLE_REGION)
|
GROUP_END(ROMABLE_REGION)
|
||||||
|
|
||||||
|
|
|
@ -103,9 +103,9 @@ SECTIONS
|
||||||
GROUP_START(ROMABLE_REGION)
|
GROUP_START(ROMABLE_REGION)
|
||||||
|
|
||||||
#if defined(CONFIG_XIP)
|
#if defined(CONFIG_XIP)
|
||||||
_image_rom_start = ROM_ADDR;
|
__rom_region_start = ROM_ADDR;
|
||||||
#else
|
#else
|
||||||
_image_rom_start = RAM_ADDR;
|
__rom_region_start = RAM_ADDR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SECTION_PROLOGUE(rom_start,,)
|
SECTION_PROLOGUE(rom_start,,)
|
||||||
|
@ -170,7 +170,7 @@ SECTIONS
|
||||||
__exidx_end = .;
|
__exidx_end = .;
|
||||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||||
|
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
@ -208,7 +208,7 @@ SECTIONS
|
||||||
MPU_ALIGN(ABSOLUTE(.) - _image_rom_start);
|
MPU_ALIGN(ABSOLUTE(.) - _image_rom_start);
|
||||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||||
|
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rom_end = .;
|
_image_rom_end = .;
|
||||||
_image_rom_end_order = (LOG2CEIL(_image_rom_end) - 1) << 1;
|
_image_rom_end_order = (LOG2CEIL(_image_rom_end) - 1) << 1;
|
||||||
|
|
||||||
|
@ -345,6 +345,6 @@ SECTIONS
|
||||||
|
|
||||||
/* To provide the image size as a const expression,
|
/* To provide the image size as a const expression,
|
||||||
* calculate this value here. */
|
* calculate this value here. */
|
||||||
_flash_used = LOADADDR(.last_section) - _image_rom_start;
|
_flash_used = LOADADDR(.last_section) - __rom_region_start;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ SECTIONS
|
||||||
|
|
||||||
GROUP_START(ROMABLE_REGION)
|
GROUP_START(ROMABLE_REGION)
|
||||||
|
|
||||||
_image_rom_start = ROM_ADDR;
|
__rom_region_start = ROM_ADDR;
|
||||||
|
|
||||||
SECTION_PROLOGUE(rom_start,,)
|
SECTION_PROLOGUE(rom_start,,)
|
||||||
{
|
{
|
||||||
|
@ -189,7 +189,7 @@ SECTIONS
|
||||||
__exidx_end = .;
|
__exidx_end = .;
|
||||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||||
|
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
@ -222,9 +222,9 @@ SECTIONS
|
||||||
|
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
|
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
MPU_ALIGN(_image_rodata_end -_image_rom_start);
|
MPU_ALIGN(__rodata_region_end -__rom_region_start);
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
|
|
||||||
GROUP_END(ROMABLE_REGION)
|
GROUP_END(ROMABLE_REGION)
|
||||||
|
|
||||||
|
@ -460,6 +460,6 @@ SECTION_PROLOGUE(.last_section,(NOLOAD),)
|
||||||
|
|
||||||
/* To provide the image size as a const expression,
|
/* To provide the image size as a const expression,
|
||||||
* calculate this value here. */
|
* calculate this value here. */
|
||||||
_flash_used = LOADADDR(.last_section) - _image_rom_start;
|
_flash_used = LOADADDR(.last_section) - __rom_region_start;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ SECTIONS
|
||||||
|
|
||||||
GROUP_START(ROMABLE_REGION)
|
GROUP_START(ROMABLE_REGION)
|
||||||
|
|
||||||
_image_rom_start = ROM_ADDR;
|
__rom_region_start = ROM_ADDR;
|
||||||
|
|
||||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ SECTIONS
|
||||||
__exidx_end = .;
|
__exidx_end = .;
|
||||||
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||||
|
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
@ -179,9 +179,9 @@ SECTIONS
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
MMU_ALIGN;
|
MMU_ALIGN;
|
||||||
|
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rodata_size = _image_rodata_end - _image_rodata_start;
|
__rodata_region_size = __rodata_region_end - __rodata_region_start;
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are here according to 'arm-zephyr-elf-ld --verbose',
|
* These are here according to 'arm-zephyr-elf-ld --verbose',
|
||||||
|
@ -317,6 +317,6 @@ SECTIONS
|
||||||
|
|
||||||
/* To provide the image size as a const expression,
|
/* To provide the image size as a const expression,
|
||||||
* calculate this value here. */
|
* calculate this value here. */
|
||||||
_flash_used = LOADADDR(.last_section) - _image_rom_start;
|
_flash_used = LOADADDR(.last_section) - __rom_region_start;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,10 +155,10 @@ SECTIONS
|
||||||
|
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
|
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rodata_size = _image_rodata_end - _image_rodata_start;
|
__rodata_region_size = __rodata_region_end - __rodata_region_start;
|
||||||
|
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
__data_region_load_start = ALIGN(4); /* XIP imaged DATA ROM start addr */
|
__data_region_load_start = ALIGN(4); /* XIP imaged DATA ROM start addr */
|
||||||
|
|
||||||
GROUP_END(ROMABLE_REGION)
|
GROUP_END(ROMABLE_REGION)
|
||||||
|
|
|
@ -111,7 +111,7 @@ SECTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
GROUP_START(ROMABLE_REGION)
|
GROUP_START(ROMABLE_REGION)
|
||||||
_image_rom_start = ROM_BASE;
|
__rom_region_start = ROM_BASE;
|
||||||
|
|
||||||
SECTION_PROLOGUE(_VECTOR_SECTION_NAME,,)
|
SECTION_PROLOGUE(_VECTOR_SECTION_NAME,,)
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ SECTIONS
|
||||||
|
|
||||||
_image_text_end = .;
|
_image_text_end = .;
|
||||||
|
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
|
||||||
|
@ -186,8 +186,8 @@ SECTIONS
|
||||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||||
|
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
MPU_ALIGN(_image_rodata_end - _image_rom_start);
|
MPU_ALIGN(__rodata_region_end - __rom_region_start);
|
||||||
GROUP_END(ROMABLE_REGION)
|
GROUP_END(ROMABLE_REGION)
|
||||||
|
|
||||||
GROUP_START(RAMABLE_REGION)
|
GROUP_START(RAMABLE_REGION)
|
||||||
|
@ -369,7 +369,7 @@ SECTION_PROLOGUE(.last_section,(NOLOAD),)
|
||||||
|
|
||||||
/* To provide the image size as a const expression,
|
/* To provide the image size as a const expression,
|
||||||
* calculate this value here. */
|
* calculate this value here. */
|
||||||
_image_rom_end = LOADADDR(.last_section);
|
__rom_region_end = LOADADDR(.last_section);
|
||||||
_image_rom_size = _image_rom_end - _image_rom_start;
|
__rom_region_size = __rom_region_end - __rom_region_start;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ SECTIONS
|
||||||
|
|
||||||
#include <linker/rel-sections.ld>
|
#include <linker/rel-sections.ld>
|
||||||
|
|
||||||
_image_rom_start = .;
|
__rom_region_start = .;
|
||||||
|
|
||||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ SECTIONS
|
||||||
} GROUP_LINK_IN(REGION_TEXT)
|
} GROUP_LINK_IN(REGION_TEXT)
|
||||||
|
|
||||||
_image_text_end = .;
|
_image_text_end = .;
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
@ -62,10 +62,10 @@ SECTIONS
|
||||||
|
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
|
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rodata_size = _image_rodata_end - _image_rodata_start;
|
__rodata_region_size = __rodata_region_end - __rodata_region_start;
|
||||||
|
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
|
|
||||||
__data_region_load_start = .;
|
__data_region_load_start = .;
|
||||||
__data_region_start = .;
|
__data_region_start = .;
|
||||||
|
|
|
@ -289,7 +289,7 @@ SECTIONS
|
||||||
. = ALIGN(8);
|
. = ALIGN(8);
|
||||||
|
|
||||||
#ifdef CONFIG_XIP
|
#ifdef CONFIG_XIP
|
||||||
_image_rom_start = PHYS_LOAD_ADDR;
|
__rom_region_start = PHYS_LOAD_ADDR;
|
||||||
#endif
|
#endif
|
||||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +329,7 @@ SECTIONS
|
||||||
|
|
||||||
_image_text_end = .;
|
_image_text_end = .;
|
||||||
_image_text_size = _image_text_end - _image_text_start;
|
_image_text_size = _image_text_end - _image_text_start;
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#ifndef CONFIG_LINKER_USE_PINNED_SECTION
|
#ifndef CONFIG_LINKER_USE_PINNED_SECTION
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
|
@ -363,11 +363,11 @@ SECTIONS
|
||||||
MMU_PAGE_ALIGN_PERM
|
MMU_PAGE_ALIGN_PERM
|
||||||
/* ROM ends here, position counter will now be in RAM areas */
|
/* ROM ends here, position counter will now be in RAM areas */
|
||||||
#ifdef CONFIG_XIP
|
#ifdef CONFIG_XIP
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
_image_rom_size = _image_rom_end - _image_rom_start;
|
__rom_region_size = __rom_region_end - __rom_region_start;
|
||||||
#endif
|
#endif
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rodata_size = _image_rodata_end - _image_rodata_start;
|
__rodata_region_size = __rodata_region_end - __rodata_region_start;
|
||||||
GROUP_END(ROMABLE_REGION)
|
GROUP_END(ROMABLE_REGION)
|
||||||
/*
|
/*
|
||||||
* Needed for dynamic linking which we do not have, do discard
|
* Needed for dynamic linking which we do not have, do discard
|
||||||
|
|
|
@ -88,7 +88,7 @@ SECTIONS
|
||||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||||
{
|
{
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_image_rom_start = .;
|
__rom_region_start = .;
|
||||||
_image_text_start = .;
|
_image_text_start = .;
|
||||||
z_mapped_start = .;
|
z_mapped_start = .;
|
||||||
*(.text)
|
*(.text)
|
||||||
|
@ -101,7 +101,7 @@ SECTIONS
|
||||||
|
|
||||||
_image_text_end = .;
|
_image_text_end = .;
|
||||||
_image_text_size = _image_text_end - _image_text_start;
|
_image_text_size = _image_text_end - _image_text_start;
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
@ -128,9 +128,9 @@ SECTIONS
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
|
|
||||||
MMU_PAGE_ALIGN_PERM
|
MMU_PAGE_ALIGN_PERM
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rodata_size = _image_rodata_end - _image_rodata_start;
|
__rodata_region_size = __rodata_region_end - __rodata_region_start;
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
|
|
||||||
#ifdef CONFIG_USERSPACE
|
#ifdef CONFIG_USERSPACE
|
||||||
/* APP SHARED MEMORY REGION */
|
/* APP SHARED MEMORY REGION */
|
||||||
|
|
|
@ -236,9 +236,9 @@ extern char z_mapped_end[];
|
||||||
#endif /* CONFIG_MMU */
|
#endif /* CONFIG_MMU */
|
||||||
|
|
||||||
/* Includes text and rodata */
|
/* Includes text and rodata */
|
||||||
extern char _image_rom_start[];
|
extern char __rom_region_start[];
|
||||||
extern char _image_rom_end[];
|
extern char __rom_region_end[];
|
||||||
extern char _image_rom_size[];
|
extern char __rom_region_size[];
|
||||||
|
|
||||||
/* Includes all ROMable data, i.e. the size of the output image file. */
|
/* Includes all ROMable data, i.e. the size of the output image file. */
|
||||||
extern char _flash_used[];
|
extern char _flash_used[];
|
||||||
|
@ -251,9 +251,9 @@ extern char _image_text_start[];
|
||||||
extern char _image_text_end[];
|
extern char _image_text_end[];
|
||||||
extern char _image_text_size[];
|
extern char _image_text_size[];
|
||||||
|
|
||||||
extern char _image_rodata_start[];
|
extern char __rodata_region_start[];
|
||||||
extern char _image_rodata_end[];
|
extern char __rodata_region_end[];
|
||||||
extern char _image_rodata_size[];
|
extern char __rodata_region_size[];
|
||||||
|
|
||||||
extern char _vector_start[];
|
extern char _vector_start[];
|
||||||
extern char _vector_end[];
|
extern char _vector_end[];
|
||||||
|
|
|
@ -32,10 +32,10 @@ static inline bool ptr_in_rodata(const char *addr)
|
||||||
#elif defined(CONFIG_ARC) || defined(CONFIG_ARM) || defined(CONFIG_X86) \
|
#elif defined(CONFIG_ARC) || defined(CONFIG_ARM) || defined(CONFIG_X86) \
|
||||||
|| defined(CONFIG_RISCV) || defined(CONFIG_ARM64) \
|
|| defined(CONFIG_RISCV) || defined(CONFIG_ARM64) \
|
||||||
|| defined(CONFIG_NIOS2)
|
|| defined(CONFIG_NIOS2)
|
||||||
extern char _image_rodata_start[];
|
extern char __rodata_region_start[];
|
||||||
extern char _image_rodata_end[];
|
extern char __rodata_region_end[];
|
||||||
#define RO_START _image_rodata_start
|
#define RO_START __rodata_region_start
|
||||||
#define RO_END _image_rodata_end
|
#define RO_END __rodata_region_end
|
||||||
#elif defined(CONFIG_XTENSA)
|
#elif defined(CONFIG_XTENSA)
|
||||||
extern char _rodata_start[];
|
extern char _rodata_start[];
|
||||||
extern char _rodata_end[];
|
extern char _rodata_end[];
|
||||||
|
|
|
@ -27,8 +27,8 @@ static const struct arm_mpu_region mpu_regions[] = {
|
||||||
|
|
||||||
/* Region 2 zephyr rodata */
|
/* Region 2 zephyr rodata */
|
||||||
MPU_REGION_ENTRY("SRAM_1",
|
MPU_REGION_ENTRY("SRAM_1",
|
||||||
(uintptr_t)_image_rodata_start,
|
(uintptr_t)__rodata_region_start,
|
||||||
(uintptr_t)_image_rodata_end,
|
(uintptr_t)__rodata_region_end,
|
||||||
REGION_RAM_RO_ATTR),
|
REGION_RAM_RO_ATTR),
|
||||||
|
|
||||||
/* Region 3 zephyr data */
|
/* Region 3 zephyr data */
|
||||||
|
|
|
@ -238,7 +238,7 @@ SECTIONS
|
||||||
.flash.rodata : ALIGN(0x10)
|
.flash.rodata : ALIGN(0x10)
|
||||||
{
|
{
|
||||||
_rodata_start = ABSOLUTE(.);
|
_rodata_start = ABSOLUTE(.);
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
__esp_shell_root_cmds_start = .;
|
__esp_shell_root_cmds_start = .;
|
||||||
KEEP(*(SORT(.shell_root_cmd_*)));
|
KEEP(*(SORT(.shell_root_cmd_*)));
|
||||||
__esp_shell_root_cmds_end = .;
|
__esp_shell_root_cmds_end = .;
|
||||||
|
@ -285,7 +285,7 @@ SECTIONS
|
||||||
*(.xt_except_desc_end)
|
*(.xt_except_desc_end)
|
||||||
*(.dynamic)
|
*(.dynamic)
|
||||||
*(.gnu.version_d)
|
*(.gnu.version_d)
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_rodata_end = ABSOLUTE(.);
|
_rodata_end = ABSOLUTE(.);
|
||||||
/* Literals are also RO data. */
|
/* Literals are also RO data. */
|
||||||
_lit4_start = ABSOLUTE(.);
|
_lit4_start = ABSOLUTE(.);
|
||||||
|
|
|
@ -99,7 +99,7 @@ SECTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
GROUP_START(ROM)
|
GROUP_START(ROM)
|
||||||
_image_rom_start = ROM_BASE;
|
__rom_region_start = ROM_BASE;
|
||||||
|
|
||||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,7 @@ SECTIONS
|
||||||
|
|
||||||
_image_text_end = .;
|
_image_text_end = .;
|
||||||
|
|
||||||
_image_rodata_start = .;
|
__rodata_region_start = .;
|
||||||
|
|
||||||
#include <linker/common-rom.ld>
|
#include <linker/common-rom.ld>
|
||||||
#include <linker/thread-local-storage.ld>
|
#include <linker/thread-local-storage.ld>
|
||||||
|
@ -142,8 +142,8 @@ SECTIONS
|
||||||
|
|
||||||
#include <linker/cplusplus-rom.ld>
|
#include <linker/cplusplus-rom.ld>
|
||||||
|
|
||||||
_image_rodata_end = .;
|
__rodata_region_end = .;
|
||||||
_image_rom_end = .;
|
__rom_region_end = .;
|
||||||
|
|
||||||
#ifndef CONFIG_BOOTLOADER_MCUBOOT
|
#ifndef CONFIG_BOOTLOADER_MCUBOOT
|
||||||
/* The vector table goes into core-dependent flash locations. */
|
/* The vector table goes into core-dependent flash locations. */
|
||||||
|
|
|
@ -402,7 +402,7 @@ SECTIONS
|
||||||
|
|
||||||
.ResetVector.text : ALIGN(4)
|
.ResetVector.text : ALIGN(4)
|
||||||
{
|
{
|
||||||
_image_rom_start = ABSOLUTE(.);
|
__rom_region_start = ABSOLUTE(.);
|
||||||
_ResetVector_text_start = ABSOLUTE(.);
|
_ResetVector_text_start = ABSOLUTE(.);
|
||||||
KEEP (*(.ResetVector.text))
|
KEEP (*(.ResetVector.text))
|
||||||
_ResetVector_text_end = ABSOLUTE(.);
|
_ResetVector_text_end = ABSOLUTE(.);
|
||||||
|
@ -422,7 +422,7 @@ SECTIONS
|
||||||
*(.srom.literal .srom.text)
|
*(.srom.literal .srom.text)
|
||||||
_srom_text_end = ABSOLUTE(.);
|
_srom_text_end = ABSOLUTE(.);
|
||||||
_memmap_seg_srom1_end = ALIGN(0x8);
|
_memmap_seg_srom1_end = ALIGN(0x8);
|
||||||
_image_rom_end = ABSOLUTE(.);
|
__rom_region_end = ABSOLUTE(.);
|
||||||
} >srom1_seg :srom1_phdr
|
} >srom1_seg :srom1_phdr
|
||||||
|
|
||||||
.sram.rodata : ALIGN(4)
|
.sram.rodata : ALIGN(4)
|
||||||
|
|
|
@ -156,10 +156,10 @@ static bool is_rodata(const void *addr)
|
||||||
#if defined(CONFIG_ARM) || defined(CONFIG_ARC) || defined(CONFIG_X86) || \
|
#if defined(CONFIG_ARM) || defined(CONFIG_ARC) || defined(CONFIG_X86) || \
|
||||||
defined(CONFIG_ARM64) || defined(CONFIG_NIOS2) || \
|
defined(CONFIG_ARM64) || defined(CONFIG_NIOS2) || \
|
||||||
defined(CONFIG_RISCV) || defined(CONFIG_SPARC)
|
defined(CONFIG_RISCV) || defined(CONFIG_SPARC)
|
||||||
extern const char *_image_rodata_start[];
|
extern const char *__rodata_region_start[];
|
||||||
extern const char *_image_rodata_end[];
|
extern const char *__rodata_region_end[];
|
||||||
#define RO_START _image_rodata_start
|
#define RO_START __rodata_region_start
|
||||||
#define RO_END _image_rodata_end
|
#define RO_END __rodata_region_end
|
||||||
#elif defined(CONFIG_XTENSA)
|
#elif defined(CONFIG_XTENSA)
|
||||||
extern const char *_rodata_start[];
|
extern const char *_rodata_start[];
|
||||||
extern const char *_rodata_end[];
|
extern const char *_rodata_end[];
|
||||||
|
|
|
@ -99,7 +99,7 @@ void test_ram_perms(void)
|
||||||
expected = MMU_P | MMU_RW;
|
expected = MMU_P | MMU_RW;
|
||||||
} else if (IN_REGION(_image_text, pos)) {
|
} else if (IN_REGION(_image_text, pos)) {
|
||||||
expected = MMU_P | MMU_US;
|
expected = MMU_P | MMU_US;
|
||||||
} else if (IN_REGION(_image_rodata, pos)) {
|
} else if (IN_REGION(__rodata_region, pos)) {
|
||||||
expected = MMU_P | MMU_US | MMU_XD;
|
expected = MMU_P | MMU_US | MMU_XD;
|
||||||
#ifdef CONFIG_COVERAGE_GCOV
|
#ifdef CONFIG_COVERAGE_GCOV
|
||||||
} else if (IN_REGION(__gcov_bss, pos)) {
|
} else if (IN_REGION(__gcov_bss, pos)) {
|
||||||
|
|
|
@ -293,8 +293,8 @@ static void test_write_kernro(void)
|
||||||
/* Try to write to kernel RO. */
|
/* Try to write to kernel RO. */
|
||||||
const char *const ptr = (const char *const)&_k_neg_eagain;
|
const char *const ptr = (const char *const)&_k_neg_eagain;
|
||||||
|
|
||||||
in_rodata = ptr < _image_rodata_end &&
|
in_rodata = ptr < __rodata_region_end &&
|
||||||
ptr >= _image_rodata_start;
|
ptr >= __rodata_region_start;
|
||||||
|
|
||||||
#ifdef CONFIG_LINKER_USE_PINNED_SECTION
|
#ifdef CONFIG_LINKER_USE_PINNED_SECTION
|
||||||
if (!in_rodata) {
|
if (!in_rodata) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue