firmware: allow firmware files to be built into kernel image
[safe/jmp/linux-2.6] / 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         /* 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                                                                         \
117         /* 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                                                                         \
131         /* 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                                                                         \
138         /* 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                                                                         \
152         /* 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                                                                         \
166         /* 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                                                                         \
173         /* Kernel symbol table: strings */                              \
174         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
175                 *(__ksymtab_strings)                                    \
176         }                                                               \
177                                                                         \
178         /* __*init sections */                                          \
179         __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {         \
180                 *(.ref.rodata)                                          \
181                 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                                                                         \
189         /* Built-in module parameters. */                               \
190         __param : AT(ADDR(__param) - LOAD_OFFSET) {                     \
191                 VMLINUX_SYMBOL(__start___param) = .;                    \
192                 *(__param)                                              \
193                 VMLINUX_SYMBOL(__stop___param) = .;                     \
194                 . = ALIGN((align));                                     \
195                 VMLINUX_SYMBOL(__end_rodata) = .;                       \
196         }                                                               \
197         . = ALIGN((align));
198
199 /* RODATA provided for backward compatibility.
200  * All archs are supposed to use RO_DATA() */
201 #define RODATA RO_DATA(4096)
202
203 #define SECURITY_INIT                                                   \
204         .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
205                 VMLINUX_SYMBOL(__security_initcall_start) = .;          \
206                 *(.security_initcall.init)                              \
207                 VMLINUX_SYMBOL(__security_initcall_end) = .;            \
208         }
209
210 /* .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();                                       \
214                 *(.text)                                                \
215                 *(.ref.text)                                            \
216                 *(.text.init.refok)                                     \
217                 *(.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
225
226 /* sched.text is aling to function alignment to secure we have same
227  * address even at second ld pass when generating System.map */
228 #define SCHED_TEXT                                                      \
229                 ALIGN_FUNCTION();                                       \
230                 VMLINUX_SYMBOL(__sched_text_start) = .;                 \
231                 *(.sched.text)                                          \
232                 VMLINUX_SYMBOL(__sched_text_end) = .;
233
234 /* spinlock.text is aling to function alignment to secure we have same
235  * address even at second ld pass when generating System.map */
236 #define LOCK_TEXT                                                       \
237                 ALIGN_FUNCTION();                                       \
238                 VMLINUX_SYMBOL(__lock_text_start) = .;                  \
239                 *(.spinlock.text)                                       \
240                 VMLINUX_SYMBOL(__lock_text_end) = .;
241
242 #define KPROBES_TEXT                                                    \
243                 ALIGN_FUNCTION();                                       \
244                 VMLINUX_SYMBOL(__kprobes_text_start) = .;               \
245                 *(.kprobes.text)                                        \
246                 VMLINUX_SYMBOL(__kprobes_text_end) = .;
247
248 /* Section used for early init (in .S files) */
249 #define HEAD_TEXT  *(.head.text)
250
251 /* init and exit section handling */
252 #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)
260
261 #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)
281
282                 /* 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) }
319
320 #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
328 #define NOTES                                                           \
329         .notes : AT(ADDR(.notes) - LOAD_OFFSET) {                       \
330                 VMLINUX_SYMBOL(__start_notes) = .;                      \
331                 *(.note.*)                                              \
332                 VMLINUX_SYMBOL(__stop_notes) = .;                       \
333         }
334
335 #define INITCALLS                                                       \
336         *(.initcall0.init)                                              \
337         *(.initcall0s.init)                                             \
338         *(.initcall1.init)                                              \
339         *(.initcall1s.init)                                             \
340         *(.initcall2.init)                                              \
341         *(.initcall2s.init)                                             \
342         *(.initcall3.init)                                              \
343         *(.initcall3s.init)                                             \
344         *(.initcall4.init)                                              \
345         *(.initcall4s.init)                                             \
346         *(.initcall5.init)                                              \
347         *(.initcall5s.init)                                             \
348         *(.initcallrootfs.init)                                         \
349         *(.initcall6.init)                                              \
350         *(.initcall6s.init)                                             \
351         *(.initcall7.init)                                              \
352         *(.initcall7s.init)
353
354 #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 = .;