Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2004-2008 Texas Instruments |
| 4 | * |
| 5 | * (C) Copyright 2002 |
| 6 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 9 | #include <config.h> |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 10 | #include <asm/psci.h> |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 11 | |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 12 | OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") |
| 13 | OUTPUT_ARCH(arm) |
| 14 | ENTRY(_start) |
| 15 | SECTIONS |
| 16 | { |
Simon Glass | 3e2c91c | 2016-03-13 19:07:29 -0600 | [diff] [blame] | 17 | #ifndef CONFIG_CMDLINE |
Andrew Scull | 5a9095c | 2022-05-30 10:00:04 +0000 | [diff] [blame] | 18 | /DISCARD/ : { *(__u_boot_list_2_cmd_*) } |
Simon Glass | 3e2c91c | 2016-03-13 19:07:29 -0600 | [diff] [blame] | 19 | #endif |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 20 | #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC) |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 21 | /* |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 22 | * If CONFIG_ARMV7_SECURE_BASE is true, secure code will not |
| 23 | * bundle with u-boot, and code offsets are fixed. Secure zone |
| 24 | * only needs to be copied from the loading address to |
| 25 | * CONFIG_ARMV7_SECURE_BASE, which is the linking and running |
| 26 | * address for secure code. |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 27 | * |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 28 | * If CONFIG_ARMV7_SECURE_BASE is undefined, the secure zone will |
| 29 | * be included in u-boot address space, and some absolute address |
| 30 | * were used in secure code. The absolute addresses of the secure |
| 31 | * code also needs to be relocated along with the accompanying u-boot |
| 32 | * code. |
| 33 | * |
| 34 | * So DISCARD is only for CONFIG_ARMV7_SECURE_BASE. |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 35 | */ |
| 36 | /DISCARD/ : { *(.rel._secure*) } |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 37 | #endif |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 38 | . = 0x00000000; |
| 39 | |
| 40 | . = ALIGN(4); |
| 41 | .text : |
| 42 | { |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 43 | *(.__image_copy_start) |
Albert ARIBAUD | 9852cc6 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 44 | *(.vectors) |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 45 | CPUDIR/start.o (.text*) |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 46 | } |
| 47 | |
| 48 | /* This needs to come before *(.text*) */ |
| 49 | .__efi_runtime_start : { |
| 50 | *(.__efi_runtime_start) |
| 51 | } |
| 52 | |
| 53 | .efi_runtime : { |
| 54 | *(.text.efi_runtime*) |
| 55 | *(.rodata.efi_runtime*) |
| 56 | *(.data.efi_runtime*) |
| 57 | } |
| 58 | |
| 59 | .__efi_runtime_stop : { |
| 60 | *(.__efi_runtime_stop) |
| 61 | } |
| 62 | |
| 63 | .text_rest : |
| 64 | { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 65 | *(.text*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 66 | } |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 67 | |
Jan Kiszka | ac31b5a | 2015-04-21 07:18:24 +0200 | [diff] [blame] | 68 | #ifdef CONFIG_ARMV7_NONSEC |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 69 | |
Chen-Yu Tsai | 277a8f6 | 2016-06-19 12:38:34 +0800 | [diff] [blame] | 70 | /* Align the secure section only if we're going to use it in situ */ |
Chen-Yu Tsai | a7eb9d3 | 2018-09-06 11:56:28 +0800 | [diff] [blame] | 71 | .__secure_start |
Chen-Yu Tsai | 277a8f6 | 2016-06-19 12:38:34 +0800 | [diff] [blame] | 72 | #ifndef CONFIG_ARMV7_SECURE_BASE |
| 73 | ALIGN(CONSTANT(COMMONPAGESIZE)) |
| 74 | #endif |
Chen-Yu Tsai | a7eb9d3 | 2018-09-06 11:56:28 +0800 | [diff] [blame] | 75 | : { |
Chen-Yu Tsai | 277a8f6 | 2016-06-19 12:38:34 +0800 | [diff] [blame] | 76 | KEEP(*(.__secure_start)) |
| 77 | } |
| 78 | |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 79 | #ifndef CONFIG_ARMV7_SECURE_BASE |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 80 | #define __ARMV7_SECURE_BASE |
Chen-Yu Tsai | 72a4800 | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 81 | #define __ARMV7_PSCI_STACK_IN_RAM |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 82 | #else |
| 83 | #define __ARMV7_SECURE_BASE CONFIG_ARMV7_SECURE_BASE |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 84 | #endif |
| 85 | |
Tom Rini | a17db83 | 2023-01-10 11:19:31 -0500 | [diff] [blame] | 86 | .secure_text __ARMV7_SECURE_BASE : |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 87 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 88 | { |
| 89 | *(._secure.text) |
| 90 | } |
| 91 | |
Chen-Yu Tsai | 5ed0387 | 2016-07-05 21:45:06 +0800 | [diff] [blame] | 92 | .secure_data : AT(LOADADDR(.secure_text) + SIZEOF(.secure_text)) |
| 93 | { |
| 94 | *(._secure.data) |
| 95 | } |
| 96 | |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 97 | #ifdef CONFIG_ARMV7_PSCI |
Chen-Yu Tsai | 5ed0387 | 2016-07-05 21:45:06 +0800 | [diff] [blame] | 98 | .secure_stack ALIGN(ADDR(.secure_data) + SIZEOF(.secure_data), |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 99 | CONSTANT(COMMONPAGESIZE)) (NOLOAD) : |
Chen-Yu Tsai | 72a4800 | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 100 | #ifdef __ARMV7_PSCI_STACK_IN_RAM |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 101 | AT(ADDR(.secure_stack)) |
| 102 | #else |
Chen-Yu Tsai | 5ed0387 | 2016-07-05 21:45:06 +0800 | [diff] [blame] | 103 | AT(LOADADDR(.secure_data) + SIZEOF(.secure_data)) |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 104 | #endif |
| 105 | { |
| 106 | KEEP(*(.__secure_stack_start)) |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 107 | |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 108 | /* Skip addreses for stack */ |
| 109 | . = . + CONFIG_ARMV7_PSCI_NR_CPUS * ARM_PSCI_STACK_SIZE; |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 110 | |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 111 | /* Align end of stack section to page boundary */ |
| 112 | . = ALIGN(CONSTANT(COMMONPAGESIZE)); |
| 113 | |
| 114 | KEEP(*(.__secure_stack_end)) |
Chen-Yu Tsai | 3de210c | 2016-06-19 12:38:39 +0800 | [diff] [blame] | 115 | |
| 116 | #ifdef CONFIG_ARMV7_SECURE_MAX_SIZE |
| 117 | /* |
| 118 | * We are not checking (__secure_end - __secure_start) here, |
| 119 | * as these are the load addresses, and do not include the |
| 120 | * stack section. Instead, use the end of the stack section |
| 121 | * and the start of the text section. |
| 122 | */ |
| 123 | ASSERT((. - ADDR(.secure_text)) <= CONFIG_ARMV7_SECURE_MAX_SIZE, |
| 124 | "Error: secure section exceeds secure memory size"); |
| 125 | #endif |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | #ifndef __ARMV7_PSCI_STACK_IN_RAM |
| 129 | /* Reset VMA but don't allocate space if we have secure SRAM */ |
| 130 | . = LOADADDR(.secure_stack); |
Chen-Yu Tsai | 72a4800 | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 131 | #endif |
| 132 | |
Masahiro Yamada | 2aa46c0 | 2016-09-26 14:21:30 +0900 | [diff] [blame] | 133 | #endif |
| 134 | |
Chen-Yu Tsai | a00f85d | 2016-06-19 12:38:36 +0800 | [diff] [blame] | 135 | .__secure_end : AT(ADDR(.__secure_end)) { |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 136 | *(.__secure_end) |
| 137 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 138 | } |
| 139 | #endif |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 140 | |
| 141 | . = ALIGN(4); |
| 142 | .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } |
| 143 | |
| 144 | . = ALIGN(4); |
| 145 | .data : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 146 | *(.data*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | . = ALIGN(4); |
| 150 | |
| 151 | . = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 152 | |
| 153 | . = ALIGN(4); |
Andrew Scull | 5a9095c | 2022-05-30 10:00:04 +0000 | [diff] [blame] | 154 | __u_boot_list : { |
| 155 | KEEP(*(SORT(__u_boot_list*))); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 156 | } |
| 157 | |
| 158 | . = ALIGN(4); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 159 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 160 | .efi_runtime_rel_start : |
| 161 | { |
| 162 | *(.__efi_runtime_rel_start) |
| 163 | } |
| 164 | |
| 165 | .efi_runtime_rel : { |
Alexander Graf | 94a10f2 | 2018-06-12 07:48:37 +0200 | [diff] [blame] | 166 | *(.rel*.efi_runtime) |
| 167 | *(.rel*.efi_runtime.*) |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | .efi_runtime_rel_stop : |
| 171 | { |
| 172 | *(.__efi_runtime_rel_stop) |
| 173 | } |
| 174 | |
Tom Rini | 06ca0cf | 2017-06-14 09:13:21 -0400 | [diff] [blame] | 175 | . = ALIGN(4); |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 176 | |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 177 | .image_copy_end : |
| 178 | { |
| 179 | *(.__image_copy_end) |
| 180 | } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 181 | |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 182 | .rel_dyn_start : |
| 183 | { |
| 184 | *(.__rel_dyn_start) |
| 185 | } |
| 186 | |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 187 | .rel.dyn : { |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 188 | *(.rel*) |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | .rel_dyn_end : |
| 192 | { |
| 193 | *(.__rel_dyn_end) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 194 | } |
| 195 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 196 | .end : |
| 197 | { |
| 198 | *(.__end) |
| 199 | } |
| 200 | |
| 201 | _image_binary_end = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 202 | |
| 203 | /* |
| 204 | * Deprecated: this MMU section is used by pxa at present but |
| 205 | * should not be used by new boards/CPUs. |
| 206 | */ |
| 207 | . = ALIGN(4096); |
| 208 | .mmutable : { |
| 209 | *(.mmutable) |
| 210 | } |
| 211 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 212 | /* |
| 213 | * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c |
| 214 | * __bss_base and __bss_limit are for linker only (overlay ordering) |
| 215 | */ |
| 216 | |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 217 | .bss_start __rel_dyn_start (OVERLAY) : { |
| 218 | KEEP(*(.__bss_start)); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 219 | __bss_base = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 220 | } |
| 221 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 222 | .bss __bss_base (OVERLAY) : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 223 | *(.bss*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 224 | . = ALIGN(4); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 225 | __bss_limit = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 226 | } |
Tom Rini | 19aac97 | 2013-03-18 12:31:00 -0400 | [diff] [blame] | 227 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 228 | .bss_end __bss_limit (OVERLAY) : { |
| 229 | KEEP(*(.__bss_end)); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 230 | } |
| 231 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 232 | .dynsym _image_binary_end : { *(.dynsym) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 233 | .dynbss : { *(.dynbss) } |
| 234 | .dynstr : { *(.dynstr*) } |
| 235 | .dynamic : { *(.dynamic*) } |
| 236 | .plt : { *(.plt*) } |
| 237 | .interp : { *(.interp*) } |
Andreas Färber | 438a167 | 2014-01-27 05:48:11 +0100 | [diff] [blame] | 238 | .gnu.hash : { *(.gnu.hash) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 239 | .gnu : { *(.gnu*) } |
| 240 | .ARM.exidx : { *(.ARM.exidx*) } |
Albert ARIBAUD | ddadbed | 2014-01-13 14:57:05 +0100 | [diff] [blame] | 241 | .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 242 | } |