blob: 8d71a40625f31c96433396749cb549ac280aadd3 [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 \
David Woodhouse5658c762008-05-23 13:52:42 +010089 /* Built-in firmware blobs */ \
90 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
91 VMLINUX_SYMBOL(__start_builtin_fw) = .; \
92 *(.builtin_fw) \
93 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
94 } \
95 \
Matt Porter394b7012005-11-07 01:00:15 -080096 /* RapidIO route ops */ \
97 .rio_route : AT(ADDR(.rio_route) - LOAD_OFFSET) { \
98 VMLINUX_SYMBOL(__start_rio_route_ops) = .; \
99 *(.rio_route_ops) \
100 VMLINUX_SYMBOL(__end_rio_route_ops) = .; \
101 } \
102 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 /* Kernel symbol table: Normal symbols */ \
104 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
105 VMLINUX_SYMBOL(__start___ksymtab) = .; \
106 *(__ksymtab) \
107 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
108 } \
109 \
110 /* Kernel symbol table: GPL-only symbols */ \
111 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
112 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
113 *(__ksymtab_gpl) \
114 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
115 } \
116 \
Arjan van de Venf71d20e2006-06-28 04:26:45 -0700117 /* Kernel symbol table: Normal unused symbols */ \
118 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
119 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
120 *(__ksymtab_unused) \
121 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
122 } \
123 \
124 /* Kernel symbol table: GPL-only unused symbols */ \
125 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
126 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
127 *(__ksymtab_unused_gpl) \
128 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
129 } \
130 \
Greg Kroah-Hartman9f28bb72006-03-20 13:17:13 -0800131 /* Kernel symbol table: GPL-future-only symbols */ \
132 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
133 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
134 *(__ksymtab_gpl_future) \
135 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
136 } \
137 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 /* Kernel symbol table: Normal symbols */ \
139 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
140 VMLINUX_SYMBOL(__start___kcrctab) = .; \
141 *(__kcrctab) \
142 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
143 } \
144 \
145 /* Kernel symbol table: GPL-only symbols */ \
146 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
147 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
148 *(__kcrctab_gpl) \
149 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
150 } \
151 \
Arjan van de Venf71d20e2006-06-28 04:26:45 -0700152 /* Kernel symbol table: Normal unused symbols */ \
153 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
154 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
155 *(__kcrctab_unused) \
156 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
157 } \
158 \
159 /* Kernel symbol table: GPL-only unused symbols */ \
160 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
161 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
162 *(__kcrctab_unused_gpl) \
163 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
164 } \
165 \
Greg Kroah-Hartman9f28bb72006-03-20 13:17:13 -0800166 /* Kernel symbol table: GPL-future-only symbols */ \
167 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
168 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
169 *(__kcrctab_gpl_future) \
170 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
171 } \
172 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173 /* Kernel symbol table: strings */ \
174 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
175 *(__ksymtab_strings) \
176 } \
177 \
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100178 /* __*init sections */ \
179 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
Sam Ravnborg312b1482008-01-28 20:21:15 +0100180 *(.ref.rodata) \
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100181 DEV_KEEP(init.rodata) \
182 DEV_KEEP(exit.rodata) \
183 CPU_KEEP(init.rodata) \
184 CPU_KEEP(exit.rodata) \
185 MEM_KEEP(init.rodata) \
186 MEM_KEEP(exit.rodata) \
187 } \
188 \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 /* Built-in module parameters. */ \
190 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
191 VMLINUX_SYMBOL(__start___param) = .; \
192 *(__param) \
193 VMLINUX_SYMBOL(__stop___param) = .; \
Arjan van de Venedeed302008-01-30 13:34:08 +0100194 . = ALIGN((align)); \
Vivek Goyal65695802006-12-07 02:14:03 +0100195 VMLINUX_SYMBOL(__end_rodata) = .; \
Marcelo Tosatti7583ddf2006-09-27 01:51:02 -0700196 } \
Sam Ravnborg4096b462007-05-29 21:29:00 +0200197 . = ALIGN((align));
198
199/* RODATA provided for backward compatibility.
200 * All archs are supposed to use RO_DATA() */
201#define RODATA RO_DATA(4096)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700202
203#define SECURITY_INIT \
Eric W. Biederman60bad7f2005-06-25 14:57:46 -0700204 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 VMLINUX_SYMBOL(__security_initcall_start) = .; \
206 *(.security_initcall.init) \
207 VMLINUX_SYMBOL(__security_initcall_end) = .; \
208 }
209
Sam Ravnborg76647092007-05-13 00:31:33 +0200210/* .text section. Map to function alignment to avoid address changes
211 * during second ld run in second ld pass when generating System.map */
212#define TEXT_TEXT \
213 ALIGN_FUNCTION(); \
Sam Ravnborg0e0d3142007-05-17 20:14:48 +0200214 *(.text) \
Sam Ravnborg312b1482008-01-28 20:21:15 +0100215 *(.ref.text) \
Al Viro23ec23c2007-10-13 08:40:24 +0100216 *(.text.init.refok) \
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100217 *(.exit.text.refok) \
218 DEV_KEEP(init.text) \
219 DEV_KEEP(exit.text) \
220 CPU_KEEP(init.text) \
221 CPU_KEEP(exit.text) \
222 MEM_KEEP(init.text) \
223 MEM_KEEP(exit.text)
224
Sam Ravnborg76647092007-05-13 00:31:33 +0200225
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000226/* sched.text is aling to function alignment to secure we have same
227 * address even at second ld pass when generating System.map */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228#define SCHED_TEXT \
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000229 ALIGN_FUNCTION(); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 VMLINUX_SYMBOL(__sched_text_start) = .; \
231 *(.sched.text) \
232 VMLINUX_SYMBOL(__sched_text_end) = .;
233
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000234/* spinlock.text is aling to function alignment to secure we have same
235 * address even at second ld pass when generating System.map */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700236#define LOCK_TEXT \
Sam Ravnborg6d30e3a2005-07-14 20:15:44 +0000237 ALIGN_FUNCTION(); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 VMLINUX_SYMBOL(__lock_text_start) = .; \
239 *(.spinlock.text) \
240 VMLINUX_SYMBOL(__lock_text_end) = .;
Prasanna S Panchamukhid0aaff92005-09-06 15:19:26 -0700241
242#define KPROBES_TEXT \
243 ALIGN_FUNCTION(); \
244 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
245 *(.kprobes.text) \
246 VMLINUX_SYMBOL(__kprobes_text_end) = .;
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200247
Sam Ravnborg37c514e2008-02-19 21:00:18 +0100248/* Section used for early init (in .S files) */
249#define HEAD_TEXT *(.head.text)
250
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100251/* init and exit section handling */
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100252#define INIT_DATA \
253 *(.init.data) \
254 DEV_DISCARD(init.data) \
255 DEV_DISCARD(init.rodata) \
256 CPU_DISCARD(init.data) \
257 CPU_DISCARD(init.rodata) \
258 MEM_DISCARD(init.data) \
259 MEM_DISCARD(init.rodata)
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100260
Sam Ravnborgeb8f6892008-01-20 20:07:28 +0100261#define INIT_TEXT \
262 *(.init.text) \
263 DEV_DISCARD(init.text) \
264 CPU_DISCARD(init.text) \
265 MEM_DISCARD(init.text)
266
267#define EXIT_DATA \
268 *(.exit.data) \
269 DEV_DISCARD(exit.data) \
270 DEV_DISCARD(exit.rodata) \
271 CPU_DISCARD(exit.data) \
272 CPU_DISCARD(exit.rodata) \
273 MEM_DISCARD(exit.data) \
274 MEM_DISCARD(exit.rodata)
275
276#define EXIT_TEXT \
277 *(.exit.text) \
278 DEV_DISCARD(exit.text) \
279 CPU_DISCARD(exit.text) \
280 MEM_DISCARD(exit.text)
Sam Ravnborg01ba2bd2008-01-20 14:15:03 +0100281
Paolo 'Blaisorblade' Giarrussoa7d0c212005-09-10 19:44:54 +0200282 /* DWARF debug sections.
283 Symbols in the DWARF debugging sections are relative to
284 the beginning of the section so we begin them at 0. */
285#define DWARF_DEBUG \
286 /* DWARF 1 */ \
287 .debug 0 : { *(.debug) } \
288 .line 0 : { *(.line) } \
289 /* GNU DWARF 1 extensions */ \
290 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
291 .debug_sfnames 0 : { *(.debug_sfnames) } \
292 /* DWARF 1.1 and DWARF 2 */ \
293 .debug_aranges 0 : { *(.debug_aranges) } \
294 .debug_pubnames 0 : { *(.debug_pubnames) } \
295 /* DWARF 2 */ \
296 .debug_info 0 : { *(.debug_info \
297 .gnu.linkonce.wi.*) } \
298 .debug_abbrev 0 : { *(.debug_abbrev) } \
299 .debug_line 0 : { *(.debug_line) } \
300 .debug_frame 0 : { *(.debug_frame) } \
301 .debug_str 0 : { *(.debug_str) } \
302 .debug_loc 0 : { *(.debug_loc) } \
303 .debug_macinfo 0 : { *(.debug_macinfo) } \
304 /* SGI/MIPS DWARF 2 extensions */ \
305 .debug_weaknames 0 : { *(.debug_weaknames) } \
306 .debug_funcnames 0 : { *(.debug_funcnames) } \
307 .debug_typenames 0 : { *(.debug_typenames) } \
308 .debug_varnames 0 : { *(.debug_varnames) } \
309
310 /* Stabs debugging sections. */
311#define STABS_DEBUG \
312 .stab 0 : { *(.stab) } \
313 .stabstr 0 : { *(.stabstr) } \
314 .stab.excl 0 : { *(.stab.excl) } \
315 .stab.exclstr 0 : { *(.stab.exclstr) } \
316 .stab.index 0 : { *(.stab.index) } \
317 .stab.indexstr 0 : { *(.stab.indexstr) } \
318 .comment 0 : { *(.comment) }
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700319
Jeremy Fitzhardinge7664c5a2006-12-08 02:36:19 -0800320#define BUG_TABLE \
321 . = ALIGN(8); \
322 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
323 __start___bug_table = .; \
324 *(__bug_table) \
325 __stop___bug_table = .; \
326 }
327
Jeremy Fitzhardinge9c9b8b32006-09-25 23:32:26 -0700328#define NOTES \
Roland McGrathcbe87122007-07-19 01:48:36 -0700329 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
330 VMLINUX_SYMBOL(__start_notes) = .; \
331 *(.note.*) \
332 VMLINUX_SYMBOL(__stop_notes) = .; \
333 }
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700334
335#define INITCALLS \
Linus Torvaldsb3438f82006-11-20 11:47:18 -0800336 *(.initcall0.init) \
337 *(.initcall0s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700338 *(.initcall1.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700339 *(.initcall1s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700340 *(.initcall2.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700341 *(.initcall2s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700342 *(.initcall3.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700343 *(.initcall3s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700344 *(.initcall4.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700345 *(.initcall4s.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700346 *(.initcall5.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700347 *(.initcall5s.init) \
Linus Torvalds8d610dd2006-12-11 12:12:04 -0800348 *(.initcallrootfs.init) \
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700349 *(.initcall6.init) \
Andrew Morton735a7ff2006-10-27 11:42:37 -0700350 *(.initcall6s.init) \
351 *(.initcall7.init) \
352 *(.initcall7s.init)
Andrew Morton61ce1ef2006-10-27 11:41:44 -0700353
Fenghua Yu5fb7dc32007-07-19 01:48:12 -0700354#define PERCPU(align) \
355 . = ALIGN(align); \
356 __per_cpu_start = .; \
357 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
358 *(.data.percpu) \
359 *(.data.percpu.shared_aligned) \
360 } \
361 __per_cpu_end = .;