Simon Glass | 437e2b8 | 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 | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 7 | * SPDX-License-Identifier: GPL-2.0+ |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 8 | */ |
| 9 | |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 10 | #include <config.h> |
| 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 | { |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 17 | #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC) |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 18 | /* |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 19 | * If CONFIG_ARMV7_SECURE_BASE is true, secure code will not |
| 20 | * bundle with u-boot, and code offsets are fixed. Secure zone |
| 21 | * only needs to be copied from the loading address to |
| 22 | * CONFIG_ARMV7_SECURE_BASE, which is the linking and running |
| 23 | * address for secure code. |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 24 | * |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 25 | * If CONFIG_ARMV7_SECURE_BASE is undefined, the secure zone will |
| 26 | * be included in u-boot address space, and some absolute address |
| 27 | * were used in secure code. The absolute addresses of the secure |
| 28 | * code also needs to be relocated along with the accompanying u-boot |
| 29 | * code. |
| 30 | * |
| 31 | * So DISCARD is only for CONFIG_ARMV7_SECURE_BASE. |
Peng Fan | 2e9e9a8 | 2015-10-23 10:13:03 +0800 | [diff] [blame] | 32 | */ |
| 33 | /DISCARD/ : { *(.rel._secure*) } |
Wang Dongsheng | 7eab3a6 | 2016-01-18 11:02:40 +0800 | [diff] [blame] | 34 | #endif |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 35 | . = 0x00000000; |
| 36 | |
| 37 | . = ALIGN(4); |
| 38 | .text : |
| 39 | { |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 40 | *(.__image_copy_start) |
Albert ARIBAUD | 9852cc6 | 2014-04-15 16:13:51 +0200 | [diff] [blame] | 41 | *(.vectors) |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 42 | CPUDIR/start.o (.text*) |
| 43 | *(.text*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 44 | } |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 45 | |
Jan Kiszka | ac31b5a | 2015-04-21 07:18:24 +0200 | [diff] [blame] | 46 | #ifdef CONFIG_ARMV7_NONSEC |
Marc Zyngier | c0451ec | 2014-07-12 14:24:02 +0100 | [diff] [blame] | 47 | |
| 48 | #ifndef CONFIG_ARMV7_SECURE_BASE |
| 49 | #define CONFIG_ARMV7_SECURE_BASE |
| 50 | #endif |
| 51 | |
| 52 | .__secure_start : { |
| 53 | . = ALIGN(0x1000); |
| 54 | *(.__secure_start) |
| 55 | } |
| 56 | |
| 57 | .secure_text CONFIG_ARMV7_SECURE_BASE : |
| 58 | AT(ADDR(.__secure_start) + SIZEOF(.__secure_start)) |
| 59 | { |
| 60 | *(._secure.text) |
| 61 | } |
| 62 | |
| 63 | . = LOADADDR(.__secure_start) + |
| 64 | SIZEOF(.__secure_start) + |
| 65 | SIZEOF(.secure_text); |
| 66 | |
| 67 | __secure_end_lma = .; |
| 68 | .__secure_end : AT(__secure_end_lma) { |
| 69 | *(.__secure_end) |
| 70 | LONG(0x1d1071c); /* Must output something to reset LMA */ |
| 71 | } |
| 72 | #endif |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 73 | |
| 74 | . = ALIGN(4); |
| 75 | .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } |
| 76 | |
| 77 | . = ALIGN(4); |
| 78 | .data : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 79 | *(.data*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | . = ALIGN(4); |
| 83 | |
| 84 | . = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 85 | |
| 86 | . = ALIGN(4); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 87 | .u_boot_list : { |
Albert ARIBAUD | c24895e | 2013-02-25 00:59:00 +0000 | [diff] [blame] | 88 | KEEP(*(SORT(.u_boot_list*))); |
Marek Vasut | 607092a | 2012-10-12 10:27:03 +0000 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | . = ALIGN(4); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 92 | |
Alexander Graf | 0bd425a | 2016-03-04 01:10:01 +0100 | [diff] [blame] | 93 | .__efi_runtime_start : { |
| 94 | *(.__efi_runtime_start) |
| 95 | } |
| 96 | |
| 97 | .efi_runtime : { |
| 98 | *(efi_runtime_text) |
| 99 | *(efi_runtime_data) |
| 100 | } |
| 101 | |
| 102 | .__efi_runtime_stop : { |
| 103 | *(.__efi_runtime_stop) |
| 104 | } |
| 105 | |
| 106 | .efi_runtime_rel_start : |
| 107 | { |
| 108 | *(.__efi_runtime_rel_start) |
| 109 | } |
| 110 | |
| 111 | .efi_runtime_rel : { |
| 112 | *(.relefi_runtime_text) |
| 113 | *(.relefi_runtime_data) |
| 114 | } |
| 115 | |
| 116 | .efi_runtime_rel_stop : |
| 117 | { |
| 118 | *(.__efi_runtime_rel_stop) |
| 119 | } |
| 120 | |
| 121 | . = ALIGN(4); |
| 122 | |
Albert ARIBAUD | c53687e | 2013-06-11 14:17:33 +0200 | [diff] [blame] | 123 | .image_copy_end : |
| 124 | { |
| 125 | *(.__image_copy_end) |
| 126 | } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 127 | |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 128 | .rel_dyn_start : |
| 129 | { |
| 130 | *(.__rel_dyn_start) |
| 131 | } |
| 132 | |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 133 | .rel.dyn : { |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 134 | *(.rel*) |
Albert ARIBAUD | af3ff16 | 2013-06-11 14:17:34 +0200 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | .rel_dyn_end : |
| 138 | { |
| 139 | *(.__rel_dyn_end) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 140 | } |
| 141 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 142 | .end : |
| 143 | { |
| 144 | *(.__end) |
| 145 | } |
| 146 | |
| 147 | _image_binary_end = .; |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 148 | |
| 149 | /* |
| 150 | * Deprecated: this MMU section is used by pxa at present but |
| 151 | * should not be used by new boards/CPUs. |
| 152 | */ |
| 153 | . = ALIGN(4096); |
| 154 | .mmutable : { |
| 155 | *(.mmutable) |
| 156 | } |
| 157 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 158 | /* |
| 159 | * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c |
| 160 | * __bss_base and __bss_limit are for linker only (overlay ordering) |
| 161 | */ |
| 162 | |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 163 | .bss_start __rel_dyn_start (OVERLAY) : { |
| 164 | KEEP(*(.__bss_start)); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 165 | __bss_base = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 166 | } |
| 167 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 168 | .bss __bss_base (OVERLAY) : { |
Stephen Warren | adddf45 | 2012-10-22 06:19:32 +0000 | [diff] [blame] | 169 | *(.bss*) |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 170 | . = ALIGN(4); |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 171 | __bss_limit = .; |
Albert ARIBAUD | 436f632 | 2013-02-25 00:58:59 +0000 | [diff] [blame] | 172 | } |
Tom Rini | 19aac97 | 2013-03-18 12:31:00 -0400 | [diff] [blame] | 173 | |
Albert ARIBAUD | ba5662d | 2013-04-11 05:43:21 +0000 | [diff] [blame] | 174 | .bss_end __bss_limit (OVERLAY) : { |
| 175 | KEEP(*(.__bss_end)); |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 176 | } |
| 177 | |
Albert ARIBAUD | 9d25fa4 | 2014-02-22 17:53:42 +0100 | [diff] [blame] | 178 | .dynsym _image_binary_end : { *(.dynsym) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 179 | .dynbss : { *(.dynbss) } |
| 180 | .dynstr : { *(.dynstr*) } |
| 181 | .dynamic : { *(.dynamic*) } |
| 182 | .plt : { *(.plt*) } |
| 183 | .interp : { *(.interp*) } |
Andreas Färber | 438a167 | 2014-01-27 05:48:11 +0100 | [diff] [blame] | 184 | .gnu.hash : { *(.gnu.hash) } |
Albert ARIBAUD | 95fc6d6 | 2013-11-07 14:21:46 +0100 | [diff] [blame] | 185 | .gnu : { *(.gnu*) } |
| 186 | .ARM.exidx : { *(.ARM.exidx*) } |
Albert ARIBAUD | ddadbed | 2014-01-13 14:57:05 +0100 | [diff] [blame] | 187 | .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) } |
Simon Glass | 437e2b8 | 2012-02-23 03:28:41 +0000 | [diff] [blame] | 188 | } |