blob: 788e9ff567bdc13b667ec8639263944da69a7f9d [file] [log] [blame]
Daniel Boulbycb4adb02018-09-18 11:52:49 +01001/*
Manish Pandey6c87abd2022-05-11 15:43:54 +01002 * Copyright (c) 2017-2022, ARM Limited and Contributors. All rights reserved.
Daniel Boulbycb4adb02018-09-18 11:52:49 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6#ifndef ARM_RECLAIM_INIT_LD_S
7#define ARM_RECLAIM_INIT_LD_S
8
9SECTIONS
10{
11 .init __STACKS_START__ : {
12 . = . + PLATFORM_STACK_SIZE;
13 . = ALIGN(PAGE_SIZE);
14 __INIT_CODE_START__ = .;
Manish Pandey6c87abd2022-05-11 15:43:54 +010015 *(*text.init.*);
Daniel Boulbycb4adb02018-09-18 11:52:49 +010016 __INIT_CODE_END__ = .;
David Horstmann3ed56062020-10-14 15:17:49 +010017 INIT_CODE_END_ALIGNED = ALIGN(PAGE_SIZE);
Daniel Boulbycb4adb02018-09-18 11:52:49 +010018 } >RAM
19
20#ifdef BL31_PROGBITS_LIMIT
21 ASSERT(__INIT_CODE_END__ <= BL31_PROGBITS_LIMIT,
22 "BL31 init has exceeded progbits limit.")
23#endif
Daniel Boulbycb4adb02018-09-18 11:52:49 +010024}
25
Alexei Fedorov34dd1e92020-05-30 17:33:26 +010026#define ABS ABSOLUTE
Alexei Fedorov34dd1e92020-05-30 17:33:26 +010027
David Horstmann3ed56062020-10-14 15:17:49 +010028#define STACK_SECTION \
29 stacks (NOLOAD) : { \
30 __STACKS_START__ = .; \
31 *(tzfw_normal_stacks) \
32 __STACKS_END__ = .; \
33 /* Allow room for the init section where necessary. */ \
34 OFFSET = ABS(SIZEOF(.init) - (. - __STACKS_START__)); \
35 /* Offset sign */ \
36 SIGN = ABS(OFFSET) & (1 << 63); \
37 /* Offset mask */ \
38 MASK = ABS(SIGN >> 63) - 1; \
39 . += ABS(OFFSET) & ABS(MASK); \
40 . = ALIGN(PAGE_SIZE); \
Alexei Fedorov34dd1e92020-05-30 17:33:26 +010041 }
David Horstmann3ed56062020-10-14 15:17:49 +010042
Daniel Boulbycb4adb02018-09-18 11:52:49 +010043#endif /* ARM_RECLAIM_INIT_LD_S */