xref: /openbmc/u-boot/arch/arm/cpu/armv8/u-boot.lds (revision f77d4410)
1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * (C) Copyright 2013
4 * David Feng <fenghua@phytium.com.cn>
5 *
6 * (C) Copyright 2002
7 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
8 */
9
10#include <config.h>
11#include <asm/psci.h>
12
13OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
14OUTPUT_ARCH(aarch64)
15ENTRY(_start)
16SECTIONS
17{
18#ifdef CONFIG_ARMV8_SECURE_BASE
19	/DISCARD/ : { *(.rela._secure*) }
20#endif
21	. = 0x00000000;
22
23	. = ALIGN(8);
24	.text :
25	{
26		*(.__image_copy_start)
27		CPUDIR/start.o (.text*)
28	}
29
30	/* This needs to come before *(.text*) */
31	.efi_runtime : {
32                __efi_runtime_start = .;
33		*(.text.efi_runtime*)
34		*(.rodata.efi_runtime*)
35		*(.data.efi_runtime*)
36                __efi_runtime_stop = .;
37	}
38
39	.text_rest :
40	{
41		*(.text*)
42	}
43
44#ifdef CONFIG_ARMV8_PSCI
45	.__secure_start :
46#ifndef CONFIG_ARMV8_SECURE_BASE
47		ALIGN(CONSTANT(COMMONPAGESIZE))
48#endif
49	{
50		KEEP(*(.__secure_start))
51	}
52
53#ifndef CONFIG_ARMV8_SECURE_BASE
54#define CONFIG_ARMV8_SECURE_BASE
55#define __ARMV8_PSCI_STACK_IN_RAM
56#endif
57	.secure_text CONFIG_ARMV8_SECURE_BASE :
58		AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
59	{
60		*(._secure.text)
61	}
62
63	.secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
64	{
65		*(._secure.data)
66	}
67
68	.secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
69			    CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
70#ifdef __ARMV8_PSCI_STACK_IN_RAM
71		AT(ADDR(.secure_stack))
72#else
73		AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
74#endif
75	{
76		KEEP(*(.__secure_stack_start))
77
78		. = . + CONFIG_ARMV8_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
79
80		. = ALIGN(CONSTANT(COMMONPAGESIZE));
81
82		KEEP(*(.__secure_stack_end))
83	}
84
85#ifndef __ARMV8_PSCI_STACK_IN_RAM
86	. = LOADADDR(.secure_stack);
87#endif
88
89	.__secure_end : AT(ADDR(.__secure_end)) {
90		KEEP(*(.__secure_end))
91		LONG(0x1d1071c);	/* Must output something to reset LMA */
92	}
93#endif
94
95	. = ALIGN(8);
96	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
97
98	. = ALIGN(8);
99	.data : {
100		*(.data*)
101	}
102
103	. = ALIGN(8);
104
105	. = .;
106
107	. = ALIGN(8);
108	.u_boot_list : {
109		KEEP(*(SORT(.u_boot_list*)));
110	}
111
112	. = ALIGN(8);
113
114	.efi_runtime_rel : {
115                __efi_runtime_rel_start = .;
116		*(.rel*.efi_runtime)
117		*(.rel*.efi_runtime.*)
118                __efi_runtime_rel_stop = .;
119	}
120
121	. = ALIGN(8);
122
123	.image_copy_end :
124	{
125		*(.__image_copy_end)
126	}
127
128	. = ALIGN(8);
129
130	.rel_dyn_start :
131	{
132		*(.__rel_dyn_start)
133	}
134
135	.rela.dyn : {
136		*(.rela*)
137	}
138
139	.rel_dyn_end :
140	{
141		*(.__rel_dyn_end)
142	}
143
144	_end = .;
145
146	. = ALIGN(8);
147
148	.bss_start : {
149		KEEP(*(.__bss_start));
150	}
151
152	.bss : {
153		*(.bss*)
154		 . = ALIGN(8);
155	}
156
157	.bss_end : {
158		KEEP(*(.__bss_end));
159	}
160
161	/DISCARD/ : { *(.dynsym) }
162	/DISCARD/ : { *(.dynstr*) }
163	/DISCARD/ : { *(.dynamic*) }
164	/DISCARD/ : { *(.plt*) }
165	/DISCARD/ : { *(.interp*) }
166	/DISCARD/ : { *(.gnu*) }
167
168#ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER
169#include "linux-kernel-image-header-vars.h"
170#endif
171}
172