mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-08-16 01:17:01 +02:00
When RECLAIM_INIT_CODE is enabled, functions with __init attribute can be reclaimed after boot and marked as Execute Never. Because of a bug in linker script the functions starting with "init" were also marked XN and causing instruction abort. Signed-off-by: Manish Pandey <manish.pandey2@arm.com> Change-Id: I2221973c05af170acf4e723cd44645b9ff9d58d2
44 lines
1.1 KiB
ArmAsm
44 lines
1.1 KiB
ArmAsm
/*
|
|
* Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
#ifndef ARM_RECLAIM_INIT_LD_S
|
|
#define ARM_RECLAIM_INIT_LD_S
|
|
|
|
SECTIONS
|
|
{
|
|
.init __STACKS_START__ : {
|
|
. = . + PLATFORM_STACK_SIZE;
|
|
. = ALIGN(PAGE_SIZE);
|
|
__INIT_CODE_START__ = .;
|
|
*(*text.init.*);
|
|
__INIT_CODE_END__ = .;
|
|
INIT_CODE_END_ALIGNED = ALIGN(PAGE_SIZE);
|
|
} >RAM
|
|
|
|
#ifdef BL31_PROGBITS_LIMIT
|
|
ASSERT(__INIT_CODE_END__ <= BL31_PROGBITS_LIMIT,
|
|
"BL31 init has exceeded progbits limit.")
|
|
#endif
|
|
}
|
|
|
|
#define ABS ABSOLUTE
|
|
|
|
#define STACK_SECTION \
|
|
stacks (NOLOAD) : { \
|
|
__STACKS_START__ = .; \
|
|
*(tzfw_normal_stacks) \
|
|
__STACKS_END__ = .; \
|
|
/* Allow room for the init section where necessary. */ \
|
|
OFFSET = ABS(SIZEOF(.init) - (. - __STACKS_START__)); \
|
|
/* Offset sign */ \
|
|
SIGN = ABS(OFFSET) & (1 << 63); \
|
|
/* Offset mask */ \
|
|
MASK = ABS(SIGN >> 63) - 1; \
|
|
. += ABS(OFFSET) & ABS(MASK); \
|
|
. = ALIGN(PAGE_SIZE); \
|
|
}
|
|
|
|
#endif /* ARM_RECLAIM_INIT_LD_S */
|