1/*
2 * Copyright (c) 2017-2020, ARM Limited and Contributors. All rights reserved.
3 *
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__ = .;
15	    *(*text.init*);
16            __INIT_CODE_END__ = .;
17            INIT_CODE_END_ALIGNED = ALIGN(PAGE_SIZE);
18        } >RAM
19
20#ifdef BL31_PROGBITS_LIMIT
21    ASSERT(__INIT_CODE_END__ <= BL31_PROGBITS_LIMIT,
22            "BL31 init has exceeded progbits limit.")
23#endif
24}
25
26#define	ABS		ABSOLUTE
27
28#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);					\
41	}
42
43#endif /* ARM_RECLAIM_INIT_LD_S */
44