xref: /linux/arch/arm/kernel/vmlinux.lds.S (revision 5e8d780d745c1619aba81fe7166c5a4b5cad2b84)
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
20SECTIONS
21{
22#ifdef CONFIG_XIP_KERNEL
23	. = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
24#else
25	. = PAGE_OFFSET + TEXT_OFFSET;
26#endif
27	.init : {			/* Init code and data		*/
28		_stext = .;
29			_sinittext = .;
30			*(.init.text)
31			_einittext = .;
32		__proc_info_begin = .;
33			*(.proc.info.init)
34		__proc_info_end = .;
35		__arch_info_begin = .;
36			*(.arch.info.init)
37		__arch_info_end = .;
38		__tagtable_begin = .;
39			*(.taglist.init)
40		__tagtable_end = .;
41		. = ALIGN(16);
42		__setup_start = .;
43			*(.init.setup)
44		__setup_end = .;
45		__early_begin = .;
46			*(.early_param.init)
47		__early_end = .;
48		__initcall_start = .;
49			*(.initcall1.init)
50			*(.initcall2.init)
51			*(.initcall3.init)
52			*(.initcall4.init)
53			*(.initcall5.init)
54			*(.initcall6.init)
55			*(.initcall7.init)
56		__initcall_end = .;
57		__con_initcall_start = .;
58			*(.con_initcall.init)
59		__con_initcall_end = .;
60		__security_initcall_start = .;
61			*(.security_initcall.init)
62		__security_initcall_end = .;
63		. = ALIGN(32);
64		__initramfs_start = .;
65			usr/built-in.o(.init.ramfs)
66		__initramfs_end = .;
67		. = ALIGN(64);
68		__per_cpu_start = .;
69			*(.data.percpu)
70		__per_cpu_end = .;
71#ifndef CONFIG_XIP_KERNEL
72		__init_begin = _stext;
73		*(.init.data)
74		. = ALIGN(4096);
75		__init_end = .;
76#endif
77	}
78
79	/DISCARD/ : {			/* Exit code and data		*/
80		*(.exit.text)
81		*(.exit.data)
82		*(.exitcall.exit)
83#ifndef CONFIG_MMU
84		*(.fixup)
85		*(__ex_table)
86#endif
87	}
88
89	.text : {			/* Real text segment		*/
90		_text = .;		/* Text and read-only data	*/
91			*(.text)
92			SCHED_TEXT
93			LOCK_TEXT
94#ifdef CONFIG_MMU
95			*(.fixup)
96#endif
97			*(.gnu.warning)
98			*(.rodata)
99			*(.rodata.*)
100			*(.glue_7)
101			*(.glue_7t)
102		*(.got)			/* Global offset table		*/
103	}
104
105	RODATA
106
107	_etext = .;			/* End of text and rodata section */
108
109#ifdef CONFIG_XIP_KERNEL
110	__data_loc = ALIGN(4);		/* location in binary */
111	. = PAGE_OFFSET + TEXT_OFFSET;
112#else
113	. = ALIGN(THREAD_SIZE);
114	__data_loc = .;
115#endif
116
117	.data : AT(__data_loc) {
118		__data_start = .;	/* address in memory */
119
120		/*
121		 * first, the init task union, aligned
122		 * to an 8192 byte boundary.
123		 */
124		*(.init.task)
125
126#ifdef CONFIG_XIP_KERNEL
127		. = ALIGN(4096);
128		__init_begin = .;
129		*(.init.data)
130		. = ALIGN(4096);
131		__init_end = .;
132#endif
133
134		. = ALIGN(4096);
135		__nosave_begin = .;
136		*(.data.nosave)
137		. = ALIGN(4096);
138		__nosave_end = .;
139
140		/*
141		 * then the cacheline aligned data
142		 */
143		. = ALIGN(32);
144		*(.data.cacheline_aligned)
145
146		/*
147		 * The exception fixup table (might need resorting at runtime)
148		 */
149		. = ALIGN(32);
150		__start___ex_table = .;
151#ifdef CONFIG_MMU
152		*(__ex_table)
153#endif
154		__stop___ex_table = .;
155
156		/*
157		 * and the usual data section
158		 */
159		*(.data)
160		CONSTRUCTORS
161
162		_edata = .;
163	}
164
165	.bss : {
166		__bss_start = .;	/* BSS				*/
167		*(.bss)
168		*(COMMON)
169		_end = .;
170	}
171					/* Stabs debugging sections.	*/
172	.stab 0 : { *(.stab) }
173	.stabstr 0 : { *(.stabstr) }
174	.stab.excl 0 : { *(.stab.excl) }
175	.stab.exclstr 0 : { *(.stab.exclstr) }
176	.stab.index 0 : { *(.stab.index) }
177	.stab.indexstr 0 : { *(.stab.indexstr) }
178	.comment 0 : { *(.comment) }
179}
180
181/*
182 * These must never be empty
183 * If you have to comment these two assert statements out, your
184 * binutils is too old (for other reasons as well)
185 */
186ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
187ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
188