b20409404c7dac724761f2e4df39d228f25b9026
[linux-2.6.git] / include / asm-generic / vmlinux.lds.h
1 #ifndef LOAD_OFFSET
2 #define LOAD_OFFSET 0
3 #endif
4
5 #ifndef VMLINUX_SYMBOL
6 #define VMLINUX_SYMBOL(_sym_) _sym_
7 #endif
8
9 /* Align . to a 8 byte boundary equals to maximum function alignment. */
10 #define ALIGN_FUNCTION()  . = ALIGN(8)
11
12 /* 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
32 #if defined(CONFIG_MEMORY_HOTPLUG)
33 #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
41 /* .data section */
42 #define DATA_DATA                                                       \
43         *(.data)                                                        \
44         *(.data.init.refok)                                             \
45         *(.ref.data)                                                    \
46         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)                                             \
52         . = ALIGN(8);                                                   \
53         VMLINUX_SYMBOL(__start___markers) = .;                          \
54         *(__markers)                                                    \
55         VMLINUX_SYMBOL(__stop___markers) = .;
56
57 #define RO_DATA(align)                                                  \
58         . = ALIGN((align));                                             \
59         .rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {           \
60                 VMLINUX_SYMBOL(__start_rodata) = .;                     \
61                 *(.rodata) *(.rodata.*)                                 \
62                 *(__vermagic)           /* Kernel version magic */      \
63                 *(__markers_strings)    /* Markers: strings */          \
64         }                                                               \
65                                                                         \
66         .rodata1          : AT(ADDR(.rodata1) - LOAD_OFFSET) {          \
67                 *(.rodata1)                                             \
68         }                                                               \
69                                                                         \
70         BUG_TABLE                                                       \
71                                                                         \
72         /* PCI quirks */                                                \
73         .pci_fixup        : AT(ADDR(.pci_fixup) - LOAD_OFFSET) {        \
74                 VMLINUX_SYMBOL(__start_pci_fixups_early) = .;           \
75                 *(.pci_fixup_early)                                     \
76                 VMLINUX_SYMBOL(__end_pci_fixups_early) = .;             \
77                 VMLINUX_SYMBOL(__start_pci_fixups_header) = .;          \
78                 *(.pci_fixup_header)                                    \
79                 VMLINUX_SYMBOL(__end_pci_fixups_header) = .;            \
80                 VMLINUX_SYMBOL(__start_pci_fixups_final) = .;           \
81                 *(.pci_fixup_final)                                     \
82                 VMLINUX_SYMBOL(__end_pci_fixups_final) = .;             \
83                 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .;          \
84                 *(.pci_fixup_enable)                                    \
85                 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .;            \
86                 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .;          \
87                 *(.pci_fixup_resume)                                    \
88                 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .;            \
89         }                                                               \
90                                                                         \
91         /* Built-in firmware blobs */                                   \
92         .builtin_fw        : AT(ADDR(.builtin_fw) - LOAD_OFFSET) {      \
93                 VMLINUX_SYMBOL(__start_builtin_fw) = .;                 \
94                 *(.builtin_fw)                                          \
95                 VMLINUX_SYMBOL(__end_builtin_fw) = .;                   \
96         }                                                               \
97                                                                         \
98         /* RapidIO route ops */                                         \
99         .rio_route        : AT(ADDR(.rio_route) - LOAD_OFFSET) {        \
100                 VMLINUX_SYMBOL(__start_rio_route_ops) = .;              \
101                 *(.rio_route_ops)                                       \
102                 VMLINUX_SYMBOL(__end_rio_route_ops) = .;                \
103         }                                                               \
104                                                                         \
105         TRACEDATA                                                       \
106                                                                         \
107         /* Kernel symbol table: Normal symbols */                       \
108         __ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {         \
109                 VMLINUX_SYMBOL(__start___ksymtab) = .;                  \
110                 *(__ksymtab)                                            \
111                 VMLINUX_SYMBOL(__stop___ksymtab) = .;                   \
112         }                                                               \
113                                                                         \
114         /* Kernel symbol table: GPL-only symbols */                     \
115         __ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {     \
116                 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .;              \
117                 *(__ksymtab_gpl)                                        \
118                 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .;               \
119         }                                                               \
120                                                                         \
121         /* Kernel symbol table: Normal unused symbols */                \
122         __ksymtab_unused  : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) {  \
123                 VMLINUX_SYMBOL(__start___ksymtab_unused) = .;           \
124                 *(__ksymtab_unused)                                     \
125                 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .;            \
126         }                                                               \
127                                                                         \
128         /* Kernel symbol table: GPL-only unused symbols */              \
129         __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
130                 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .;       \
131                 *(__ksymtab_unused_gpl)                                 \
132                 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .;        \
133         }                                                               \
134                                                                         \
135         /* Kernel symbol table: GPL-future-only symbols */              \
136         __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
137                 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .;       \
138                 *(__ksymtab_gpl_future)                                 \
139                 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .;        \
140         }                                                               \
141                                                                         \
142         /* Kernel symbol table: Normal symbols */                       \
143         __kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {         \
144                 VMLINUX_SYMBOL(__start___kcrctab) = .;                  \
145                 *(__kcrctab)                                            \
146                 VMLINUX_SYMBOL(__stop___kcrctab) = .;                   \
147         }                                                               \
148                                                                         \
149         /* Kernel symbol table: GPL-only symbols */                     \
150         __kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {     \
151                 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .;              \
152                 *(__kcrctab_gpl)                                        \
153                 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .;               \
154         }                                                               \
155                                                                         \
156         /* Kernel symbol table: Normal unused symbols */                \
157         __kcrctab_unused  : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) {  \
158                 VMLINUX_SYMBOL(__start___kcrctab_unused) = .;           \
159                 *(__kcrctab_unused)                                     \
160                 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .;            \
161         }                                                               \
162                                                                         \
163         /* Kernel symbol table: GPL-only unused symbols */              \
164         __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
165                 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .;       \
166                 *(__kcrctab_unused_gpl)                                 \
167                 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .;        \
168         }                                                               \
169                                                                         \
170         /* Kernel symbol table: GPL-future-only symbols */              \
171         __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
172                 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .;       \
173                 *(__kcrctab_gpl_future)                                 \
174                 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .;        \
175         }                                                               \
176                                                                         \
177         /* Kernel symbol table: strings */                              \
178         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
179                 *(__ksymtab_strings)                                    \
180         }                                                               \
181                                                                         \
182         /* __*init sections */                                          \
183         __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {         \
184                 *(.ref.rodata)                                          \
185                 DEV_KEEP(init.rodata)                                   \
186                 DEV_KEEP(exit.rodata)                                   \
187                 CPU_KEEP(init.rodata)                                   \
188                 CPU_KEEP(exit.rodata)                                   \
189                 MEM_KEEP(init.rodata)                                   \
190                 MEM_KEEP(exit.rodata)                                   \
191         }                                                               \
192                                                                         \
193         /* Built-in module parameters. */                               \
194         __param : AT(ADDR(__param) - LOAD_OFFSET) {                     \
195                 VMLINUX_SYMBOL(__start___param) = .;                    \
196                 *(__param)                                              \
197                 VMLINUX_SYMBOL(__stop___param) = .;                     \
198                 . = ALIGN((align));                                     \
199                 VMLINUX_SYMBOL(__end_rodata) = .;                       \
200         }                                                               \
201         . = ALIGN((align));
202
203 /* RODATA provided for backward compatibility.
204  * All archs are supposed to use RO_DATA() */
205 #define RODATA RO_DATA(4096)
206
207 #define SECURITY_INIT                                                   \
208         .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
209                 VMLINUX_SYMBOL(__security_initcall_start) = .;          \
210                 *(.security_initcall.init)                              \
211                 VMLINUX_SYMBOL(__security_initcall_end) = .;            \
212         }
213
214 /* .text section. Map to function alignment to avoid address changes
215  * during second ld run in second ld pass when generating System.map */
216 #define TEXT_TEXT                                                       \
217                 ALIGN_FUNCTION();                                       \
218                 *(.text)                                                \
219                 *(.ref.text)                                            \
220                 *(.text.init.refok)                                     \
221                 *(.exit.text.refok)                                     \
222         DEV_KEEP(init.text)                                             \
223         DEV_KEEP(exit.text)                                             \
224         CPU_KEEP(init.text)                                             \
225         CPU_KEEP(exit.text)                                             \
226         MEM_KEEP(init.text)                                             \
227         MEM_KEEP(exit.text)
228
229
230 /* sched.text is aling to function alignment to secure we have same
231  * address even at second ld pass when generating System.map */
232 #define SCHED_TEXT                                                      \
233                 ALIGN_FUNCTION();                                       \
234                 VMLINUX_SYMBOL(__sched_text_start) = .;                 \
235                 *(.sched.text)                                          \
236                 VMLINUX_SYMBOL(__sched_text_end) = .;
237
238 /* spinlock.text is aling to function alignment to secure we have same
239  * address even at second ld pass when generating System.map */
240 #define LOCK_TEXT                                                       \
241                 ALIGN_FUNCTION();                                       \
242                 VMLINUX_SYMBOL(__lock_text_start) = .;                  \
243                 *(.spinlock.text)                                       \
244                 VMLINUX_SYMBOL(__lock_text_end) = .;
245
246 #define KPROBES_TEXT                                                    \
247                 ALIGN_FUNCTION();                                       \
248                 VMLINUX_SYMBOL(__kprobes_text_start) = .;               \
249                 *(.kprobes.text)                                        \
250                 VMLINUX_SYMBOL(__kprobes_text_end) = .;
251
252 /* Section used for early init (in .S files) */
253 #define HEAD_TEXT  *(.head.text)
254
255 /* init and exit section handling */
256 #define INIT_DATA                                                       \
257         *(.init.data)                                                   \
258         DEV_DISCARD(init.data)                                          \
259         DEV_DISCARD(init.rodata)                                        \
260         CPU_DISCARD(init.data)                                          \
261         CPU_DISCARD(init.rodata)                                        \
262         MEM_DISCARD(init.data)                                          \
263         MEM_DISCARD(init.rodata)
264
265 #define INIT_TEXT                                                       \
266         *(.init.text)                                                   \
267         DEV_DISCARD(init.text)                                          \
268         CPU_DISCARD(init.text)                                          \
269         MEM_DISCARD(init.text)
270
271 #define EXIT_DATA                                                       \
272         *(.exit.data)                                                   \
273         DEV_DISCARD(exit.data)                                          \
274         DEV_DISCARD(exit.rodata)                                        \
275         CPU_DISCARD(exit.data)                                          \
276         CPU_DISCARD(exit.rodata)                                        \
277         MEM_DISCARD(exit.data)                                          \
278         MEM_DISCARD(exit.rodata)
279
280 #define EXIT_TEXT                                                       \
281         *(.exit.text)                                                   \
282         DEV_DISCARD(exit.text)                                          \
283         CPU_DISCARD(exit.text)                                          \
284         MEM_DISCARD(exit.text)
285
286                 /* DWARF debug sections.
287                 Symbols in the DWARF debugging sections are relative to
288                 the beginning of the section so we begin them at 0.  */
289 #define DWARF_DEBUG                                                     \
290                 /* DWARF 1 */                                           \
291                 .debug          0 : { *(.debug) }                       \
292                 .line           0 : { *(.line) }                        \
293                 /* GNU DWARF 1 extensions */                            \
294                 .debug_srcinfo  0 : { *(.debug_srcinfo) }               \
295                 .debug_sfnames  0 : { *(.debug_sfnames) }               \
296                 /* DWARF 1.1 and DWARF 2 */                             \
297                 .debug_aranges  0 : { *(.debug_aranges) }               \
298                 .debug_pubnames 0 : { *(.debug_pubnames) }              \
299                 /* DWARF 2 */                                           \
300                 .debug_info     0 : { *(.debug_info                     \
301                                 .gnu.linkonce.wi.*) }                   \
302                 .debug_abbrev   0 : { *(.debug_abbrev) }                \
303                 .debug_line     0 : { *(.debug_line) }                  \
304                 .debug_frame    0 : { *(.debug_frame) }                 \
305                 .debug_str      0 : { *(.debug_str) }                   \
306                 .debug_loc      0 : { *(.debug_loc) }                   \
307                 .debug_macinfo  0 : { *(.debug_macinfo) }               \
308                 /* SGI/MIPS DWARF 2 extensions */                       \
309                 .debug_weaknames 0 : { *(.debug_weaknames) }            \
310                 .debug_funcnames 0 : { *(.debug_funcnames) }            \
311                 .debug_typenames 0 : { *(.debug_typenames) }            \
312                 .debug_varnames  0 : { *(.debug_varnames) }             \
313
314                 /* Stabs debugging sections.  */
315 #define STABS_DEBUG                                                     \
316                 .stab 0 : { *(.stab) }                                  \
317                 .stabstr 0 : { *(.stabstr) }                            \
318                 .stab.excl 0 : { *(.stab.excl) }                        \
319                 .stab.exclstr 0 : { *(.stab.exclstr) }                  \
320                 .stab.index 0 : { *(.stab.index) }                      \
321                 .stab.indexstr 0 : { *(.stab.indexstr) }                \
322                 .comment 0 : { *(.comment) }
323
324 #ifdef CONFIG_GENERIC_BUG
325 #define BUG_TABLE                                                       \
326         . = ALIGN(8);                                                   \
327         __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) {             \
328                 __start___bug_table = .;                                \
329                 *(__bug_table)                                          \
330                 __stop___bug_table = .;                                 \
331         }
332 #else
333 #define BUG_TABLE
334 #endif
335
336 #ifdef CONFIG_PM_TRACE
337 #define TRACEDATA                                                       \
338         . = ALIGN(4);                                                   \
339         .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {               \
340                 __tracedata_start = .;                                  \
341                 *(.tracedata)                                           \
342                 __tracedata_end = .;                                    \
343         }
344 #else
345 #define TRACEDATA
346 #endif
347
348 #define NOTES                                                           \
349         .notes : AT(ADDR(.notes) - LOAD_OFFSET) {                       \
350                 VMLINUX_SYMBOL(__start_notes) = .;                      \
351                 *(.note.*)                                              \
352                 VMLINUX_SYMBOL(__stop_notes) = .;                       \
353         }
354
355 #define INITCALLS                                                       \
356         *(.initcall0.init)                                              \
357         *(.initcall0s.init)                                             \
358         *(.initcall1.init)                                              \
359         *(.initcall1s.init)                                             \
360         *(.initcall2.init)                                              \
361         *(.initcall2s.init)                                             \
362         *(.initcall3.init)                                              \
363         *(.initcall3s.init)                                             \
364         *(.initcall4.init)                                              \
365         *(.initcall4s.init)                                             \
366         *(.initcall5.init)                                              \
367         *(.initcall5s.init)                                             \
368         *(.initcallrootfs.init)                                         \
369         *(.initcall6.init)                                              \
370         *(.initcall6s.init)                                             \
371         *(.initcall7.init)                                              \
372         *(.initcall7s.init)
373
374 #define PERCPU(align)                                                   \
375         . = ALIGN(align);                                               \
376         __per_cpu_start = .;                                            \
377         .data.percpu  : AT(ADDR(.data.percpu) - LOAD_OFFSET) {          \
378                 *(.data.percpu)                                         \
379                 *(.data.percpu.shared_aligned)                          \
380         }                                                               \
381         __per_cpu_end = .;