2 * Helper macros to support writing architecture specific
5 * A minimal linker scripts has following content:
6 * [This is a sample, architectures may have special requiriements]
16 * INIT_TEXT_SECTION(PAGE_SIZE)
17 * INIT_DATA_SECTION(...)
18 * PERCPU_SECTION(CACHELINE_SIZE)
26 * RO_DATA_SECTION(PAGE_SIZE)
27 * RW_DATA_SECTION(...)
30 * EXCEPTION_TABLE(...)
33 * BSS_SECTION(0, 0, 0)
39 * DISCARDS // must be the last
42 * [__init_begin, __init_end] is the init section that may be freed after init
43 * [_stext, _etext] is the text section
44 * [_sdata, _edata] is the data section
46 * Some of the included output section have their own set of constants.
47 * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
48 * [__nosave_begin, __nosave_end] for the nosave data
55 #include <linux/export.h>
57 /* Align . to a 8 byte boundary equals to maximum function alignment. */
58 #define ALIGN_FUNCTION() . = ALIGN(8)
61 * Align to a 32 byte boundary equal to the
62 * alignment gcc 4.5 uses for a struct
64 #define STRUCT_ALIGNMENT 32
65 #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
67 /* The actual configuration determine if the init/exit sections
68 * are handled as text/data or they can be discarded (which
69 * often happens at runtime)
72 #define DEV_KEEP(sec) *(.dev##sec)
73 #define DEV_DISCARD(sec)
76 #define DEV_DISCARD(sec) *(.dev##sec)
79 #ifdef CONFIG_HOTPLUG_CPU
80 #define CPU_KEEP(sec) *(.cpu##sec)
81 #define CPU_DISCARD(sec)
84 #define CPU_DISCARD(sec) *(.cpu##sec)
87 #if defined(CONFIG_MEMORY_HOTPLUG)
88 #define MEM_KEEP(sec) *(.mem##sec)
89 #define MEM_DISCARD(sec)
92 #define MEM_DISCARD(sec) *(.mem##sec)
95 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
96 #define MCOUNT_REC() . = ALIGN(8); \
97 VMLINUX_SYMBOL(__start_mcount_loc) = .; \
99 VMLINUX_SYMBOL(__stop_mcount_loc) = .;
104 #ifdef CONFIG_TRACE_BRANCH_PROFILING
105 #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
106 *(_ftrace_annotated_branch) \
107 VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
109 #define LIKELY_PROFILE()
112 #ifdef CONFIG_PROFILE_ALL_BRANCHES
113 #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
115 VMLINUX_SYMBOL(__stop_branch_profile) = .;
117 #define BRANCH_PROFILE()
120 #ifdef CONFIG_EVENT_TRACING
121 #define FTRACE_EVENTS() . = ALIGN(8); \
122 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
124 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
126 #define FTRACE_EVENTS()
129 #ifdef CONFIG_TRACING
130 #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
131 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
132 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
134 #define TRACE_PRINTKS()
137 #ifdef CONFIG_FTRACE_SYSCALLS
138 #define TRACE_SYSCALLS() . = ALIGN(8); \
139 VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
140 *(__syscalls_metadata) \
141 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
143 #define TRACE_SYSCALLS()
146 #ifdef CONFIG_CLKSRC_OF
147 #define CLKSRC_OF_TABLES() . = ALIGN(8); \
148 VMLINUX_SYMBOL(__clksrc_of_table) = .; \
149 *(__clksrc_of_table) \
150 *(__clksrc_of_table_end)
152 #define CLKSRC_OF_TABLES()
155 #ifdef CONFIG_IRQCHIP
156 #define IRQCHIP_OF_MATCH_TABLE() \
158 VMLINUX_SYMBOL(__irqchip_begin) = .; \
159 *(__irqchip_of_table) \
162 #define IRQCHIP_OF_MATCH_TABLE()
165 #ifdef CONFIG_COMMON_CLK
166 #define CLK_OF_TABLES() . = ALIGN(8); \
167 VMLINUX_SYMBOL(__clk_of_table) = .; \
169 *(__clk_of_table_end)
171 #define CLK_OF_TABLES()
174 #define KERNEL_DTB() \
176 VMLINUX_SYMBOL(__dtb_start) = .; \
177 *(.dtb.init.rodata) \
178 VMLINUX_SYMBOL(__dtb_end) = .;
184 *(.data..shared_aligned) /* percpu related */ \
185 DEV_KEEP(init.data) \
186 DEV_KEEP(exit.data) \
187 CPU_KEEP(init.data) \
188 CPU_KEEP(exit.data) \
189 MEM_KEEP(init.data) \
190 MEM_KEEP(exit.data) \
194 /* implement dynamic printk debug */ \
196 VMLINUX_SYMBOL(__start___jump_table) = .; \
198 VMLINUX_SYMBOL(__stop___jump_table) = .; \
200 VMLINUX_SYMBOL(__start___verbose) = .; \
202 VMLINUX_SYMBOL(__stop___verbose) = .; \
208 * Data section helpers
210 #define NOSAVE_DATA \
211 . = ALIGN(PAGE_SIZE); \
212 VMLINUX_SYMBOL(__nosave_begin) = .; \
214 . = ALIGN(PAGE_SIZE); \
215 VMLINUX_SYMBOL(__nosave_end) = .;
217 #define PAGE_ALIGNED_DATA(page_align) \
218 . = ALIGN(page_align); \
219 *(.data..page_aligned)
221 #define READ_MOSTLY_DATA(align) \
223 *(.data..read_mostly) \
226 #define CACHELINE_ALIGNED_DATA(align) \
228 *(.data..cacheline_aligned)
230 #define INIT_TASK_DATA(align) \
237 #define RO_DATA_SECTION(align) \
238 . = ALIGN((align)); \
239 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
240 VMLINUX_SYMBOL(__start_rodata) = .; \
241 *(.rodata) *(.rodata.*) \
242 *(__vermagic) /* Kernel version magic */ \
244 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
245 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\
246 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
247 *(__tracepoints_strings)/* Tracepoints: strings */ \
250 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
257 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
258 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
259 *(.pci_fixup_early) \
260 VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
261 VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
262 *(.pci_fixup_header) \
263 VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
264 VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
265 *(.pci_fixup_final) \
266 VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
267 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
268 *(.pci_fixup_enable) \
269 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
270 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
271 *(.pci_fixup_resume) \
272 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
273 VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
274 *(.pci_fixup_resume_early) \
275 VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
276 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
277 *(.pci_fixup_suspend) \
278 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
281 /* Built-in firmware blobs */ \
282 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
283 VMLINUX_SYMBOL(__start_builtin_fw) = .; \
285 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
288 /* RapidIO route ops */ \
289 .rio_ops : AT(ADDR(.rio_ops) - LOAD_OFFSET) { \
290 VMLINUX_SYMBOL(__start_rio_switch_ops) = .; \
292 VMLINUX_SYMBOL(__end_rio_switch_ops) = .; \
297 /* Kernel symbol table: Normal symbols */ \
298 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
299 VMLINUX_SYMBOL(__start___ksymtab) = .; \
300 *(SORT(___ksymtab+*)) \
301 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
304 /* Kernel symbol table: GPL-only symbols */ \
305 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
306 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
307 *(SORT(___ksymtab_gpl+*)) \
308 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
311 /* Kernel symbol table: Normal unused symbols */ \
312 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
313 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
314 *(SORT(___ksymtab_unused+*)) \
315 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
318 /* Kernel symbol table: GPL-only unused symbols */ \
319 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
320 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
321 *(SORT(___ksymtab_unused_gpl+*)) \
322 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
325 /* Kernel symbol table: GPL-future-only symbols */ \
326 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
327 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
328 *(SORT(___ksymtab_gpl_future+*)) \
329 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
332 /* Kernel symbol table: Normal symbols */ \
333 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
334 VMLINUX_SYMBOL(__start___kcrctab) = .; \
335 *(SORT(___kcrctab+*)) \
336 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
339 /* Kernel symbol table: GPL-only symbols */ \
340 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
341 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
342 *(SORT(___kcrctab_gpl+*)) \
343 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
346 /* Kernel symbol table: Normal unused symbols */ \
347 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
348 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
349 *(SORT(___kcrctab_unused+*)) \
350 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
353 /* Kernel symbol table: GPL-only unused symbols */ \
354 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
355 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
356 *(SORT(___kcrctab_unused_gpl+*)) \
357 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
360 /* Kernel symbol table: GPL-future-only symbols */ \
361 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
362 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
363 *(SORT(___kcrctab_gpl_future+*)) \
364 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
367 /* Kernel symbol table: strings */ \
368 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
369 *(__ksymtab_strings) \
372 /* __*init sections */ \
373 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
375 DEV_KEEP(init.rodata) \
376 DEV_KEEP(exit.rodata) \
377 CPU_KEEP(init.rodata) \
378 CPU_KEEP(exit.rodata) \
379 MEM_KEEP(init.rodata) \
380 MEM_KEEP(exit.rodata) \
383 /* Built-in module parameters. */ \
384 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
385 VMLINUX_SYMBOL(__start___param) = .; \
387 VMLINUX_SYMBOL(__stop___param) = .; \
390 /* Built-in module versions. */ \
391 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
392 VMLINUX_SYMBOL(__start___modver) = .; \
394 VMLINUX_SYMBOL(__stop___modver) = .; \
395 . = ALIGN((align)); \
396 VMLINUX_SYMBOL(__end_rodata) = .; \
400 /* RODATA & RO_DATA provided for backward compatibility.
401 * All archs are supposed to use RO_DATA() */
402 #define RODATA RO_DATA_SECTION(4096)
403 #define RO_DATA(align) RO_DATA_SECTION(align)
405 #define SECURITY_INIT \
406 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
407 VMLINUX_SYMBOL(__security_initcall_start) = .; \
408 *(.security_initcall.init) \
409 VMLINUX_SYMBOL(__security_initcall_end) = .; \
412 /* .text section. Map to function alignment to avoid address changes
413 * during second ld run in second ld pass when generating System.map */
419 DEV_KEEP(init.text) \
420 DEV_KEEP(exit.text) \
421 CPU_KEEP(init.text) \
422 CPU_KEEP(exit.text) \
423 MEM_KEEP(init.text) \
424 MEM_KEEP(exit.text) \
428 /* sched.text is aling to function alignment to secure we have same
429 * address even at second ld pass when generating System.map */
432 VMLINUX_SYMBOL(__sched_text_start) = .; \
434 VMLINUX_SYMBOL(__sched_text_end) = .;
436 /* spinlock.text is aling to function alignment to secure we have same
437 * address even at second ld pass when generating System.map */
440 VMLINUX_SYMBOL(__lock_text_start) = .; \
442 VMLINUX_SYMBOL(__lock_text_end) = .;
444 #define KPROBES_TEXT \
446 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
448 VMLINUX_SYMBOL(__kprobes_text_end) = .;
452 VMLINUX_SYMBOL(__entry_text_start) = .; \
454 VMLINUX_SYMBOL(__entry_text_end) = .;
456 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
457 #define IRQENTRY_TEXT \
459 VMLINUX_SYMBOL(__irqentry_text_start) = .; \
461 VMLINUX_SYMBOL(__irqentry_text_end) = .;
463 #define IRQENTRY_TEXT
466 /* Section used for early init (in .S files) */
467 #define HEAD_TEXT *(.head.text)
469 #define HEAD_TEXT_SECTION \
470 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
477 #define EXCEPTION_TABLE(align) \
479 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
480 VMLINUX_SYMBOL(__start___ex_table) = .; \
482 VMLINUX_SYMBOL(__stop___ex_table) = .; \
488 #define INIT_TASK_DATA_SECTION(align) \
490 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
491 INIT_TASK_DATA(align) \
494 #ifdef CONFIG_CONSTRUCTORS
495 #define KERNEL_CTORS() . = ALIGN(8); \
496 VMLINUX_SYMBOL(__ctors_start) = .; \
498 VMLINUX_SYMBOL(__ctors_end) = .;
500 #define KERNEL_CTORS()
503 /* init and exit section handling */
506 DEV_DISCARD(init.data) \
507 CPU_DISCARD(init.data) \
508 MEM_DISCARD(init.data) \
514 DEV_DISCARD(init.rodata) \
515 CPU_DISCARD(init.rodata) \
516 MEM_DISCARD(init.rodata) \
520 IRQCHIP_OF_MATCH_TABLE()
524 DEV_DISCARD(init.text) \
525 CPU_DISCARD(init.text) \
526 MEM_DISCARD(init.text)
530 DEV_DISCARD(exit.data) \
531 DEV_DISCARD(exit.rodata) \
532 CPU_DISCARD(exit.data) \
533 CPU_DISCARD(exit.rodata) \
534 MEM_DISCARD(exit.data) \
535 MEM_DISCARD(exit.rodata)
539 DEV_DISCARD(exit.text) \
540 CPU_DISCARD(exit.text) \
541 MEM_DISCARD(exit.text)
547 * bss (Block Started by Symbol) - uninitialized data
548 * zeroed during startup
550 #define SBSS(sbss_align) \
551 . = ALIGN(sbss_align); \
552 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
558 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
559 * sections to the front of bss.
561 #ifndef BSS_FIRST_SECTIONS
562 #define BSS_FIRST_SECTIONS
565 #define BSS(bss_align) \
566 . = ALIGN(bss_align); \
567 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
569 *(.bss..page_aligned) \
576 * DWARF debug sections.
577 * Symbols in the DWARF debugging sections are relative to
578 * the beginning of the section so we begin them at 0.
580 #define DWARF_DEBUG \
582 .debug 0 : { *(.debug) } \
583 .line 0 : { *(.line) } \
584 /* GNU DWARF 1 extensions */ \
585 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
586 .debug_sfnames 0 : { *(.debug_sfnames) } \
587 /* DWARF 1.1 and DWARF 2 */ \
588 .debug_aranges 0 : { *(.debug_aranges) } \
589 .debug_pubnames 0 : { *(.debug_pubnames) } \
591 .debug_info 0 : { *(.debug_info \
592 .gnu.linkonce.wi.*) } \
593 .debug_abbrev 0 : { *(.debug_abbrev) } \
594 .debug_line 0 : { *(.debug_line) } \
595 .debug_frame 0 : { *(.debug_frame) } \
596 .debug_str 0 : { *(.debug_str) } \
597 .debug_loc 0 : { *(.debug_loc) } \
598 .debug_macinfo 0 : { *(.debug_macinfo) } \
599 /* SGI/MIPS DWARF 2 extensions */ \
600 .debug_weaknames 0 : { *(.debug_weaknames) } \
601 .debug_funcnames 0 : { *(.debug_funcnames) } \
602 .debug_typenames 0 : { *(.debug_typenames) } \
603 .debug_varnames 0 : { *(.debug_varnames) } \
605 /* Stabs debugging sections. */
606 #define STABS_DEBUG \
607 .stab 0 : { *(.stab) } \
608 .stabstr 0 : { *(.stabstr) } \
609 .stab.excl 0 : { *(.stab.excl) } \
610 .stab.exclstr 0 : { *(.stab.exclstr) } \
611 .stab.index 0 : { *(.stab.index) } \
612 .stab.indexstr 0 : { *(.stab.indexstr) } \
613 .comment 0 : { *(.comment) }
615 #ifdef CONFIG_GENERIC_BUG
618 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
619 VMLINUX_SYMBOL(__start___bug_table) = .; \
621 VMLINUX_SYMBOL(__stop___bug_table) = .; \
627 #ifdef CONFIG_PM_TRACE
630 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
631 VMLINUX_SYMBOL(__tracedata_start) = .; \
633 VMLINUX_SYMBOL(__tracedata_end) = .; \
640 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
641 VMLINUX_SYMBOL(__start_notes) = .; \
643 VMLINUX_SYMBOL(__stop_notes) = .; \
646 #define INIT_SETUP(initsetup_align) \
647 . = ALIGN(initsetup_align); \
648 VMLINUX_SYMBOL(__setup_start) = .; \
650 VMLINUX_SYMBOL(__setup_end) = .;
652 #define INIT_CALLS_LEVEL(level) \
653 VMLINUX_SYMBOL(__initcall##level##_start) = .; \
654 *(.initcall##level##.init) \
655 *(.initcall##level##s.init) \
658 VMLINUX_SYMBOL(__initcall_start) = .; \
659 *(.initcallearly.init) \
660 INIT_CALLS_LEVEL(0) \
661 INIT_CALLS_LEVEL(1) \
662 INIT_CALLS_LEVEL(2) \
663 INIT_CALLS_LEVEL(3) \
664 INIT_CALLS_LEVEL(4) \
665 INIT_CALLS_LEVEL(5) \
666 INIT_CALLS_LEVEL(rootfs) \
667 INIT_CALLS_LEVEL(6) \
668 INIT_CALLS_LEVEL(7) \
669 VMLINUX_SYMBOL(__initcall_end) = .;
671 #define CON_INITCALL \
672 VMLINUX_SYMBOL(__con_initcall_start) = .; \
673 *(.con_initcall.init) \
674 VMLINUX_SYMBOL(__con_initcall_end) = .;
676 #define SECURITY_INITCALL \
677 VMLINUX_SYMBOL(__security_initcall_start) = .; \
678 *(.security_initcall.init) \
679 VMLINUX_SYMBOL(__security_initcall_end) = .;
681 #ifdef CONFIG_BLK_DEV_INITRD
682 #define INIT_RAM_FS \
684 VMLINUX_SYMBOL(__initramfs_start) = .; \
693 * Default discarded sections.
695 * Some archs want to discard exit text/data at runtime rather than
696 * link time due to cross-section references such as alt instructions,
697 * bug table, eh_frame, etc. DISCARDS must be the last of output
698 * section definitions so that such archs put those in earlier section
711 * PERCPU_INPUT - the percpu input sections
712 * @cacheline: cacheline size
714 * The core percpu section names and core symbols which do not rely
715 * directly upon load addresses.
717 * @cacheline is used to align subsections to avoid false cacheline
718 * sharing between subsections for different purposes.
720 #define PERCPU_INPUT(cacheline) \
721 VMLINUX_SYMBOL(__per_cpu_start) = .; \
722 *(.data..percpu..first) \
723 . = ALIGN(PAGE_SIZE); \
724 *(.data..percpu..page_aligned) \
725 . = ALIGN(cacheline); \
726 *(.data..percpu..readmostly) \
727 . = ALIGN(cacheline); \
729 *(.data..percpu..shared_aligned) \
730 VMLINUX_SYMBOL(__per_cpu_end) = .;
733 * PERCPU_VADDR - define output section for percpu area
734 * @cacheline: cacheline size
735 * @vaddr: explicit base address (optional)
736 * @phdr: destination PHDR (optional)
738 * Macro which expands to output section for percpu area.
740 * @cacheline is used to align subsections to avoid false cacheline
741 * sharing between subsections for different purposes.
743 * If @vaddr is not blank, it specifies explicit base address and all
744 * percpu symbols will be offset from the given address. If blank,
745 * @vaddr always equals @laddr + LOAD_OFFSET.
747 * @phdr defines the output PHDR to use if not blank. Be warned that
748 * output PHDR is sticky. If @phdr is specified, the next output
749 * section in the linker script will go there too. @phdr should have
752 * Note that this macros defines __per_cpu_load as an absolute symbol.
753 * If there is no need to put the percpu section at a predetermined
754 * address, use PERCPU_SECTION.
756 #define PERCPU_VADDR(cacheline, vaddr, phdr) \
757 VMLINUX_SYMBOL(__per_cpu_load) = .; \
758 .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
760 PERCPU_INPUT(cacheline) \
762 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
765 * PERCPU_SECTION - define output section for percpu area, simple version
766 * @cacheline: cacheline size
768 * Align to PAGE_SIZE and outputs output section for percpu area. This
769 * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
770 * __per_cpu_start will be identical.
772 * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
773 * except that __per_cpu_load is defined as a relative symbol against
774 * .data..percpu which is required for relocatable x86_32 configuration.
776 #define PERCPU_SECTION(cacheline) \
777 . = ALIGN(PAGE_SIZE); \
778 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
779 VMLINUX_SYMBOL(__per_cpu_load) = .; \
780 PERCPU_INPUT(cacheline) \
785 * Definition of the high level *_SECTION macros
786 * They will fit only a subset of the architectures
792 * All sections are combined in a single .data section.
793 * The sections following CONSTRUCTORS are arranged so their
794 * typical alignment matches.
795 * A cacheline is typical/always less than a PAGE_SIZE so
796 * the sections that has this restriction (or similar)
797 * is located before the ones requiring PAGE_SIZE alignment.
798 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
799 * matches the requirement of PAGE_ALIGNED_DATA.
801 * use 0 as page_align if page_aligned data is not used */
802 #define RW_DATA_SECTION(cacheline, pagealigned, inittask) \
803 . = ALIGN(PAGE_SIZE); \
804 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
805 INIT_TASK_DATA(inittask) \
807 PAGE_ALIGNED_DATA(pagealigned) \
808 CACHELINE_ALIGNED_DATA(cacheline) \
809 READ_MOSTLY_DATA(cacheline) \
814 #define INIT_TEXT_SECTION(inittext_align) \
815 . = ALIGN(inittext_align); \
816 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
817 VMLINUX_SYMBOL(_sinittext) = .; \
819 VMLINUX_SYMBOL(_einittext) = .; \
822 #define INIT_DATA_SECTION(initsetup_align) \
823 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
825 INIT_SETUP(initsetup_align) \
832 #define BSS_SECTION(sbss_align, bss_align, stop_align) \
833 . = ALIGN(sbss_align); \
834 VMLINUX_SYMBOL(__bss_start) = .; \
837 . = ALIGN(stop_align); \
838 VMLINUX_SYMBOL(__bss_stop) = .;