blob: 717f65e2be968b53b80d07a4369eaff3919cdd0e [file] [log] [blame]
Daniel Boulbyb1b058d2018-09-18 11:52:49 +01001/*
Alexei Fedorov490ace72020-05-30 17:33:26 +01002 * Copyright (c) 2017-2020, 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__ = .;
Alexei Fedorov490ace72020-05-30 17:33:26 +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 \
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 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 */