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