blob: 9a47770114d49db0663b6f611ab7872cd0ab2755 [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
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070026SECTIONS
27{
28 . = TEXTADDR;
29 .init : { /* Init code and data */
30 _stext = .;
31 _sinittext = .;
32 *(.init.text)
33 _einittext = .;
34 __proc_info_begin = .;
Ben Dooks02b7dd12005-09-20 16:35:03 +010035 *(.proc.info.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 __proc_info_end = .;
37 __arch_info_begin = .;
Ben Dooks9d0fd1e2005-09-20 16:45:20 +010038 *(.arch.info.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 __arch_info_end = .;
40 __tagtable_begin = .;
Ben Dooks95060572005-09-20 16:20:49 +010041 *(.taglist.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 __tagtable_end = .;
43 . = ALIGN(16);
44 __setup_start = .;
45 *(.init.setup)
46 __setup_end = .;
47 __early_begin = .;
Ben Dooksbfe68152005-09-20 16:25:12 +010048 *(.early_param.init)
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 __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
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 RODATA
102
103 _etext = .; /* End of text and rodata section */
104
105#ifdef CONFIG_XIP_KERNEL
106 __data_loc = ALIGN(4); /* location in binary */
Nicolas Pitre37d07b72005-10-29 21:44:56 +0100107 . = KERNEL_RAM_ADDR;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108#else
Russell King4f7a1812005-05-05 13:11:00 +0100109 . = ALIGN(THREAD_SIZE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110 __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 /*
Nicolas Pitre13b1f642005-10-13 22:04:37 +0100143 * 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 /*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700151 * 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
Russell King728f5c02005-11-17 16:43:14 +0000175/*
176 * These must never be empty
177 * If you have to comment these two assert statements out, your
178 * binutils is too old (for other reasons as well)
179 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180ASSERT((__proc_info_end - __proc_info_begin), "missing CPU support")
181ASSERT((__arch_info_end - __arch_info_begin), "no machine record defined")