xref: /openbmc/u-boot/arch/arm/cpu/u-boot.lds (revision cd4b0c5f)
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
12OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
13OUTPUT_ARCH(arm)
14ENTRY(_start)
15SECTIONS
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#ifndef CONFIG_ARMV7_SECURE_BASE
52#define CONFIG_ARMV7_SECURE_BASE
53#define __ARMV7_PSCI_STACK_IN_RAM
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
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
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
84	. = ALIGN(4);
85	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
86
87	. = ALIGN(4);
88	.data : {
89		*(.data*)
90	}
91
92	. = ALIGN(4);
93
94	. = .;
95
96	. = ALIGN(4);
97	.u_boot_list : {
98		KEEP(*(SORT(.u_boot_list*)));
99	}
100
101	. = ALIGN(4);
102
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
133	.image_copy_end :
134	{
135		*(.__image_copy_end)
136	}
137
138	.rel_dyn_start :
139	{
140		*(.__rel_dyn_start)
141	}
142
143	.rel.dyn : {
144		*(.rel*)
145	}
146
147	.rel_dyn_end :
148	{
149		*(.__rel_dyn_end)
150	}
151
152	.end :
153	{
154		*(.__end)
155	}
156
157	_image_binary_end = .;
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
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
173	.bss_start __rel_dyn_start (OVERLAY) : {
174		KEEP(*(.__bss_start));
175		__bss_base = .;
176	}
177
178	.bss __bss_base (OVERLAY) : {
179		*(.bss*)
180		 . = ALIGN(4);
181		 __bss_limit = .;
182	}
183
184	.bss_end __bss_limit (OVERLAY) : {
185		KEEP(*(.__bss_end));
186	}
187
188	.dynsym _image_binary_end : { *(.dynsym) }
189	.dynbss : { *(.dynbss) }
190	.dynstr : { *(.dynstr*) }
191	.dynamic : { *(.dynamic*) }
192	.plt : { *(.plt*) }
193	.interp : { *(.interp*) }
194	.gnu.hash : { *(.gnu.hash) }
195	.gnu : { *(.gnu*) }
196	.ARM.exidx : { *(.ARM.exidx*) }
197	.gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
198}
199