xref: /linux/arch/arm/kernel/vmlinux.lds.S (revision 858259cf7d1c443c836a2022b78cb281f0a9b95e)
1/* ld script to make ARM Linux kernel
2 * taken from the i386 version by Russell King
3 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
4 */
5
6#include <asm-generic/vmlinux.lds.h>
7#include <linux/config.h>
8#include <asm/thread_info.h>
9#include <asm/memory.h>
10
11OUTPUT_ARCH(arm)
12ENTRY(stext)
13
14#ifndef __ARMEB__
15jiffies = jiffies_64;
16#else
17jiffies = jiffies_64 + 4;
18#endif
19
20#ifdef CONFIG_XIP_KERNEL
21#define TEXTADDR  XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)
22#else
23#define TEXTADDR  KERNEL_RAM_ADDR
24#endif
25
26SECTIONS
27{
28	. = TEXTADDR;
29	.init : {			/* Init code and data		*/
30		_stext = .;
31			_sinittext = .;
32			*(.init.text)
33			_einittext = .;
34		__proc_info_begin = .;
35			*(.proc.info.init)
36		__proc_info_end = .;
37		__arch_info_begin = .;
38			*(.arch.info.init)
39		__arch_info_end = .;
40		__tagtable_begin = .;
41			*(.taglist.init)
42		__tagtable_end = .;
43		. = ALIGN(16);
44		__setup_start = .;
45			*(.init.setup)
46		__setup_end = .;
47		__early_begin = .;
48			*(.early_param.init)
49		__early_end = .;
50		__initcall_start = .;
51			*(.initcall1.init)
52			*(.initcall2.init)
53			*(.initcall3.init)
54			*(.initcall4.init)
55			*(.initcall5.init)
56			*(.initcall6.init)
57			*(.initcall7.init)
58		__initcall_end = .;
59		__con_initcall_start = .;
60			*(.con_initcall.init)
61		__con_initcall_end = .;
62		__security_initcall_start = .;
63			*(.security_initcall.init)
64		__security_initcall_end = .;
65		. = ALIGN(32);
66		__initramfs_start = .;
67			usr/built-in.o(.init.ramfs)
68		__initramfs_end = .;
69		. = ALIGN(64);
70		__per_cpu_start = .;
71			*(.data.percpu)
72		__per_cpu_end = .;
73#ifndef CONFIG_XIP_KERNEL
74		__init_begin = _stext;
75		*(.init.data)
76		. = ALIGN(4096);
77		__init_end = .;
78#endif
79	}
80
81	/DISCARD/ : {			/* Exit code and data		*/
82		*(.exit.text)
83		*(.exit.data)
84		*(.exitcall.exit)
85	}
86
87	.text : {			/* Real text segment		*/
88		_text = .;		/* Text and read-only data	*/
89			*(.text)
90			SCHED_TEXT
91			LOCK_TEXT
92			*(.fixup)
93			*(.gnu.warning)
94			*(.rodata)
95			*(.rodata.*)
96			*(.glue_7)
97			*(.glue_7t)
98		*(.got)			/* Global offset table		*/
99	}
100
101	RODATA
102
103	_etext = .;			/* End of text and rodata section */
104
105#ifdef CONFIG_XIP_KERNEL
106	__data_loc = ALIGN(4);		/* location in binary */
107	. = KERNEL_RAM_ADDR;
108#else
109	. = ALIGN(THREAD_SIZE);
110	__data_loc = .;
111#endif
112
113	.data : AT(__data_loc) {
114		__data_start = .;	/* address in memory */
115
116		/*
117		 * first, the init task union, aligned
118		 * to an 8192 byte boundary.
119		 */
120		*(.init.task)
121
122#ifdef CONFIG_XIP_KERNEL
123		. = ALIGN(4096);
124		__init_begin = .;
125		*(.init.data)
126		. = ALIGN(4096);
127		__init_end = .;
128#endif
129
130		. = ALIGN(4096);
131		__nosave_begin = .;
132		*(.data.nosave)
133		. = ALIGN(4096);
134		__nosave_end = .;
135
136		/*
137		 * then the cacheline aligned data
138		 */
139		. = ALIGN(32);
140		*(.data.cacheline_aligned)
141
142		/*
143		 * The exception fixup table (might need resorting at runtime)
144		 */
145		. = ALIGN(32);
146		__start___ex_table = .;
147		*(__ex_table)
148		__stop___ex_table = .;
149
150		/*
151		 * and the usual data section
152		 */
153		*(.data)
154		CONSTRUCTORS
155
156		_edata = .;
157	}
158
159	.bss : {
160		__bss_start = .;	/* BSS				*/
161		*(.bss)
162		*(COMMON)
163		_end = .;
164	}
165					/* Stabs debugging sections.	*/
166	.stab 0 : { *(.stab) }
167	.stabstr 0 : { *(.stabstr) }
168	.stab.excl 0 : { *(.stab.excl) }
169	.stab.exclstr 0 : { *(.stab.exclstr) }
170	.stab.index 0 : { *(.stab.index) }
171	.stab.indexstr 0 : { *(.stab.indexstr) }
172	.comment 0 : { *(.comment) }
173}
174
175/* those must never be empty */
176ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
177ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
178