blob: a77c9645358a07c44ffb6d98931237e7f2f85767 [file] [log] [blame]
Daniel Boulbyb1b058d2018-09-18 11:52:49 +01001/*
Chris Kay33bfc5e2023-02-14 11:30:04 +00002 * Copyright (c) 2017-2023, Arm Limited and Contributors. All rights reserved.
Daniel Boulbyb1b058d2018-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 Pandey20db9bf2022-05-11 15:43:54 +010015 *(*text.init.*);
Daniel Boulbyb1b058d2018-09-18 11:52:49 +010016 __INIT_CODE_END__ = .;
David Horstmann8f15ca32020-10-14 15:17:49 +010017 INIT_CODE_END_ALIGNED = ALIGN(PAGE_SIZE);
Daniel Boulbyb1b058d2018-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 Boulbyb1b058d2018-09-18 11:52:49 +010024}
25
Alexei Fedorov490ace72020-05-30 17:33:26 +010026#define ABS ABSOLUTE
Alexei Fedorov490ace72020-05-30 17:33:26 +010027
David Horstmann8f15ca32020-10-14 15:17:49 +010028#define STACK_SECTION \
Chris Kay33bfc5e2023-02-14 11:30:04 +000029 .stacks (NOLOAD) : { \
David Horstmann8f15ca32020-10-14 15:17:49 +010030 __STACKS_START__ = .; \
Chris Kay33bfc5e2023-02-14 11:30:04 +000031 *(.tzfw_normal_stacks) \
David Horstmann8f15ca32020-10-14 15:17:49 +010032 __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 Fedorov490ace72020-05-30 17:33:26 +010041 }
David Horstmann8f15ca32020-10-14 15:17:49 +010042
Daniel Boulbyb1b058d2018-09-18 11:52:49 +010043#endif /* ARM_RECLAIM_INIT_LD_S */