xref: /openbmc/u-boot/arch/arm/cpu/u-boot.lds (revision 70341e2e)
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#if defined(CONFIG_ARMV7_SECURE_BASE) && defined(CONFIG_ARMV7_NONSEC)
18	/*
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.
24	 *
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.
32	 */
33	/DISCARD/ : { *(.rel._secure*) }
34#endif
35	. = 0x00000000;
36
37	. = ALIGN(4);
38	.text :
39	{
40		*(.__image_copy_start)
41		*(.vectors)
42		CPUDIR/start.o (.text*)
43		*(.text*)
44	}
45
46#ifdef CONFIG_ARMV7_NONSEC
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
73
74	. = ALIGN(4);
75	.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
76
77	. = ALIGN(4);
78	.data : {
79		*(.data*)
80	}
81
82	. = ALIGN(4);
83
84	. = .;
85
86	. = ALIGN(4);
87	.u_boot_list : {
88		KEEP(*(SORT(.u_boot_list*)));
89	}
90
91	. = ALIGN(4);
92
93	.image_copy_end :
94	{
95		*(.__image_copy_end)
96	}
97
98	.rel_dyn_start :
99	{
100		*(.__rel_dyn_start)
101	}
102
103	.rel.dyn : {
104		*(.rel*)
105	}
106
107	.rel_dyn_end :
108	{
109		*(.__rel_dyn_end)
110	}
111
112	.end :
113	{
114		*(.__end)
115	}
116
117	_image_binary_end = .;
118
119	/*
120	 * Deprecated: this MMU section is used by pxa at present but
121	 * should not be used by new boards/CPUs.
122	 */
123	. = ALIGN(4096);
124	.mmutable : {
125		*(.mmutable)
126	}
127
128/*
129 * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
130 * __bss_base and __bss_limit are for linker only (overlay ordering)
131 */
132
133	.bss_start __rel_dyn_start (OVERLAY) : {
134		KEEP(*(.__bss_start));
135		__bss_base = .;
136	}
137
138	.bss __bss_base (OVERLAY) : {
139		*(.bss*)
140		 . = ALIGN(4);
141		 __bss_limit = .;
142	}
143
144	.bss_end __bss_limit (OVERLAY) : {
145		KEEP(*(.__bss_end));
146	}
147
148	.dynsym _image_binary_end : { *(.dynsym) }
149	.dynbss : { *(.dynbss) }
150	.dynstr : { *(.dynstr*) }
151	.dynamic : { *(.dynamic*) }
152	.plt : { *(.plt*) }
153	.interp : { *(.interp*) }
154	.gnu.hash : { *(.gnu.hash) }
155	.gnu : { *(.gnu*) }
156	.ARM.exidx : { *(.ARM.exidx*) }
157	.gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
158}
159