blob: f784d2f341496f1ba095ef662720d33916208b52 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef LOAD_OFFSET
2#define LOAD_OFFSET 0
3#endif
4
5#ifndef VMLINUX_SYMBOL
6#define VMLINUX_SYMBOL(_sym_) _sym_
7#endif
8
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +00009/* Align . to a 8 byte boundary equals to maximum function alignment. */
10#define ALIGN_FUNCTION() . = ALIGN(8)
11
Sam Ravnborgeb8f6892008-01-20 20:07:28 +010012/* The actual configuration determine if the init/exit sections
13 * are handled as text/data or they can be discarded (which
14 * often happens at runtime)
15 */
16#ifdef CONFIG_HOTPLUG
17#define DEV_KEEP(sec) *(.dev##sec)
18#define DEV_DISCARD(sec)
19#else
20#define DEV_KEEP(sec)
21#define DEV_DISCARD(sec) *(.dev##sec)
22#endif
23
24#ifdef CONFIG_HOTPLUG_CPU
25#define CPU_KEEP(sec) *(.cpu##sec)
26#define CPU_DISCARD(sec)
27#else
28#define CPU_KEEP(sec)
29#define CPU_DISCARD(sec) *(.cpu##sec)
30#endif
31
Adrian Bunk1a3fb6d2008-01-24 22:20:18 +010032#if defined(CONFIG_MEMORY_HOTPLUG)
Sam Ravnborgeb8f6892008-01-20 20:07:28 +010033#define MEM_KEEP(sec) *(.mem##sec)
34#define MEM_DISCARD(sec)
35#else
36#define MEM_KEEP(sec)
37#define MEM_DISCARD(sec) *(.mem##sec)
38#endif
39
40
Sam Ravnborgca967252007-05-17 13:38:44 +020041/* .data section */
42#define DATA_DATA \
Sam Ravnborg0e0d3142007-05-17 20:14:48 +020043 *(.data) \
Mathieu Desnoyers8256e472007-10-18 23:41:06 -070044 *(.data.init.refok) \
Sam Ravnborg312b1482008-01-28 20:21:15 +010045 *(.ref.data) \
Sam Ravnborgeb8f6892008-01-20 20:07:28 +010046 DEV_KEEP(init.data) \
47 DEV_KEEP(exit.data) \
48 CPU_KEEP(init.data) \
49 CPU_KEEP(exit.data) \
50 MEM_KEEP(init.data) \
51 MEM_KEEP(exit.data) \
Mathieu Desnoyers8256e472007-10-18 23:41:06 -070052 . = ALIGN(8); \
53 VMLINUX_SYMBOL(__start___markers) = .; \
54 *(__markers) \
55 VMLINUX_SYMBOL(__stop___markers) = .;
Sam Ravnborgca967252007-05-17 13:38:44 +020056
Sam Ravnborg4096b462007-05-29 21:29:00 +020057#define RO_DATA(align) \
58 . = ALIGN((align)); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
Vivek Goyal65695802006-12-07 02:14:03 +010060 VMLINUX_SYMBOL(__start_rodata) = .; \
Linus Torvalds1da177e2005-04-16 15:20:36 -070061 *(.rodata) *(.rodata.*) \
62 *(__vermagic) /* Kernel version magic */ \
Mathieu Desnoyers8256e472007-10-18 23:41:06 -070063 *(__markers_strings) /* Markers: strings */ \
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 } \
65 \
66 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
67 *(.rodata1) \
68 } \
69 \
70 /* PCI quirks */ \
71 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
72 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
73 *(.pci_fixup_early) \
74 VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
75 VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
76 *(.pci_fixup_header) \
77 VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
78 VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
79 *(.pci_fixup_final) \
80 VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
81 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
82 *(.pci_fixup_enable) \
83 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
Alan Cox1597cac2006-12-04 15:14:45 -080084 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
85 *(.pci_fixup_resume) \
86 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 } \
88 \
Matt Porter394b7012005-11-07 01:00:15 -080089 /* RapidIO route ops */ \
90 .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \
91 VMLINUX_SYMBOL(__start_rio_route_ops) = .; \
92 *(.rio_route_ops) \
93 VMLINUX_SYMBOL(__end_rio_route_ops) = .; \
94 } \
95 \
Linus Torvalds1da177e2005-04-16 15:20:36 -070096 /* Kernel symbol table: Normal symbols */ \
97 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
98 VMLINUX_SYMBOL(__start___ksymtab) = .; \
99 *(__ksymtab) \
100 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
101 } \
102 \
103 /* Kernel symbol table: GPL-only symbols */ \
104 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
105 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
106 *(__ksymtab_gpl) \
107 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
108 } \
109 \
Arjan van de Venf71d20e2006-06-28 04:26:45 -0700110 /* Kernel symbol table: Normal unused symbols */ \
111 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
112 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
113 *(__ksymtab_unused) \
114 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
115 } \
116 \
117 /* Kernel symbol table: GPL-only unused symbols */ \
118 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
119 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
120 *(__ksymtab_unused_gpl) \
121 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
122 } \
123 \
Greg Kroah-Hartman9f28bb72006-03-20 13:17:13 -0800124 /* Kernel symbol table: GPL-future-only symbols */ \
125 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
126 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
127 *(__ksymtab_gpl_future) \
128 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
129 } \
130 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 /* Kernel symbol table: Normal symbols */ \
132 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
133 VMLINUX_SYMBOL(__start___kcrctab) = .; \
134 *(__kcrctab) \
135 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
136 } \
137 \
138 /* Kernel symbol table: GPL-only symbols */ \
139 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
140 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
141 *(__kcrctab_gpl) \
142 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
143 } \
144 \
Arjan van de Venf71d20e2006-06-28 04:26:45 -0700145 /* Kernel symbol table: Normal unused symbols */ \
146 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
147 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
148 *(__kcrctab_unused) \
149 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
150 } \
151 \
152 /* Kernel symbol table: GPL-only unused symbols */ \
153 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
154 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
155 *(__kcrctab_unused_gpl) \
156 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
157 } \
158 \
Greg Kroah-Hartman9f28bb72006-03-20 13:17:13 -0800159 /* Kernel symbol table: GPL-future-only symbols */ \
160 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
161 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
162 *(__kcrctab_gpl_future) \
163 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
164 } \
165 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166 /* Kernel symbol table: strings */ \
167 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
168 *(__ksymtab_strings) \
169 } \
170 \
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100171 /* __*init sections */ \
172 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
Sam Ravnborg312b1482008-01-28 20:21:15 +0100173 *(.ref.rodata) \
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100174 DEV_KEEP(init.rodata) \
175 DEV_KEEP(exit.rodata) \
176 CPU_KEEP(init.rodata) \
177 CPU_KEEP(exit.rodata) \
178 MEM_KEEP(init.rodata) \
179 MEM_KEEP(exit.rodata) \
180 } \
181 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700182 /* Built-in module parameters. */ \
183 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
184 VMLINUX_SYMBOL(__start___param) = .; \
185 *(__param) \
186 VMLINUX_SYMBOL(__stop___param) = .; \
Arjan van de Venedeed302008-01-30 13:34:08 +0100187 . = ALIGN((align)); \
Vivek Goyal65695802006-12-07 02:14:03 +0100188 VMLINUX_SYMBOL(__end_rodata) = .; \
Marcelo Tosatti7583ddf2006-09-27 01:51:02 -0700189 } \
Sam Ravnborg4096b462007-05-29 21:29:00 +0200190 . = ALIGN((align));
191
192/* RODATA provided for backward compatibility.
193 * All archs are supposed to use RO_DATA() */
194#define RODATA RO_DATA(4096)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195
196#define SECURITY_INIT \
Eric W. Biederman60bad7f2005-06-25 14:57:46 -0700197 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700198 VMLINUX_SYMBOL(__security_initcall_start) = .; \
199 *(.security_initcall.init) \
200 VMLINUX_SYMBOL(__security_initcall_end) = .; \
201 }
202
Sam Ravnborg76647092007-05-13 00:31:33 +0200203/* .text section. Map to function alignment to avoid address changes
204 * during second ld run in second ld pass when generating System.map */
205#define TEXT_TEXT \
206 ALIGN_FUNCTION(); \
Sam Ravnborg0e0d3142007-05-17 20:14:48 +0200207 *(.text) \
Sam Ravnborg312b1482008-01-28 20:21:15 +0100208 *(.ref.text) \
Al Viro23ec23c2007-10-13 08:40:24 +0100209 *(.text.init.refok) \
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100210 *(.exit.text.refok) \
211 DEV_KEEP(init.text) \
212 DEV_KEEP(exit.text) \
213 CPU_KEEP(init.text) \
214 CPU_KEEP(exit.text) \
215 MEM_KEEP(init.text) \
216 MEM_KEEP(exit.text)
217
Sam Ravnborg76647092007-05-13 00:31:33 +0200218
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000219/* sched.text is aling to function alignment to secure we have same
220 * address even at second ld pass when generating System.map */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221#define SCHED_TEXT \
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000222 ALIGN_FUNCTION(); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700223 VMLINUX_SYMBOL(__sched_text_start) = .; \
224 *(.sched.text) \
225 VMLINUX_SYMBOL(__sched_text_end) = .;
226
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000227/* spinlock.text is aling to function alignment to secure we have same
228 * address even at second ld pass when generating System.map */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700229#define LOCK_TEXT \
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000230 ALIGN_FUNCTION(); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 VMLINUX_SYMBOL(__lock_text_start) = .; \
232 *(.spinlock.text) \
233 VMLINUX_SYMBOL(__lock_text_end) = .;
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -0700234
235#define KPROBES_TEXT \
236 ALIGN_FUNCTION(); \
237 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
238 *(.kprobes.text) \
239 VMLINUX_SYMBOL(__kprobes_text_end) = .;
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200240
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100241/* init and exit section handling */
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100242#define INIT_DATA \
243 *(.init.data) \
244 DEV_DISCARD(init.data) \
245 DEV_DISCARD(init.rodata) \
246 CPU_DISCARD(init.data) \
247 CPU_DISCARD(init.rodata) \
248 MEM_DISCARD(init.data) \
249 MEM_DISCARD(init.rodata)
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100250
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100251#define INIT_TEXT \
252 *(.init.text) \
253 DEV_DISCARD(init.text) \
254 CPU_DISCARD(init.text) \
255 MEM_DISCARD(init.text)
256
257#define EXIT_DATA \
258 *(.exit.data) \
259 DEV_DISCARD(exit.data) \
260 DEV_DISCARD(exit.rodata) \
261 CPU_DISCARD(exit.data) \
262 CPU_DISCARD(exit.rodata) \
263 MEM_DISCARD(exit.data) \
264 MEM_DISCARD(exit.rodata)
265
266#define EXIT_TEXT \
267 *(.exit.text) \
268 DEV_DISCARD(exit.text) \
269 CPU_DISCARD(exit.text) \
270 MEM_DISCARD(exit.text)
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100271
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200272 /* DWARF debug sections.
273 Symbols in the DWARF debugging sections are relative to
274 the beginning of the section so we begin them at 0. */
275#define DWARF_DEBUG \
276 /* DWARF 1 */ \
277 .debug 0 : { *(.debug) } \
278 .line 0 : { *(.line) } \
279 /* GNU DWARF 1 extensions */ \
280 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
281 .debug_sfnames 0 : { *(.debug_sfnames) } \
282 /* DWARF 1.1 and DWARF 2 */ \
283 .debug_aranges 0 : { *(.debug_aranges) } \
284 .debug_pubnames 0 : { *(.debug_pubnames) } \
285 /* DWARF 2 */ \
286 .debug_info 0 : { *(.debug_info \
287 .gnu.linkonce.wi.*) } \
288 .debug_abbrev 0 : { *(.debug_abbrev) } \
289 .debug_line 0 : { *(.debug_line) } \
290 .debug_frame 0 : { *(.debug_frame) } \
291 .debug_str 0 : { *(.debug_str) } \
292 .debug_loc 0 : { *(.debug_loc) } \
293 .debug_macinfo 0 : { *(.debug_macinfo) } \
294 /* SGI/MIPS DWARF 2 extensions */ \
295 .debug_weaknames 0 : { *(.debug_weaknames) } \
296 .debug_funcnames 0 : { *(.debug_funcnames) } \
297 .debug_typenames 0 : { *(.debug_typenames) } \
298 .debug_varnames 0 : { *(.debug_varnames) } \
299
300 /* Stabs debugging sections. */
301#define STABS_DEBUG \
302 .stab 0 : { *(.stab) } \
303 .stabstr 0 : { *(.stabstr) } \
304 .stab.excl 0 : { *(.stab.excl) } \
305 .stab.exclstr 0 : { *(.stab.exclstr) } \
306 .stab.index 0 : { *(.stab.index) } \
307 .stab.indexstr 0 : { *(.stab.indexstr) } \
308 .comment 0 : { *(.comment) }
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700309
Jeremy Fitzhardinge7664c5a2006-12-08 02:36:19 -0800310#define BUG_TABLE \
311 . = ALIGN(8); \
312 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
313 __start___bug_table = .; \
314 *(__bug_table) \
315 __stop___bug_table = .; \
316 }
317
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700318#define NOTES \
Roland McGrathcbe87122007-07-19 01:48:36 -0700319 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
320 VMLINUX_SYMBOL(__start_notes) = .; \
321 *(.note.*) \
322 VMLINUX_SYMBOL(__stop_notes) = .; \
323 }
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700324
325#define INITCALLS \
Linus Torvaldsb3438f82006-11-20 11:47:18 -0800326 *(.initcall0.init) \
327 *(.initcall0s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700328 *(.initcall1.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700329 *(.initcall1s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700330 *(.initcall2.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700331 *(.initcall2s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700332 *(.initcall3.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700333 *(.initcall3s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700334 *(.initcall4.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700335 *(.initcall4s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700336 *(.initcall5.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700337 *(.initcall5s.init) \
Linus Torvalds8d610dd2006-12-11 12:12:04 -0800338 *(.initcallrootfs.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700339 *(.initcall6.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700340 *(.initcall6s.init) \
341 *(.initcall7.init) \
342 *(.initcall7s.init)
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700343
Fenghua Yu5fb7dc32007-07-19 01:48:12 -0700344#define PERCPU(align) \
345 . = ALIGN(align); \
346 __per_cpu_start = .; \
347 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
348 *(.data.percpu) \
349 *(.data.percpu.shared_aligned) \
350 } \
351 __per_cpu_end = .;