Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2004-2008 Texas Instruments |
| 3 | * |
| 4 | * (C) Copyright 2002 |
| 5 | * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de> |
| 6 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Marc Zyngier | bf433af | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 10 | #include <config.h> |
| 11 | |
Simon Glass | dde3b70 | 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 | c135211 | 2016-03-13 19:07:29 -0600 | [diff] [blame] | 17 | #ifndef CONFIG_CMDLINE |
| 18 | /DISCARD/ : { *(.u_boot_list_2_cmd_*) } |
| 19 | #endif |
Wang Dongsheng | c5e954e | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 20 | #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC) |
Peng Fan | d47cb0b | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 21 | /* |
Wang Dongsheng | c5e954e | 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 | d47cb0b | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 27 | * |
Wang Dongsheng | c5e954e | 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 | d47cb0b | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 35 | */ |
| 36 | /DISCARD/ : { *(.rel._secure*) } |
Wang Dongsheng | c5e954e | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 37 | #endif |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 38 | . = 0x00000000; |
| 39 | |
| 40 | . = ALIGN(4); |
| 41 | .text : |
| 42 | { |
Albert ARIBAUD | d026dec | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 43 | *(.__image_copy_start) |
Albert ARIBAUD | 41623c9 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 44 | *(.vectors) |
Stephen Warren | b68d671 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 45 | CPUDIR/start.o (.text*) |
| 46 | *(.text*) |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 47 | } |
| 48 | |
Jan Kiszka | 104d6fb | 2015-04-21 07:18:24 +0200 | [diff] [blame] | 49 | #ifdef CONFIG_ARMV7_NONSEC |
Marc Zyngier | bf433af | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 50 | |
| 51 | #ifndef CONFIG_ARMV7_SECURE_BASE |
| 52 | #define CONFIG_ARMV7_SECURE_BASE |
Chen-Yu Tsai | b56e06d | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 53 | #define __ARMV7_PSCI_STACK_IN_RAM |
Marc Zyngier | bf433af | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 54 | #endif |
| 55 | |
| 56 | .__secure_start : { |
| 57 | . = ALIGN(0x1000); |
| 58 | *(.__secure_start) |
| 59 | } |
| 60 | |
| 61 | .secure_text CONFIG_ARMV7_SECURE_BASE : |
| 62 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 63 | { |
| 64 | *(._secure.text) |
| 65 | } |
| 66 | |
| 67 | . = LOADADDR(.__secure_start) + |
| 68 | SIZEOF(.__secure_start) + |
| 69 | SIZEOF(.secure_text); |
| 70 | |
Chen-Yu Tsai | b56e06d | 2016-06-07 10:54:27 +0800 | [diff] [blame] | 71 | #ifdef __ARMV7_PSCI_STACK_IN_RAM |
| 72 | /* Align to page boundary and skip 2 pages */ |
| 73 | . = (. & ~ 0xfff) + 0x2000; |
| 74 | #undef __ARMV7_PSCI_STACK_IN_RAM |
| 75 | #endif |
| 76 | |
Marc Zyngier | bf433af | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 77 | __secure_end_lma = .; |
| 78 | .__secure_end : AT(__secure_end_lma) { |
| 79 | *(.__secure_end) |
| 80 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 81 | } |
| 82 | #endif |
| 83 | |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 84 | . = ALIGN(4); |
| 85 | .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } |
| 86 | |
| 87 | . = ALIGN(4); |
| 88 | .data : { |
Stephen Warren | b68d671 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 89 | *(.data*) |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 90 | } |
| 91 | |
| 92 | . = ALIGN(4); |
| 93 | |
| 94 | . = .; |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 95 | |
| 96 | . = ALIGN(4); |
Marek Vasut | 5567514 | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 97 | .u_boot_list : { |
Albert ARIBAUD | ef123c5 | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 98 | KEEP(*(SORT(.u_boot_list*))); |
Marek Vasut | 5567514 | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | . = ALIGN(4); |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 102 | |
Alexander Graf | 50149ea | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 103 | .__efi_runtime_start : { |
| 104 | *(.__efi_runtime_start) |
| 105 | } |
| 106 | |
| 107 | .efi_runtime : { |
| 108 | *(efi_runtime_text) |
| 109 | *(efi_runtime_data) |
| 110 | } |
| 111 | |
| 112 | .__efi_runtime_stop : { |
| 113 | *(.__efi_runtime_stop) |
| 114 | } |
| 115 | |
| 116 | .efi_runtime_rel_start : |
| 117 | { |
| 118 | *(.__efi_runtime_rel_start) |
| 119 | } |
| 120 | |
| 121 | .efi_runtime_rel : { |
| 122 | *(.relefi_runtime_text) |
| 123 | *(.relefi_runtime_data) |
| 124 | } |
| 125 | |
| 126 | .efi_runtime_rel_stop : |
| 127 | { |
| 128 | *(.__efi_runtime_rel_stop) |
| 129 | } |
| 130 | |
| 131 | . = ALIGN(4); |
| 132 | |
Albert ARIBAUD | d026dec | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 133 | .image_copy_end : |
| 134 | { |
| 135 | *(.__image_copy_end) |
| 136 | } |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 137 | |
Albert ARIBAUD | 47bd65e | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 138 | .rel_dyn_start : |
| 139 | { |
| 140 | *(.__rel_dyn_start) |
| 141 | } |
| 142 | |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 143 | .rel.dyn : { |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 144 | *(.rel*) |
Albert ARIBAUD | 47bd65e | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 145 | } |
| 146 | |
| 147 | .rel_dyn_end : |
| 148 | { |
| 149 | *(.__rel_dyn_end) |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 150 | } |
| 151 | |
Albert ARIBAUD | d0b5d9d | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 152 | .end : |
| 153 | { |
| 154 | *(.__end) |
| 155 | } |
| 156 | |
| 157 | _image_binary_end = .; |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 158 | |
| 159 | /* |
| 160 | * Deprecated: this MMU section is used by pxa at present but |
| 161 | * should not be used by new boards/CPUs. |
| 162 | */ |
| 163 | . = ALIGN(4096); |
| 164 | .mmutable : { |
| 165 | *(.mmutable) |
| 166 | } |
| 167 | |
Albert ARIBAUD | f84a7b8 | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 168 | /* |
| 169 | * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c |
| 170 | * __bss_base and __bss_limit are for linker only (overlay ordering) |
| 171 | */ |
| 172 | |
Albert ARIBAUD | 3ebd1cb | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 173 | .bss_start __rel_dyn_start (OVERLAY) : { |
| 174 | KEEP(*(.__bss_start)); |
Albert ARIBAUD | f84a7b8 | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 175 | __bss_base = .; |
Albert ARIBAUD | 3ebd1cb | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 176 | } |
| 177 | |
Albert ARIBAUD | f84a7b8 | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 178 | .bss __bss_base (OVERLAY) : { |
Stephen Warren | b68d671 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 179 | *(.bss*) |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 180 | . = ALIGN(4); |
Albert ARIBAUD | f84a7b8 | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 181 | __bss_limit = .; |
Albert ARIBAUD | 3ebd1cb | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 182 | } |
Tom Rini | 0ce033d | 2013-03-18 12:31:00 -0400 | [diff] [blame] | 183 | |
Albert ARIBAUD | f84a7b8 | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 184 | .bss_end __bss_limit (OVERLAY) : { |
| 185 | KEEP(*(.__bss_end)); |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 186 | } |
| 187 | |
Albert ARIBAUD | d0b5d9d | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 188 | .dynsym _image_binary_end : { *(.dynsym) } |
Albert ARIBAUD | 47ed5dd | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 189 | .dynbss : { *(.dynbss) } |
| 190 | .dynstr : { *(.dynstr*) } |
| 191 | .dynamic : { *(.dynamic*) } |
| 192 | .plt : { *(.plt*) } |
| 193 | .interp : { *(.interp*) } |
Andreas Färber | 2c67e0e | 2014-01-27 05:48:11 +0100 | [diff] [blame] | 194 | .gnu.hash : { *(.gnu.hash) } |
Albert ARIBAUD | 47ed5dd | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 195 | .gnu : { *(.gnu*) } |
| 196 | .ARM.exidx : { *(.ARM.exidx*) } |
Albert ARIBAUD | b02bfc4 | 2014-01-13 14:57:05 +0100 | [diff] [blame] | 197 | .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) } |
Simon Glass | dde3b70 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 198 | } |