linker: align _image_text_start/end/size linker symbols name
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_text_start and _image_text_end sometimes includes linker/kobject-text.ld. This mean there must be both the regular __text_start and __text_end symbols for the pure text section, as well as <group>_start and <group>_end symbols. The symbols describing the text region which covers more than just the text section itself will thus be changed to: _image_text_start -> __text_region_start _image_text_end -> __text_region_end Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
c6aded2dcb
commit
3d82c7c828
16 changed files with 39 additions and 39 deletions
|
@ -645,8 +645,8 @@ static const struct arm_mmu_flat_range mmu_zephyr_ranges[] = {
|
|||
|
||||
/* Mark text segment cacheable,read only and executable */
|
||||
{ .name = "zephyr_code",
|
||||
.start = _image_text_start,
|
||||
.end = _image_text_end,
|
||||
.start = __text_region_start,
|
||||
.end = __text_region_end,
|
||||
.attrs = MT_NORMAL | MT_P_RX_U_RX | MT_DEFAULT_SECURE_STATE },
|
||||
|
||||
/* Mark rodata segment cacheable, read only and execute-never */
|
||||
|
|
|
@ -22,7 +22,7 @@ If CONFIG_SRAM_REGION_PERMISSIONS is enabled, the access permissions
|
|||
vary:
|
||||
- By default, the Present, Write, and Execute Disable bits are
|
||||
set.
|
||||
- The _image_text region will have Present and User bits set
|
||||
- The __text_region region will have Present and User bits set
|
||||
- The __rodata_region region will have Present, User, and Execute
|
||||
Disable bits set
|
||||
- On x86_64, the _locore region will have Present set and
|
||||
|
@ -866,7 +866,7 @@ def main():
|
|||
if is_generic_section_present:
|
||||
flags = flags | FLAG_P
|
||||
|
||||
pt.set_region_perms("_image_text", flags)
|
||||
pt.set_region_perms("__text_region", flags)
|
||||
|
||||
if isdef("CONFIG_LINKER_USE_BOOT_SECTION"):
|
||||
pt.set_region_perms("lnkr_boot_text", flags | FLAG_P)
|
||||
|
|
|
@ -556,7 +556,7 @@ SECTIONS
|
|||
|
||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
#if !defined(CONFIG_LINKER_USE_BOOT_SECTION) || \
|
||||
!defined(CONFIG_LINKER_USE_PINNED_SECTION)
|
||||
|
@ -588,8 +588,8 @@ SECTIONS
|
|||
MMU_PAGE_ALIGN_PERM
|
||||
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
_image_text_size = _image_text_end - _image_text_start;
|
||||
__text_region_end = .;
|
||||
__text_region_size = __text_region_end - __text_region_start;
|
||||
__rodata_region_start = .;
|
||||
|
||||
#ifndef CONFIG_LINKER_USE_PINNED_SECTION
|
||||
|
|
|
@ -75,7 +75,7 @@ SECTIONS {
|
|||
|
||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,ALIGN(1024)) {
|
||||
__rom_region_start = .;
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
/* Located in generated directory. This file is populated by the
|
||||
* zephyr_linker_sources() Cmake function.
|
||||
|
@ -95,7 +95,7 @@ SECTIONS {
|
|||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
#endif /* CONFIG_CPLUSPLUS && !CONFIG_CPP_STATIC_INIT_GNU && __MWDT_LINKER_CMD__ */
|
||||
|
||||
_image_text_end = .;
|
||||
__text_region_end = .;
|
||||
__rodata_region_start = .;
|
||||
|
||||
#include <linker/common-rom.ld>
|
||||
|
|
|
@ -127,7 +127,7 @@ SECTIONS
|
|||
|
||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
#include <linker/kobject-text.ld>
|
||||
|
||||
|
@ -143,7 +143,7 @@ SECTIONS
|
|||
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
__text_region_end = .;
|
||||
|
||||
#if defined (CONFIG_CPLUSPLUS)
|
||||
SECTION_PROLOGUE(.ARM.extab,,)
|
||||
|
@ -205,12 +205,12 @@ SECTIONS
|
|||
* RODATA must be the last section so that the size of the entire read
|
||||
* only area will be filled to a power of 2.
|
||||
*/
|
||||
MPU_ALIGN(ABSOLUTE(.) - _image_rom_start);
|
||||
MPU_ALIGN(ABSOLUTE(.) - __rom_region_start);
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
__rodata_region_end = .;
|
||||
_image_rom_end = .;
|
||||
_image_rom_end_order = (LOG2CEIL(_image_rom_end) - 1) << 1;
|
||||
__rom_region_end = .;
|
||||
_image_rom_end_order = (LOG2CEIL(__rom_region_end) - 1) << 1;
|
||||
|
||||
GROUP_END(ROMABLE_REGION)
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ SECTIONS
|
|||
|
||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
#include <linker/kobject-text.ld>
|
||||
|
||||
|
@ -162,7 +162,7 @@ SECTIONS
|
|||
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
__text_region_end = .;
|
||||
|
||||
#if defined (CONFIG_CPLUSPLUS)
|
||||
SECTION_PROLOGUE(.ARM.extab,,)
|
||||
|
|
|
@ -93,7 +93,7 @@ SECTIONS
|
|||
|
||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
#ifndef CONFIG_XIP
|
||||
z_mapped_start = .;
|
||||
#endif
|
||||
|
@ -126,8 +126,8 @@ SECTIONS
|
|||
MMU_ALIGN;
|
||||
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
_image_text_size = _image_text_end - _image_text_start;
|
||||
__text_region_end = .;
|
||||
__text_region_size = __text_region_end - __text_region_start;
|
||||
|
||||
#if defined (CONFIG_CPLUSPLUS)
|
||||
SECTION_PROLOGUE(.ARM.extab,,)
|
||||
|
|
|
@ -145,7 +145,7 @@ SECTIONS
|
|||
KEEP(*(.openocd_debug))
|
||||
KEEP(*(".openocd_debug.*"))
|
||||
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
*(.text)
|
||||
*(".text.*")
|
||||
|
@ -161,7 +161,7 @@ SECTIONS
|
|||
#endif
|
||||
} GROUP_LINK_IN(ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
__text_region_end = .;
|
||||
|
||||
__rodata_region_start = .;
|
||||
#include <linker/common-rom.ld>
|
||||
|
|
|
@ -30,7 +30,7 @@ SECTIONS
|
|||
{
|
||||
/* Trap table alignment required by SPARC V8 specification. */
|
||||
. = ALIGN(0x1000);
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
*(.text.traptable)
|
||||
*(.text)
|
||||
|
@ -39,7 +39,7 @@ SECTIONS
|
|||
*(.gnu.linkonce.t.*)
|
||||
} GROUP_LINK_IN(REGION_TEXT)
|
||||
|
||||
_image_text_end = .;
|
||||
__text_region_end = .;
|
||||
__rodata_region_start = .;
|
||||
|
||||
#include <linker/common-rom.ld>
|
||||
|
|
|
@ -293,7 +293,7 @@ SECTIONS
|
|||
#endif
|
||||
SECTION_PROLOGUE(_TEXT_SECTION_NAME,,)
|
||||
{
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
#if !defined(CONFIG_LINKER_USE_BOOT_SECTION) || \
|
||||
!defined(CONFIG_LINKER_USE_PINNED_SECTION)
|
||||
|
@ -327,8 +327,8 @@ SECTIONS
|
|||
MMU_PAGE_ALIGN_PERM
|
||||
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
_image_text_size = _image_text_end - _image_text_start;
|
||||
__text_region_end = .;
|
||||
__text_region_size = __text_region_end - __text_region_start;
|
||||
__rodata_region_start = .;
|
||||
|
||||
#ifndef CONFIG_LINKER_USE_PINNED_SECTION
|
||||
|
|
|
@ -89,7 +89,7 @@ SECTIONS
|
|||
{
|
||||
. = ALIGN(16);
|
||||
__rom_region_start = .;
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
z_mapped_start = .;
|
||||
*(.text)
|
||||
*(.text.*)
|
||||
|
@ -99,8 +99,8 @@ SECTIONS
|
|||
MMU_PAGE_ALIGN_PERM
|
||||
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
|
||||
|
||||
_image_text_end = .;
|
||||
_image_text_size = _image_text_end - _image_text_start;
|
||||
__text_region_end = .;
|
||||
__text_region_size = __text_region_end - __text_region_start;
|
||||
__rodata_region_start = .;
|
||||
|
||||
#include <linker/common-rom.ld>
|
||||
|
|
|
@ -247,9 +247,9 @@ extern char _flash_used[];
|
|||
extern char _image_ram_start[];
|
||||
extern char _image_ram_end[];
|
||||
|
||||
extern char _image_text_start[];
|
||||
extern char _image_text_end[];
|
||||
extern char _image_text_size[];
|
||||
extern char __text_region_start[];
|
||||
extern char __text_region_end[];
|
||||
extern char __text_region_size[];
|
||||
|
||||
extern char __rodata_region_start[];
|
||||
extern char __rodata_region_end[];
|
||||
|
|
|
@ -21,8 +21,8 @@ static const struct arm_mpu_region mpu_regions[] = {
|
|||
|
||||
/* Region 1 zephyr text */
|
||||
MPU_REGION_ENTRY("SRAM_0",
|
||||
(uintptr_t)_image_text_start,
|
||||
(uintptr_t)_image_text_end,
|
||||
(uintptr_t)__text_region_start,
|
||||
(uintptr_t)__text_region_end,
|
||||
REGION_RAM_TEXT_ATTR),
|
||||
|
||||
/* Region 2 zephyr rodata */
|
||||
|
|
|
@ -110,14 +110,14 @@ SECTIONS
|
|||
*/
|
||||
#include <snippets-rom-start.ld>
|
||||
|
||||
_image_text_start = .;
|
||||
__text_region_start = .;
|
||||
|
||||
*(.text .text.*)
|
||||
*(.gnu.linkonce.t.*)
|
||||
*(.eh_frame)
|
||||
} GROUP_LINK_IN(ROM)
|
||||
|
||||
_image_text_end = .;
|
||||
__text_region_end = .;
|
||||
|
||||
__rodata_region_start = .;
|
||||
|
||||
|
|
|
@ -484,7 +484,7 @@ SECTIONS
|
|||
_sram_text_end = ABSOLUTE(.);
|
||||
} >sram0_seg :sram0_phdr
|
||||
|
||||
_image_text_start = ALIGN(4);
|
||||
__text_region_start = ALIGN(4);
|
||||
.text : ALIGN(4)
|
||||
{
|
||||
_stext = .;
|
||||
|
@ -499,7 +499,7 @@ SECTIONS
|
|||
_text_end = ABSOLUTE(.);
|
||||
_etext = .;
|
||||
} >sram0_seg :sram0_phdr
|
||||
_image_text_end = .;
|
||||
__text_region_end = .;
|
||||
|
||||
.sram.data : ALIGN(4)
|
||||
{
|
||||
|
|
|
@ -97,7 +97,7 @@ void test_ram_perms(void)
|
|||
|
||||
if (!IS_ENABLED(CONFIG_SRAM_REGION_PERMISSIONS)) {
|
||||
expected = MMU_P | MMU_RW;
|
||||
} else if (IN_REGION(_image_text, pos)) {
|
||||
} else if (IN_REGION(__text_region, pos)) {
|
||||
expected = MMU_P | MMU_US;
|
||||
} else if (IN_REGION(__rodata_region, pos)) {
|
||||
expected = MMU_P | MMU_US | MMU_XD;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue