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