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