blob: 2df9688a70282fca86ac0fb854a64da305961111 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* 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>
Russell King4f7a1812005-05-05 13:11:00 +01008#include <asm/thread_info.h>
Nicolas Pitre37d07b72005-10-29 21:44:56 +01009#include <asm/memory.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11OUTPUT_ARCH(arm)
12ENTRY(stext)
Nicolas Pitre37d07b72005-10-29 21:44:56 +010013
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#ifndef __ARMEB__
15jiffies = jiffies_64;
16#else
17jiffies = jiffies_64 + 4;
18#endif
Nicolas Pitre37d07b72005-10-29 21:44:56 +010019
Linus Torvalds1da177e2005-04-16 15:20:36 -070020SECTIONS
21{
Russell King9d4f13e2006-01-03 17:28:33 +000022#ifdef CONFIG_XIP_KERNEL
23 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
24#else
25 . = PAGE_OFFSET + TEXT_OFFSET;
26#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070027 .init : { /* Init code and data */
28 _stext = .;
29 _sinittext = .;
30 *(.init.text)
31 _einittext = .;
32 __proc_info_begin = .;
Ben Dooks02b7dd12005-09-20 16:35:03 +010033 *(.proc.info.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 __proc_info_end = .;
35 __arch_info_begin = .;
Ben Dooks9d0fd1e2005-09-20 16:45:20 +010036 *(.arch.info.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070037 __arch_info_end = .;
38 __tagtable_begin = .;
Ben Dooks95060572005-09-20 16:20:49 +010039 *(.taglist.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 __tagtable_end = .;
41 . = ALIGN(16);
42 __setup_start = .;
43 *(.init.setup)
44 __setup_end = .;
45 __early_begin = .;
Ben Dooksbfe68152005-09-20 16:25:12 +010046 *(.early_param.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 __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)
Russell King9641c7c2006-06-21 20:38:17 +010083#ifndef CONFIG_MMU
84 *(.fixup)
85 *(__ex_table)
86#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 }
88
89 .text : { /* Real text segment */
90 _text = .; /* Text and read-only data */
91 *(.text)
92 SCHED_TEXT
93 LOCK_TEXT
Russell King9641c7c2006-06-21 20:38:17 +010094#ifdef CONFIG_MMU
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 *(.fixup)
Russell King9641c7c2006-06-21 20:38:17 +010096#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 *(.gnu.warning)
98 *(.rodata)
99 *(.rodata.*)
100 *(.glue_7)
101 *(.glue_7t)
102 *(.got) /* Global offset table */
103 }
104
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 RODATA
106
107 _etext = .; /* End of text and rodata section */
108
109#ifdef CONFIG_XIP_KERNEL
110 __data_loc = ALIGN(4); /* location in binary */
Russell King9d4f13e2006-01-03 17:28:33 +0000111 . = PAGE_OFFSET + TEXT_OFFSET;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112#else
Russell King4f7a1812005-05-05 13:11:00 +0100113 . = ALIGN(THREAD_SIZE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700114 __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 /*
Nicolas Pitre13b1f642005-10-13 22:04:37 +0100147 * The exception fixup table (might need resorting at runtime)
148 */
149 . = ALIGN(32);
150 __start___ex_table = .;
Russell King9641c7c2006-06-21 20:38:17 +0100151#ifdef CONFIG_MMU
Nicolas Pitre13b1f642005-10-13 22:04:37 +0100152 *(__ex_table)
Russell King9641c7c2006-06-21 20:38:17 +0100153#endif
Nicolas Pitre13b1f642005-10-13 22:04:37 +0100154 __stop___ex_table = .;
155
156 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157 * 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
Russell King728f5c02005-11-17 16:43:14 +0000181/*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
187ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")