xref: /openbmc/u-boot/arch/arm/cpu/armv8/u-boot.lds (revision 78a88f79)
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		*(.text*)
29	}
30
31#ifdef CONFIG_ARMV8_PSCI
32	.__secure_start :
33#ifndef CONFIG_ARMV8_SECURE_BASE
34		ALIGN(CONSTANT(COMMONPAGESIZE))
35#endif
36	{
37		KEEP(*(.__secure_start))
38	}
39
40#ifndef CONFIG_ARMV8_SECURE_BASE
41#define CONFIG_ARMV8_SECURE_BASE
42#define __ARMV8_PSCI_STACK_IN_RAM
43#endif
44	.secure_text CONFIG_ARMV8_SECURE_BASE :
45		AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
46	{
47		*(._secure.text)
48	}
49
50	.secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
51	{
52		*(._secure.data)
53	}
54
55	.secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
56			    CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
57#ifdef __ARMV8_PSCI_STACK_IN_RAM
58		AT(ADDR(.secure_stack))
59#else
60		AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
61#endif
62	{
63		KEEP(*(.__secure_stack_start))
64
65		. = . + CONFIG_ARMV8_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
66
67		. = ALIGN(CONSTANT(COMMONPAGESIZE));
68
69		KEEP(*(.__secure_stack_end))
70	}
71
72#ifndef __ARMV8_PSCI_STACK_IN_RAM
73	. = LOADADDR(.secure_stack);
74#endif
75
76	.__secure_end : AT(ADDR(.__secure_end)) {
77		KEEP(*(.__secure_end))
78		LONG(0x1d1071c);	/* Must output something to reset LMA */
79	}
80#endif
81
82	. = ALIGN(8);
83	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
84
85	. = ALIGN(8);
86	.data : {
87		*(.data*)
88	}
89
90	. = ALIGN(8);
91
92	. = .;
93
94	. = ALIGN(8);
95	.u_boot_list : {
96		KEEP(*(SORT(.u_boot_list*)));
97	}
98
99	. = ALIGN(8);
100
101	.efi_runtime : {
102                __efi_runtime_start = .;
103		*(efi_runtime_text)
104		*(efi_runtime_data)
105                __efi_runtime_stop = .;
106	}
107
108	.efi_runtime_rel : {
109                __efi_runtime_rel_start = .;
110		*(.relaefi_runtime_text)
111		*(.relaefi_runtime_data)
112                __efi_runtime_rel_stop = .;
113	}
114
115	. = ALIGN(8);
116
117	.image_copy_end :
118	{
119		*(.__image_copy_end)
120	}
121
122	. = ALIGN(8);
123
124	.rel_dyn_start :
125	{
126		*(.__rel_dyn_start)
127	}
128
129	.rela.dyn : {
130		*(.rela*)
131	}
132
133	.rel_dyn_end :
134	{
135		*(.__rel_dyn_end)
136	}
137
138	_end = .;
139
140	. = ALIGN(8);
141
142	.bss_start : {
143		KEEP(*(.__bss_start));
144	}
145
146	.bss : {
147		*(.bss*)
148		 . = ALIGN(8);
149	}
150
151	.bss_end : {
152		KEEP(*(.__bss_end));
153	}
154
155	/DISCARD/ : { *(.dynsym) }
156	/DISCARD/ : { *(.dynstr*) }
157	/DISCARD/ : { *(.dynamic*) }
158	/DISCARD/ : { *(.plt*) }
159	/DISCARD/ : { *(.interp*) }
160	/DISCARD/ : { *(.gnu*) }
161
162#ifdef CONFIG_LINUX_KERNEL_IMAGE_HEADER
163#include "linux-kernel-image-header-vars.h"
164#endif
165}
166