xref: /linux/arch/arm/kernel/vmlinux.lds.S (revision f3d9478b2ce468c3115b02ecae7e975990697f15)
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	}
84
85	.text : {			/* Real text segment		*/
86		_text = .;		/* Text and read-only data	*/
87			*(.text)
88			SCHED_TEXT
89			LOCK_TEXT
90			*(.fixup)
91			*(.gnu.warning)
92			*(.rodata)
93			*(.rodata.*)
94			*(.glue_7)
95			*(.glue_7t)
96		*(.got)			/* Global offset table		*/
97	}
98
99	RODATA
100
101	_etext = .;			/* End of text and rodata section */
102
103#ifdef CONFIG_XIP_KERNEL
104	__data_loc = ALIGN(4);		/* location in binary */
105	. = PAGE_OFFSET + TEXT_OFFSET;
106#else
107	. = ALIGN(THREAD_SIZE);
108	__data_loc = .;
109#endif
110
111	.data : AT(__data_loc) {
112		__data_start = .;	/* address in memory */
113
114		/*
115		 * first, the init task union, aligned
116		 * to an 8192 byte boundary.
117		 */
118		*(.init.task)
119
120#ifdef CONFIG_XIP_KERNEL
121		. = ALIGN(4096);
122		__init_begin = .;
123		*(.init.data)
124		. = ALIGN(4096);
125		__init_end = .;
126#endif
127
128		. = ALIGN(4096);
129		__nosave_begin = .;
130		*(.data.nosave)
131		. = ALIGN(4096);
132		__nosave_end = .;
133
134		/*
135		 * then the cacheline aligned data
136		 */
137		. = ALIGN(32);
138		*(.data.cacheline_aligned)
139
140		/*
141		 * The exception fixup table (might need resorting at runtime)
142		 */
143		. = ALIGN(32);
144		__start___ex_table = .;
145		*(__ex_table)
146		__stop___ex_table = .;
147
148		/*
149		 * and the usual data section
150		 */
151		*(.data)
152		CONSTRUCTORS
153
154		_edata = .;
155	}
156
157	.bss : {
158		__bss_start = .;	/* BSS				*/
159		*(.bss)
160		*(COMMON)
161		_end = .;
162	}
163					/* Stabs debugging sections.	*/
164	.stab 0 : { *(.stab) }
165	.stabstr 0 : { *(.stabstr) }
166	.stab.excl 0 : { *(.stab.excl) }
167	.stab.exclstr 0 : { *(.stab.exclstr) }
168	.stab.index 0 : { *(.stab.index) }
169	.stab.indexstr 0 : { *(.stab.indexstr) }
170	.comment 0 : { *(.comment) }
171}
172
173/*
174 * These must never be empty
175 * If you have to comment these two assert statements out, your
176 * binutils is too old (for other reasons as well)
177 */
178ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
179ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")
180