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