blob: 0a5fae6efccfbe46d3477cfbff15fd72c97782d7 [file] [log] [blame]
Simon Glassdde3b702012-02-23 03:28:41 +00001/*
2 * Copyright (c) 2004-2008 Texas Instruments
3 *
4 * (C) Copyright 2002
5 * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
6 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Simon Glassdde3b702012-02-23 03:28:41 +00008 */
9
Marc Zyngierbf433af2014-07-12 14:24:02 +010010#include <config.h>
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +080011#include <asm/psci.h>
Marc Zyngierbf433af2014-07-12 14:24:02 +010012
Simon Glassdde3b702012-02-23 03:28:41 +000013OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
14OUTPUT_ARCH(arm)
15ENTRY(_start)
16SECTIONS
17{
Simon Glassc1352112016-03-13 19:07:29 -060018#ifndef CONFIG_CMDLINE
19 /DISCARD/ : { *(.u_boot_list_2_cmd_*) }
20#endif
Wang Dongshengc5e954e2016-01-18 11:02:40 +080021#if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC)
Peng Fand47cb0b2015-10-23 10:13:03 +080022 /*
Wang Dongshengc5e954e2016-01-18 11:02:40 +080023 * If CONFIG_ARMV7_SECURE_BASE is true, secure code will not
24 * bundle with u-boot, and code offsets are fixed. Secure zone
25 * only needs to be copied from the loading address to
26 * CONFIG_ARMV7_SECURE_BASE, which is the linking and running
27 * address for secure code.
Peng Fand47cb0b2015-10-23 10:13:03 +080028 *
Wang Dongshengc5e954e2016-01-18 11:02:40 +080029 * If CONFIG_ARMV7_SECURE_BASE is undefined, the secure zone will
30 * be included in u-boot address space, and some absolute address
31 * were used in secure code. The absolute addresses of the secure
32 * code also needs to be relocated along with the accompanying u-boot
33 * code.
34 *
35 * So DISCARD is only for CONFIG_ARMV7_SECURE_BASE.
Peng Fand47cb0b2015-10-23 10:13:03 +080036 */
37 /DISCARD/ : { *(.rel._secure*) }
Wang Dongshengc5e954e2016-01-18 11:02:40 +080038#endif
Simon Glassdde3b702012-02-23 03:28:41 +000039 . = 0x00000000;
40
41 . = ALIGN(4);
42 .text :
43 {
Albert ARIBAUDd026dec2013-06-11 14:17:33 +020044 *(.__image_copy_start)
Albert ARIBAUD41623c92014-04-15 16:13:51 +020045 *(.vectors)
Stephen Warrenb68d6712012-10-22 06:19:32 +000046 CPUDIR/start.o (.text*)
47 *(.text*)
Simon Glassdde3b702012-02-23 03:28:41 +000048 }
49
Jan Kiszka104d6fb2015-04-21 07:18:24 +020050#ifdef CONFIG_ARMV7_NONSEC
Marc Zyngierbf433af2014-07-12 14:24:02 +010051
Chen-Yu Tsaia1274cc2016-06-19 12:38:34 +080052 /* Align the secure section only if we're going to use it in situ */
53 .__secure_start :
54#ifndef CONFIG_ARMV7_SECURE_BASE
55 ALIGN(CONSTANT(COMMONPAGESIZE))
56#endif
57 {
58 KEEP(*(.__secure_start))
59 }
60
Marc Zyngierbf433af2014-07-12 14:24:02 +010061#ifndef CONFIG_ARMV7_SECURE_BASE
62#define CONFIG_ARMV7_SECURE_BASE
Chen-Yu Tsaib56e06d2016-06-07 10:54:27 +080063#define __ARMV7_PSCI_STACK_IN_RAM
Marc Zyngierbf433af2014-07-12 14:24:02 +010064#endif
65
Marc Zyngierbf433af2014-07-12 14:24:02 +010066 .secure_text CONFIG_ARMV7_SECURE_BASE :
67 AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
68 {
69 *(._secure.text)
70 }
71
Chen-Yu Tsaia5aa7ff2016-07-05 21:45:06 +080072 .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text))
73 {
74 *(._secure.data)
75 }
76
77 .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data),
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +080078 CONSTANT(COMMONPAGESIZE)) (NOLOAD) :
Chen-Yu Tsaib56e06d2016-06-07 10:54:27 +080079#ifdef __ARMV7_PSCI_STACK_IN_RAM
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +080080 AT(ADDR(.secure_stack))
81#else
Chen-Yu Tsaia5aa7ff2016-07-05 21:45:06 +080082 AT(LOADADDR(.secure_data) + SIZEOF(.secure_data))
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +080083#endif
84 {
85 KEEP(*(.__secure_stack_start))
Masahiro Yamada5a3aae62016-08-30 16:22:21 +090086#ifdef CONFIG_ARMV7_PSCI
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +080087 /* Skip addreses for stack */
88 . = . + CONFIG_ARMV7_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE;
Masahiro Yamada5a3aae62016-08-30 16:22:21 +090089#endif
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +080090 /* Align end of stack section to page boundary */
91 . = ALIGN(CONSTANT(COMMONPAGESIZE));
92
93 KEEP(*(.__secure_stack_end))
Chen-Yu Tsai3eff6812016-06-19 12:38:39 +080094
95#ifdef CONFIG_ARMV7_SECURE_MAX_SIZE
96 /*
97 * We are not checking (__secure_end - __secure_start) here,
98 * as these are the load addresses, and do not include the
99 * stack section. Instead, use the end of the stack section
100 * and the start of the text section.
101 */
102 ASSERT((. - ADDR(.secure_text)) <= CONFIG_ARMV7_SECURE_MAX_SIZE,
103 "Error: secure section exceeds secure memory size");
104#endif
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +0800105 }
106
107#ifndef __ARMV7_PSCI_STACK_IN_RAM
108 /* Reset VMA but don't allocate space if we have secure SRAM */
109 . = LOADADDR(.secure_stack);
Chen-Yu Tsaib56e06d2016-06-07 10:54:27 +0800110#endif
111
Chen-Yu Tsai980d6a52016-06-19 12:38:36 +0800112 .__secure_end : AT(ADDR(.__secure_end)) {
Marc Zyngierbf433af2014-07-12 14:24:02 +0100113 *(.__secure_end)
114 LONG(0x1d1071c); /* Must output something to reset LMA */
115 }
116#endif
117
Simon Glassdde3b702012-02-23 03:28:41 +0000118 . = ALIGN(4);
119 .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
120
121 . = ALIGN(4);
122 .data : {
Stephen Warrenb68d6712012-10-22 06:19:32 +0000123 *(.data*)
Simon Glassdde3b702012-02-23 03:28:41 +0000124 }
125
126 . = ALIGN(4);
127
128 . = .;
Simon Glassdde3b702012-02-23 03:28:41 +0000129
130 . = ALIGN(4);
Marek Vasut55675142012-10-12 10:27:03 +0000131 .u_boot_list : {
Albert ARIBAUDef123c52013-02-25 00:59:00 +0000132 KEEP(*(SORT(.u_boot_list*)));
Marek Vasut55675142012-10-12 10:27:03 +0000133 }
134
135 . = ALIGN(4);
Simon Glassdde3b702012-02-23 03:28:41 +0000136
Alexander Graf50149ea2016-03-04 01:10:01 +0100137 .__efi_runtime_start : {
138 *(.__efi_runtime_start)
139 }
140
141 .efi_runtime : {
142 *(efi_runtime_text)
143 *(efi_runtime_data)
144 }
145
146 .__efi_runtime_stop : {
147 *(.__efi_runtime_stop)
148 }
149
150 .efi_runtime_rel_start :
151 {
152 *(.__efi_runtime_rel_start)
153 }
154
155 .efi_runtime_rel : {
156 *(.relefi_runtime_text)
157 *(.relefi_runtime_data)
158 }
159
160 .efi_runtime_rel_stop :
161 {
162 *(.__efi_runtime_rel_stop)
163 }
164
165 . = ALIGN(4);
166
Albert ARIBAUDd026dec2013-06-11 14:17:33 +0200167 .image_copy_end :
168 {
169 *(.__image_copy_end)
170 }
Simon Glassdde3b702012-02-23 03:28:41 +0000171
Albert ARIBAUD47bd65e2013-06-11 14:17:34 +0200172 .rel_dyn_start :
173 {
174 *(.__rel_dyn_start)
175 }
176
Simon Glassdde3b702012-02-23 03:28:41 +0000177 .rel.dyn : {
Simon Glassdde3b702012-02-23 03:28:41 +0000178 *(.rel*)
Albert ARIBAUD47bd65e2013-06-11 14:17:34 +0200179 }
180
181 .rel_dyn_end :
182 {
183 *(.__rel_dyn_end)
Simon Glassdde3b702012-02-23 03:28:41 +0000184 }
185
Albert ARIBAUDd0b5d9d2014-02-22 17:53:42 +0100186 .end :
187 {
188 *(.__end)
189 }
190
191 _image_binary_end = .;
Simon Glassdde3b702012-02-23 03:28:41 +0000192
193 /*
194 * Deprecated: this MMU section is used by pxa at present but
195 * should not be used by new boards/CPUs.
196 */
197 . = ALIGN(4096);
198 .mmutable : {
199 *(.mmutable)
200 }
201
Albert ARIBAUDf84a7b82013-04-11 05:43:21 +0000202/*
203 * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
204 * __bss_base and __bss_limit are for linker only (overlay ordering)
205 */
206
Albert ARIBAUD3ebd1cb2013-02-25 00:58:59 +0000207 .bss_start __rel_dyn_start (OVERLAY) : {
208 KEEP(*(.__bss_start));
Albert ARIBAUDf84a7b82013-04-11 05:43:21 +0000209 __bss_base = .;
Albert ARIBAUD3ebd1cb2013-02-25 00:58:59 +0000210 }
211
Albert ARIBAUDf84a7b82013-04-11 05:43:21 +0000212 .bss __bss_base (OVERLAY) : {
Stephen Warrenb68d6712012-10-22 06:19:32 +0000213 *(.bss*)
Simon Glassdde3b702012-02-23 03:28:41 +0000214 . = ALIGN(4);
Albert ARIBAUDf84a7b82013-04-11 05:43:21 +0000215 __bss_limit = .;
Albert ARIBAUD3ebd1cb2013-02-25 00:58:59 +0000216 }
Tom Rini0ce033d2013-03-18 12:31:00 -0400217
Albert ARIBAUDf84a7b82013-04-11 05:43:21 +0000218 .bss_end __bss_limit (OVERLAY) : {
219 KEEP(*(.__bss_end));
Simon Glassdde3b702012-02-23 03:28:41 +0000220 }
221
Albert ARIBAUDd0b5d9d2014-02-22 17:53:42 +0100222 .dynsym _image_binary_end : { *(.dynsym) }
Albert ARIBAUD47ed5dd2013-11-07 14:21:46 +0100223 .dynbss : { *(.dynbss) }
224 .dynstr : { *(.dynstr*) }
225 .dynamic : { *(.dynamic*) }
226 .plt : { *(.plt*) }
227 .interp : { *(.interp*) }
Andreas Färber2c67e0e2014-01-27 05:48:11 +0100228 .gnu.hash : { *(.gnu.hash) }
Albert ARIBAUD47ed5dd2013-11-07 14:21:46 +0100229 .gnu : { *(.gnu*) }
230 .ARM.exidx : { *(.ARM.exidx*) }
Albert ARIBAUDb02bfc42014-01-13 14:57:05 +0100231 .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
Simon Glassdde3b702012-02-23 03:28:41 +0000232}