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)
71 #ifdef CONFIG_HOTPLUG_CPU
72 #define CPU_KEEP(sec) *(.cpu##sec)
73 #define CPU_DISCARD(sec)
76 #define CPU_DISCARD(sec) *(.cpu##sec)
79 #if defined(CONFIG_MEMORY_HOTPLUG)
80 #define MEM_KEEP(sec) *(.mem##sec)
81 #define MEM_DISCARD(sec)
84 #define MEM_DISCARD(sec) *(.mem##sec)
87 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
88 #define MCOUNT_REC() . = ALIGN(8); \
89 VMLINUX_SYMBOL(__start_mcount_loc) = .; \
91 VMLINUX_SYMBOL(__stop_mcount_loc) = .;
96 #ifdef CONFIG_TRACE_BRANCH_PROFILING
97 #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
98 *(_ftrace_annotated_branch) \
99 VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
101 #define LIKELY_PROFILE()
104 #ifdef CONFIG_PROFILE_ALL_BRANCHES
105 #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
107 VMLINUX_SYMBOL(__stop_branch_profile) = .;
109 #define BRANCH_PROFILE()
112 #ifdef CONFIG_KPROBES
113 #define KPROBE_BLACKLIST() . = ALIGN(8); \
114 VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
115 *(_kprobe_blacklist) \
116 VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
118 #define KPROBE_BLACKLIST()
121 #ifdef CONFIG_EVENT_TRACING
122 #define FTRACE_EVENTS() . = ALIGN(8); \
123 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
125 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
127 #define FTRACE_EVENTS()
130 #ifdef CONFIG_TRACING
131 #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
132 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
133 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
134 #define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \
135 *(__tracepoint_str) /* Trace_printk fmt' pointer */ \
136 VMLINUX_SYMBOL(__stop___tracepoint_str) = .;
138 #define TRACE_PRINTKS()
139 #define TRACEPOINT_STR()
142 #ifdef CONFIG_FTRACE_SYSCALLS
143 #define TRACE_SYSCALLS() . = ALIGN(8); \
144 VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
145 *(__syscalls_metadata) \
146 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
148 #define TRACE_SYSCALLS()
152 #define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
153 #define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name)
154 #define OF_TABLE(cfg, name) __OF_TABLE(config_enabled(cfg), name)
155 #define _OF_TABLE_0(name)
156 #define _OF_TABLE_1(name) \
158 VMLINUX_SYMBOL(__##name##_of_table) = .; \
159 *(__##name##_of_table) \
160 *(__##name##_of_table_end)
162 #define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc)
163 #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
164 #define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk)
165 #define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
166 #define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
167 #define EARLYCON_OF_TABLES() OF_TABLE(CONFIG_SERIAL_EARLYCON, earlycon)
169 #define KERNEL_DTB() \
171 VMLINUX_SYMBOL(__dtb_start) = .; \
172 *(.dtb.init.rodata) \
173 VMLINUX_SYMBOL(__dtb_end) = .;
179 *(.data..shared_aligned) /* percpu related */ \
180 MEM_KEEP(init.data) \
181 MEM_KEEP(exit.data) \
185 /* implement dynamic printk debug */ \
187 VMLINUX_SYMBOL(__start___jump_table) = .; \
189 VMLINUX_SYMBOL(__stop___jump_table) = .; \
191 VMLINUX_SYMBOL(__start___verbose) = .; \
193 VMLINUX_SYMBOL(__stop___verbose) = .; \
200 * Data section helpers
202 #define NOSAVE_DATA \
203 . = ALIGN(PAGE_SIZE); \
204 VMLINUX_SYMBOL(__nosave_begin) = .; \
206 . = ALIGN(PAGE_SIZE); \
207 VMLINUX_SYMBOL(__nosave_end) = .;
209 #define PAGE_ALIGNED_DATA(page_align) \
210 . = ALIGN(page_align); \
211 *(.data..page_aligned)
213 #define READ_MOSTLY_DATA(align) \
215 *(.data..read_mostly) \
218 #define CACHELINE_ALIGNED_DATA(align) \
220 *(.data..cacheline_aligned)
222 #define INIT_TASK_DATA(align) \
229 #define RO_DATA_SECTION(align) \
230 . = ALIGN((align)); \
231 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
232 VMLINUX_SYMBOL(__start_rodata) = .; \
233 *(.rodata) *(.rodata.*) \
234 *(__vermagic) /* Kernel version magic */ \
236 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
237 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\
238 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
239 *(__tracepoints_strings)/* Tracepoints: strings */ \
242 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
249 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
250 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
251 *(.pci_fixup_early) \
252 VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
253 VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
254 *(.pci_fixup_header) \
255 VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
256 VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
257 *(.pci_fixup_final) \
258 VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
259 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
260 *(.pci_fixup_enable) \
261 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
262 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
263 *(.pci_fixup_resume) \
264 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
265 VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
266 *(.pci_fixup_resume_early) \
267 VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
268 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
269 *(.pci_fixup_suspend) \
270 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
273 /* Built-in firmware blobs */ \
274 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
275 VMLINUX_SYMBOL(__start_builtin_fw) = .; \
277 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
282 /* Kernel symbol table: Normal symbols */ \
283 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
284 VMLINUX_SYMBOL(__start___ksymtab) = .; \
285 *(SORT(___ksymtab+*)) \
286 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
289 /* Kernel symbol table: GPL-only symbols */ \
290 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
291 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
292 *(SORT(___ksymtab_gpl+*)) \
293 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
296 /* Kernel symbol table: Normal unused symbols */ \
297 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
298 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
299 *(SORT(___ksymtab_unused+*)) \
300 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
303 /* Kernel symbol table: GPL-only unused symbols */ \
304 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
305 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
306 *(SORT(___ksymtab_unused_gpl+*)) \
307 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
310 /* Kernel symbol table: GPL-future-only symbols */ \
311 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
312 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
313 *(SORT(___ksymtab_gpl_future+*)) \
314 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
317 /* Kernel symbol table: Normal symbols */ \
318 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
319 VMLINUX_SYMBOL(__start___kcrctab) = .; \
320 *(SORT(___kcrctab+*)) \
321 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
324 /* Kernel symbol table: GPL-only symbols */ \
325 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
326 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
327 *(SORT(___kcrctab_gpl+*)) \
328 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
331 /* Kernel symbol table: Normal unused symbols */ \
332 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
333 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
334 *(SORT(___kcrctab_unused+*)) \
335 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
338 /* Kernel symbol table: GPL-only unused symbols */ \
339 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
340 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
341 *(SORT(___kcrctab_unused_gpl+*)) \
342 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
345 /* Kernel symbol table: GPL-future-only symbols */ \
346 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
347 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
348 *(SORT(___kcrctab_gpl_future+*)) \
349 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
352 /* Kernel symbol table: strings */ \
353 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
354 *(__ksymtab_strings) \
357 /* __*init sections */ \
358 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
360 MEM_KEEP(init.rodata) \
361 MEM_KEEP(exit.rodata) \
364 /* Built-in module parameters. */ \
365 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
366 VMLINUX_SYMBOL(__start___param) = .; \
368 VMLINUX_SYMBOL(__stop___param) = .; \
371 /* Built-in module versions. */ \
372 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
373 VMLINUX_SYMBOL(__start___modver) = .; \
375 VMLINUX_SYMBOL(__stop___modver) = .; \
376 . = ALIGN((align)); \
377 VMLINUX_SYMBOL(__end_rodata) = .; \
381 /* RODATA & RO_DATA provided for backward compatibility.
382 * All archs are supposed to use RO_DATA() */
383 #define RODATA RO_DATA_SECTION(4096)
384 #define RO_DATA(align) RO_DATA_SECTION(align)
386 #define SECURITY_INIT \
387 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
388 VMLINUX_SYMBOL(__security_initcall_start) = .; \
389 *(.security_initcall.init) \
390 VMLINUX_SYMBOL(__security_initcall_end) = .; \
393 /* .text section. Map to function alignment to avoid address changes
394 * during second ld run in second ld pass when generating System.map */
400 MEM_KEEP(init.text) \
401 MEM_KEEP(exit.text) \
405 /* sched.text is aling to function alignment to secure we have same
406 * address even at second ld pass when generating System.map */
409 VMLINUX_SYMBOL(__sched_text_start) = .; \
411 VMLINUX_SYMBOL(__sched_text_end) = .;
413 /* spinlock.text is aling to function alignment to secure we have same
414 * address even at second ld pass when generating System.map */
417 VMLINUX_SYMBOL(__lock_text_start) = .; \
419 VMLINUX_SYMBOL(__lock_text_end) = .;
421 #define KPROBES_TEXT \
423 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
425 VMLINUX_SYMBOL(__kprobes_text_end) = .;
429 VMLINUX_SYMBOL(__entry_text_start) = .; \
431 VMLINUX_SYMBOL(__entry_text_end) = .;
433 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
434 #define IRQENTRY_TEXT \
436 VMLINUX_SYMBOL(__irqentry_text_start) = .; \
438 VMLINUX_SYMBOL(__irqentry_text_end) = .;
440 #define IRQENTRY_TEXT
443 /* Section used for early init (in .S files) */
444 #define HEAD_TEXT *(.head.text)
446 #define HEAD_TEXT_SECTION \
447 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
454 #define EXCEPTION_TABLE(align) \
456 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
457 VMLINUX_SYMBOL(__start___ex_table) = .; \
459 VMLINUX_SYMBOL(__stop___ex_table) = .; \
465 #define INIT_TASK_DATA_SECTION(align) \
467 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
468 INIT_TASK_DATA(align) \
471 #ifdef CONFIG_CONSTRUCTORS
472 #define KERNEL_CTORS() . = ALIGN(8); \
473 VMLINUX_SYMBOL(__ctors_start) = .; \
476 VMLINUX_SYMBOL(__ctors_end) = .;
478 #define KERNEL_CTORS()
481 /* init and exit section handling */
484 MEM_DISCARD(init.data) \
491 MEM_DISCARD(init.rodata) \
493 RESERVEDMEM_OF_TABLES() \
495 CPU_METHOD_OF_TABLES() \
497 IRQCHIP_OF_MATCH_TABLE() \
502 MEM_DISCARD(init.text)
506 MEM_DISCARD(exit.data) \
507 MEM_DISCARD(exit.rodata)
511 MEM_DISCARD(exit.text)
517 * bss (Block Started by Symbol) - uninitialized data
518 * zeroed during startup
520 #define SBSS(sbss_align) \
521 . = ALIGN(sbss_align); \
522 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
528 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
529 * sections to the front of bss.
531 #ifndef BSS_FIRST_SECTIONS
532 #define BSS_FIRST_SECTIONS
535 #define BSS(bss_align) \
536 . = ALIGN(bss_align); \
537 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
539 *(.bss..page_aligned) \
546 * DWARF debug sections.
547 * Symbols in the DWARF debugging sections are relative to
548 * the beginning of the section so we begin them at 0.
550 #define DWARF_DEBUG \
552 .debug 0 : { *(.debug) } \
553 .line 0 : { *(.line) } \
554 /* GNU DWARF 1 extensions */ \
555 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
556 .debug_sfnames 0 : { *(.debug_sfnames) } \
557 /* DWARF 1.1 and DWARF 2 */ \
558 .debug_aranges 0 : { *(.debug_aranges) } \
559 .debug_pubnames 0 : { *(.debug_pubnames) } \
561 .debug_info 0 : { *(.debug_info \
562 .gnu.linkonce.wi.*) } \
563 .debug_abbrev 0 : { *(.debug_abbrev) } \
564 .debug_line 0 : { *(.debug_line) } \
565 .debug_frame 0 : { *(.debug_frame) } \
566 .debug_str 0 : { *(.debug_str) } \
567 .debug_loc 0 : { *(.debug_loc) } \
568 .debug_macinfo 0 : { *(.debug_macinfo) } \
569 /* SGI/MIPS DWARF 2 extensions */ \
570 .debug_weaknames 0 : { *(.debug_weaknames) } \
571 .debug_funcnames 0 : { *(.debug_funcnames) } \
572 .debug_typenames 0 : { *(.debug_typenames) } \
573 .debug_varnames 0 : { *(.debug_varnames) } \
575 /* Stabs debugging sections. */
576 #define STABS_DEBUG \
577 .stab 0 : { *(.stab) } \
578 .stabstr 0 : { *(.stabstr) } \
579 .stab.excl 0 : { *(.stab.excl) } \
580 .stab.exclstr 0 : { *(.stab.exclstr) } \
581 .stab.index 0 : { *(.stab.index) } \
582 .stab.indexstr 0 : { *(.stab.indexstr) } \
583 .comment 0 : { *(.comment) }
585 #ifdef CONFIG_GENERIC_BUG
588 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
589 VMLINUX_SYMBOL(__start___bug_table) = .; \
591 VMLINUX_SYMBOL(__stop___bug_table) = .; \
597 #ifdef CONFIG_PM_TRACE
600 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
601 VMLINUX_SYMBOL(__tracedata_start) = .; \
603 VMLINUX_SYMBOL(__tracedata_end) = .; \
610 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
611 VMLINUX_SYMBOL(__start_notes) = .; \
613 VMLINUX_SYMBOL(__stop_notes) = .; \
616 #define INIT_SETUP(initsetup_align) \
617 . = ALIGN(initsetup_align); \
618 VMLINUX_SYMBOL(__setup_start) = .; \
620 VMLINUX_SYMBOL(__setup_end) = .;
622 #define INIT_CALLS_LEVEL(level) \
623 VMLINUX_SYMBOL(__initcall##level##_start) = .; \
624 *(.initcall##level##.init) \
625 *(.initcall##level##s.init) \
628 VMLINUX_SYMBOL(__initcall_start) = .; \
629 *(.initcallearly.init) \
630 INIT_CALLS_LEVEL(0) \
631 INIT_CALLS_LEVEL(1) \
632 INIT_CALLS_LEVEL(2) \
633 INIT_CALLS_LEVEL(3) \
634 INIT_CALLS_LEVEL(4) \
635 INIT_CALLS_LEVEL(5) \
636 INIT_CALLS_LEVEL(rootfs) \
637 INIT_CALLS_LEVEL(6) \
638 INIT_CALLS_LEVEL(7) \
639 VMLINUX_SYMBOL(__initcall_end) = .;
641 #define CON_INITCALL \
642 VMLINUX_SYMBOL(__con_initcall_start) = .; \
643 *(.con_initcall.init) \
644 VMLINUX_SYMBOL(__con_initcall_end) = .;
646 #define SECURITY_INITCALL \
647 VMLINUX_SYMBOL(__security_initcall_start) = .; \
648 *(.security_initcall.init) \
649 VMLINUX_SYMBOL(__security_initcall_end) = .;
651 #ifdef CONFIG_BLK_DEV_INITRD
652 #define INIT_RAM_FS \
654 VMLINUX_SYMBOL(__initramfs_start) = .; \
663 * Default discarded sections.
665 * Some archs want to discard exit text/data at runtime rather than
666 * link time due to cross-section references such as alt instructions,
667 * bug table, eh_frame, etc. DISCARDS must be the last of output
668 * section definitions so that such archs put those in earlier section
681 * PERCPU_INPUT - the percpu input sections
682 * @cacheline: cacheline size
684 * The core percpu section names and core symbols which do not rely
685 * directly upon load addresses.
687 * @cacheline is used to align subsections to avoid false cacheline
688 * sharing between subsections for different purposes.
690 #define PERCPU_INPUT(cacheline) \
691 VMLINUX_SYMBOL(__per_cpu_start) = .; \
692 *(.data..percpu..first) \
693 . = ALIGN(PAGE_SIZE); \
694 *(.data..percpu..page_aligned) \
695 . = ALIGN(cacheline); \
696 *(.data..percpu..read_mostly) \
697 . = ALIGN(cacheline); \
699 *(.data..percpu..shared_aligned) \
700 VMLINUX_SYMBOL(__per_cpu_end) = .;
703 * PERCPU_VADDR - define output section for percpu area
704 * @cacheline: cacheline size
705 * @vaddr: explicit base address (optional)
706 * @phdr: destination PHDR (optional)
708 * Macro which expands to output section for percpu area.
710 * @cacheline is used to align subsections to avoid false cacheline
711 * sharing between subsections for different purposes.
713 * If @vaddr is not blank, it specifies explicit base address and all
714 * percpu symbols will be offset from the given address. If blank,
715 * @vaddr always equals @laddr + LOAD_OFFSET.
717 * @phdr defines the output PHDR to use if not blank. Be warned that
718 * output PHDR is sticky. If @phdr is specified, the next output
719 * section in the linker script will go there too. @phdr should have
722 * Note that this macros defines __per_cpu_load as an absolute symbol.
723 * If there is no need to put the percpu section at a predetermined
724 * address, use PERCPU_SECTION.
726 #define PERCPU_VADDR(cacheline, vaddr, phdr) \
727 VMLINUX_SYMBOL(__per_cpu_load) = .; \
728 .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
730 PERCPU_INPUT(cacheline) \
732 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
735 * PERCPU_SECTION - define output section for percpu area, simple version
736 * @cacheline: cacheline size
738 * Align to PAGE_SIZE and outputs output section for percpu area. This
739 * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
740 * __per_cpu_start will be identical.
742 * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
743 * except that __per_cpu_load is defined as a relative symbol against
744 * .data..percpu which is required for relocatable x86_32 configuration.
746 #define PERCPU_SECTION(cacheline) \
747 . = ALIGN(PAGE_SIZE); \
748 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
749 VMLINUX_SYMBOL(__per_cpu_load) = .; \
750 PERCPU_INPUT(cacheline) \
755 * Definition of the high level *_SECTION macros
756 * They will fit only a subset of the architectures
762 * All sections are combined in a single .data section.
763 * The sections following CONSTRUCTORS are arranged so their
764 * typical alignment matches.
765 * A cacheline is typical/always less than a PAGE_SIZE so
766 * the sections that has this restriction (or similar)
767 * is located before the ones requiring PAGE_SIZE alignment.
768 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
769 * matches the requirement of PAGE_ALIGNED_DATA.
771 * use 0 as page_align if page_aligned data is not used */
772 #define RW_DATA_SECTION(cacheline, pagealigned, inittask) \
773 . = ALIGN(PAGE_SIZE); \
774 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
775 INIT_TASK_DATA(inittask) \
777 PAGE_ALIGNED_DATA(pagealigned) \
778 CACHELINE_ALIGNED_DATA(cacheline) \
779 READ_MOSTLY_DATA(cacheline) \
784 #define INIT_TEXT_SECTION(inittext_align) \
785 . = ALIGN(inittext_align); \
786 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
787 VMLINUX_SYMBOL(_sinittext) = .; \
789 VMLINUX_SYMBOL(_einittext) = .; \
792 #define INIT_DATA_SECTION(initsetup_align) \
793 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
795 INIT_SETUP(initsetup_align) \
802 #define BSS_SECTION(sbss_align, bss_align, stop_align) \
803 . = ALIGN(sbss_align); \
804 VMLINUX_SYMBOL(__bss_start) = .; \
807 . = ALIGN(stop_align); \
808 VMLINUX_SYMBOL(__bss_stop) = .;