]> git.sur5r.net Git - u-boot/blob - arch/arm/cpu/u-boot.lds
ARM: Page align secure section only when it is executed in situ
[u-boot] / arch / arm / cpu / u-boot.lds
1 /*
2  * Copyright (c) 2004-2008 Texas Instruments
3  *
4  * (C) Copyright 2002
5  * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
6  *
7  * SPDX-License-Identifier:     GPL-2.0+
8  */
9
10 #include <config.h>
11
12 OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
13 OUTPUT_ARCH(arm)
14 ENTRY(_start)
15 SECTIONS
16 {
17 #ifndef CONFIG_CMDLINE
18         /DISCARD/ : { *(.u_boot_list_2_cmd_*) }
19 #endif
20 #if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC)
21         /*
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.
27          *
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.
35          */
36         /DISCARD/ : { *(.rel._secure*) }
37 #endif
38         . = 0x00000000;
39
40         . = ALIGN(4);
41         .text :
42         {
43                 *(.__image_copy_start)
44                 *(.vectors)
45                 CPUDIR/start.o (.text*)
46                 *(.text*)
47         }
48
49 #ifdef CONFIG_ARMV7_NONSEC
50
51         /* Align the secure section only if we're going to use it in situ */
52         .__secure_start :
53 #ifndef CONFIG_ARMV7_SECURE_BASE
54                 ALIGN(CONSTANT(COMMONPAGESIZE))
55 #endif
56         {
57                 KEEP(*(.__secure_start))
58         }
59
60 #ifndef CONFIG_ARMV7_SECURE_BASE
61 #define CONFIG_ARMV7_SECURE_BASE
62 #define __ARMV7_PSCI_STACK_IN_RAM
63 #endif
64
65         .secure_text CONFIG_ARMV7_SECURE_BASE :
66                 AT(ADDR(.__secure_start) + SIZEOF(.__secure_start))
67         {
68                 *(._secure.text)
69         }
70
71         . = LOADADDR(.__secure_start) +
72                 SIZEOF(.__secure_start) +
73                 SIZEOF(.secure_text);
74
75 #ifdef __ARMV7_PSCI_STACK_IN_RAM
76         /* Align to page boundary and skip 2 pages */
77         . = (. & ~ 0xfff) + 0x2000;
78 #undef __ARMV7_PSCI_STACK_IN_RAM
79 #endif
80
81         __secure_end_lma = .;
82         .__secure_end : AT(__secure_end_lma) {
83                 *(.__secure_end)
84                 LONG(0x1d1071c);        /* Must output something to reset LMA */
85         }
86 #endif
87
88         . = ALIGN(4);
89         .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
90
91         . = ALIGN(4);
92         .data : {
93                 *(.data*)
94         }
95
96         . = ALIGN(4);
97
98         . = .;
99
100         . = ALIGN(4);
101         .u_boot_list : {
102                 KEEP(*(SORT(.u_boot_list*)));
103         }
104
105         . = ALIGN(4);
106
107         .__efi_runtime_start : {
108                 *(.__efi_runtime_start)
109         }
110
111         .efi_runtime : {
112                 *(efi_runtime_text)
113                 *(efi_runtime_data)
114         }
115
116         .__efi_runtime_stop : {
117                 *(.__efi_runtime_stop)
118         }
119
120         .efi_runtime_rel_start :
121         {
122                 *(.__efi_runtime_rel_start)
123         }
124
125         .efi_runtime_rel : {
126                 *(.relefi_runtime_text)
127                 *(.relefi_runtime_data)
128         }
129
130         .efi_runtime_rel_stop :
131         {
132                 *(.__efi_runtime_rel_stop)
133         }
134
135         . = ALIGN(4);
136
137         .image_copy_end :
138         {
139                 *(.__image_copy_end)
140         }
141
142         .rel_dyn_start :
143         {
144                 *(.__rel_dyn_start)
145         }
146
147         .rel.dyn : {
148                 *(.rel*)
149         }
150
151         .rel_dyn_end :
152         {
153                 *(.__rel_dyn_end)
154         }
155
156         .end :
157         {
158                 *(.__end)
159         }
160
161         _image_binary_end = .;
162
163         /*
164          * Deprecated: this MMU section is used by pxa at present but
165          * should not be used by new boards/CPUs.
166          */
167         . = ALIGN(4096);
168         .mmutable : {
169                 *(.mmutable)
170         }
171
172 /*
173  * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
174  * __bss_base and __bss_limit are for linker only (overlay ordering)
175  */
176
177         .bss_start __rel_dyn_start (OVERLAY) : {
178                 KEEP(*(.__bss_start));
179                 __bss_base = .;
180         }
181
182         .bss __bss_base (OVERLAY) : {
183                 *(.bss*)
184                  . = ALIGN(4);
185                  __bss_limit = .;
186         }
187
188         .bss_end __bss_limit (OVERLAY) : {
189                 KEEP(*(.__bss_end));
190         }
191
192         .dynsym _image_binary_end : { *(.dynsym) }
193         .dynbss : { *(.dynbss) }
194         .dynstr : { *(.dynstr*) }
195         .dynamic : { *(.dynamic*) }
196         .plt : { *(.plt*) }
197         .interp : { *(.interp*) }
198         .gnu.hash : { *(.gnu.hash) }
199         .gnu : { *(.gnu*) }
200         .ARM.exidx : { *(.ARM.exidx*) }
201         .gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
202 }