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
56 #define VMLINUX_SYMBOL(sym) sym
58 #define PASTE2(x,y) x##y
59 #define PASTE(x,y) PASTE2(x,y)
60 #define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym)
63 /* Align . to a 8 byte boundary equals to maximum function alignment. */
64 #define ALIGN_FUNCTION() . = ALIGN(8)
67 * Align to a 32 byte boundary equal to the
68 * alignment gcc 4.5 uses for a struct
70 #define STRUCT_ALIGNMENT 32
71 #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
73 /* The actual configuration determine if the init/exit sections
74 * are handled as text/data or they can be discarded (which
75 * often happens at runtime)
78 #define DEV_KEEP(sec) *(.dev##sec)
79 #define DEV_DISCARD(sec)
82 #define DEV_DISCARD(sec) *(.dev##sec)
85 #ifdef CONFIG_HOTPLUG_CPU
86 #define CPU_KEEP(sec) *(.cpu##sec)
87 #define CPU_DISCARD(sec)
90 #define CPU_DISCARD(sec) *(.cpu##sec)
93 #if defined(CONFIG_MEMORY_HOTPLUG)
94 #define MEM_KEEP(sec) *(.mem##sec)
95 #define MEM_DISCARD(sec)
98 #define MEM_DISCARD(sec) *(.mem##sec)
101 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
102 #define MCOUNT_REC() . = ALIGN(8); \
103 VMLINUX_SYMBOL(__start_mcount_loc) = .; \
105 VMLINUX_SYMBOL(__stop_mcount_loc) = .;
110 #ifdef CONFIG_TRACE_BRANCH_PROFILING
111 #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
112 *(_ftrace_annotated_branch) \
113 VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
115 #define LIKELY_PROFILE()
118 #ifdef CONFIG_PROFILE_ALL_BRANCHES
119 #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
121 VMLINUX_SYMBOL(__stop_branch_profile) = .;
123 #define BRANCH_PROFILE()
126 #ifdef CONFIG_EVENT_TRACING
127 #define FTRACE_EVENTS() . = ALIGN(8); \
128 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
130 VMLINUX_SYMBOL(__stop_ftrace_events) = .;
132 #define FTRACE_EVENTS()
135 #ifdef CONFIG_TRACING
136 #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
137 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
138 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
140 #define TRACE_PRINTKS()
143 #ifdef CONFIG_FTRACE_SYSCALLS
144 #define TRACE_SYSCALLS() . = ALIGN(8); \
145 VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
146 *(__syscalls_metadata) \
147 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
149 #define TRACE_SYSCALLS()
153 #ifdef CONFIG_COMMON_CLK
154 #define CLK_OF_TABLES() . = ALIGN(8); \
155 VMLINUX_SYMBOL(__clk_of_table) = .; \
157 *(__clk_of_table_end)
159 #define CLK_OF_TABLES()
162 #define KERNEL_DTB() \
164 VMLINUX_SYMBOL(__dtb_start) = .; \
165 *(.dtb.init.rodata) \
166 VMLINUX_SYMBOL(__dtb_end) = .;
172 *(.data..shared_aligned) /* percpu related */ \
173 DEV_KEEP(init.data) \
174 DEV_KEEP(exit.data) \
175 CPU_KEEP(init.data) \
176 CPU_KEEP(exit.data) \
177 MEM_KEEP(init.data) \
178 MEM_KEEP(exit.data) \
182 /* implement dynamic printk debug */ \
184 VMLINUX_SYMBOL(__start___jump_table) = .; \
186 VMLINUX_SYMBOL(__stop___jump_table) = .; \
188 VMLINUX_SYMBOL(__start___verbose) = .; \
190 VMLINUX_SYMBOL(__stop___verbose) = .; \
196 * Data section helpers
198 #define NOSAVE_DATA \
199 . = ALIGN(PAGE_SIZE); \
200 VMLINUX_SYMBOL(__nosave_begin) = .; \
202 . = ALIGN(PAGE_SIZE); \
203 VMLINUX_SYMBOL(__nosave_end) = .;
205 #define PAGE_ALIGNED_DATA(page_align) \
206 . = ALIGN(page_align); \
207 *(.data..page_aligned)
209 #define READ_MOSTLY_DATA(align) \
211 *(.data..read_mostly) \
214 #define CACHELINE_ALIGNED_DATA(align) \
216 *(.data..cacheline_aligned)
218 #define INIT_TASK_DATA(align) \
225 #define RO_DATA_SECTION(align) \
226 . = ALIGN((align)); \
227 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
228 VMLINUX_SYMBOL(__start_rodata) = .; \
229 *(.rodata) *(.rodata.*) \
230 *(__vermagic) /* Kernel version magic */ \
232 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
233 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\
234 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
235 *(__tracepoints_strings)/* Tracepoints: strings */ \
238 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
245 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
246 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
247 *(.pci_fixup_early) \
248 VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
249 VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
250 *(.pci_fixup_header) \
251 VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
252 VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
253 *(.pci_fixup_final) \
254 VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
255 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
256 *(.pci_fixup_enable) \
257 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
258 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
259 *(.pci_fixup_resume) \
260 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
261 VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
262 *(.pci_fixup_resume_early) \
263 VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
264 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
265 *(.pci_fixup_suspend) \
266 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
269 /* Built-in firmware blobs */ \
270 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
271 VMLINUX_SYMBOL(__start_builtin_fw) = .; \
273 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
276 /* RapidIO route ops */ \
277 .rio_ops : AT(ADDR(.rio_ops) - LOAD_OFFSET) { \
278 VMLINUX_SYMBOL(__start_rio_switch_ops) = .; \
280 VMLINUX_SYMBOL(__end_rio_switch_ops) = .; \
285 /* Kernel symbol table: Normal symbols */ \
286 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
287 VMLINUX_SYMBOL(__start___ksymtab) = .; \
288 *(SORT(___ksymtab+*)) \
289 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
292 /* Kernel symbol table: GPL-only symbols */ \
293 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
294 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
295 *(SORT(___ksymtab_gpl+*)) \
296 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
299 /* Kernel symbol table: Normal unused symbols */ \
300 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
301 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
302 *(SORT(___ksymtab_unused+*)) \
303 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
306 /* Kernel symbol table: GPL-only unused symbols */ \
307 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
308 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
309 *(SORT(___ksymtab_unused_gpl+*)) \
310 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
313 /* Kernel symbol table: GPL-future-only symbols */ \
314 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
315 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
316 *(SORT(___ksymtab_gpl_future+*)) \
317 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
320 /* Kernel symbol table: Normal symbols */ \
321 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
322 VMLINUX_SYMBOL(__start___kcrctab) = .; \
323 *(SORT(___kcrctab+*)) \
324 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
327 /* Kernel symbol table: GPL-only symbols */ \
328 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
329 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
330 *(SORT(___kcrctab_gpl+*)) \
331 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
334 /* Kernel symbol table: Normal unused symbols */ \
335 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
336 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
337 *(SORT(___kcrctab_unused+*)) \
338 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
341 /* Kernel symbol table: GPL-only unused symbols */ \
342 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
343 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
344 *(SORT(___kcrctab_unused_gpl+*)) \
345 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
348 /* Kernel symbol table: GPL-future-only symbols */ \
349 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
350 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
351 *(SORT(___kcrctab_gpl_future+*)) \
352 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
355 /* Kernel symbol table: strings */ \
356 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
357 *(__ksymtab_strings) \
360 /* __*init sections */ \
361 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
363 DEV_KEEP(init.rodata) \
364 DEV_KEEP(exit.rodata) \
365 CPU_KEEP(init.rodata) \
366 CPU_KEEP(exit.rodata) \
367 MEM_KEEP(init.rodata) \
368 MEM_KEEP(exit.rodata) \
371 /* Built-in module parameters. */ \
372 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
373 VMLINUX_SYMBOL(__start___param) = .; \
375 VMLINUX_SYMBOL(__stop___param) = .; \
378 /* Built-in module versions. */ \
379 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
380 VMLINUX_SYMBOL(__start___modver) = .; \
382 VMLINUX_SYMBOL(__stop___modver) = .; \
383 . = ALIGN((align)); \
384 VMLINUX_SYMBOL(__end_rodata) = .; \
388 /* RODATA & RO_DATA provided for backward compatibility.
389 * All archs are supposed to use RO_DATA() */
390 #define RODATA RO_DATA_SECTION(4096)
391 #define RO_DATA(align) RO_DATA_SECTION(align)
393 #define SECURITY_INIT \
394 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
395 VMLINUX_SYMBOL(__security_initcall_start) = .; \
396 *(.security_initcall.init) \
397 VMLINUX_SYMBOL(__security_initcall_end) = .; \
400 /* .text section. Map to function alignment to avoid address changes
401 * during second ld run in second ld pass when generating System.map */
407 DEV_KEEP(init.text) \
408 DEV_KEEP(exit.text) \
409 CPU_KEEP(init.text) \
410 CPU_KEEP(exit.text) \
411 MEM_KEEP(init.text) \
412 MEM_KEEP(exit.text) \
416 /* sched.text is aling to function alignment to secure we have same
417 * address even at second ld pass when generating System.map */
420 VMLINUX_SYMBOL(__sched_text_start) = .; \
422 VMLINUX_SYMBOL(__sched_text_end) = .;
424 /* spinlock.text is aling to function alignment to secure we have same
425 * address even at second ld pass when generating System.map */
428 VMLINUX_SYMBOL(__lock_text_start) = .; \
430 VMLINUX_SYMBOL(__lock_text_end) = .;
432 #define KPROBES_TEXT \
434 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
436 VMLINUX_SYMBOL(__kprobes_text_end) = .;
440 VMLINUX_SYMBOL(__entry_text_start) = .; \
442 VMLINUX_SYMBOL(__entry_text_end) = .;
444 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
445 #define IRQENTRY_TEXT \
447 VMLINUX_SYMBOL(__irqentry_text_start) = .; \
449 VMLINUX_SYMBOL(__irqentry_text_end) = .;
451 #define IRQENTRY_TEXT
454 /* Section used for early init (in .S files) */
455 #define HEAD_TEXT *(.head.text)
457 #define HEAD_TEXT_SECTION \
458 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
465 #define EXCEPTION_TABLE(align) \
467 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
468 VMLINUX_SYMBOL(__start___ex_table) = .; \
470 VMLINUX_SYMBOL(__stop___ex_table) = .; \
476 #define INIT_TASK_DATA_SECTION(align) \
478 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
479 INIT_TASK_DATA(align) \
482 #ifdef CONFIG_CONSTRUCTORS
483 #define KERNEL_CTORS() . = ALIGN(8); \
484 VMLINUX_SYMBOL(__ctors_start) = .; \
486 VMLINUX_SYMBOL(__ctors_end) = .;
488 #define KERNEL_CTORS()
491 /* init and exit section handling */
494 DEV_DISCARD(init.data) \
495 CPU_DISCARD(init.data) \
496 MEM_DISCARD(init.data) \
502 DEV_DISCARD(init.rodata) \
503 CPU_DISCARD(init.rodata) \
504 MEM_DISCARD(init.rodata) \
510 DEV_DISCARD(init.text) \
511 CPU_DISCARD(init.text) \
512 MEM_DISCARD(init.text)
516 DEV_DISCARD(exit.data) \
517 DEV_DISCARD(exit.rodata) \
518 CPU_DISCARD(exit.data) \
519 CPU_DISCARD(exit.rodata) \
520 MEM_DISCARD(exit.data) \
521 MEM_DISCARD(exit.rodata)
525 DEV_DISCARD(exit.text) \
526 CPU_DISCARD(exit.text) \
527 MEM_DISCARD(exit.text)
533 * bss (Block Started by Symbol) - uninitialized data
534 * zeroed during startup
536 #define SBSS(sbss_align) \
537 . = ALIGN(sbss_align); \
538 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
544 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
545 * sections to the front of bss.
547 #ifndef BSS_FIRST_SECTIONS
548 #define BSS_FIRST_SECTIONS
551 #define BSS(bss_align) \
552 . = ALIGN(bss_align); \
553 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
555 *(.bss..page_aligned) \
562 * DWARF debug sections.
563 * Symbols in the DWARF debugging sections are relative to
564 * the beginning of the section so we begin them at 0.
566 #define DWARF_DEBUG \
568 .debug 0 : { *(.debug) } \
569 .line 0 : { *(.line) } \
570 /* GNU DWARF 1 extensions */ \
571 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
572 .debug_sfnames 0 : { *(.debug_sfnames) } \
573 /* DWARF 1.1 and DWARF 2 */ \
574 .debug_aranges 0 : { *(.debug_aranges) } \
575 .debug_pubnames 0 : { *(.debug_pubnames) } \
577 .debug_info 0 : { *(.debug_info \
578 .gnu.linkonce.wi.*) } \
579 .debug_abbrev 0 : { *(.debug_abbrev) } \
580 .debug_line 0 : { *(.debug_line) } \
581 .debug_frame 0 : { *(.debug_frame) } \
582 .debug_str 0 : { *(.debug_str) } \
583 .debug_loc 0 : { *(.debug_loc) } \
584 .debug_macinfo 0 : { *(.debug_macinfo) } \
585 /* SGI/MIPS DWARF 2 extensions */ \
586 .debug_weaknames 0 : { *(.debug_weaknames) } \
587 .debug_funcnames 0 : { *(.debug_funcnames) } \
588 .debug_typenames 0 : { *(.debug_typenames) } \
589 .debug_varnames 0 : { *(.debug_varnames) } \
591 /* Stabs debugging sections. */
592 #define STABS_DEBUG \
593 .stab 0 : { *(.stab) } \
594 .stabstr 0 : { *(.stabstr) } \
595 .stab.excl 0 : { *(.stab.excl) } \
596 .stab.exclstr 0 : { *(.stab.exclstr) } \
597 .stab.index 0 : { *(.stab.index) } \
598 .stab.indexstr 0 : { *(.stab.indexstr) } \
599 .comment 0 : { *(.comment) }
601 #ifdef CONFIG_GENERIC_BUG
604 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
605 VMLINUX_SYMBOL(__start___bug_table) = .; \
607 VMLINUX_SYMBOL(__stop___bug_table) = .; \
613 #ifdef CONFIG_PM_TRACE
616 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
617 VMLINUX_SYMBOL(__tracedata_start) = .; \
619 VMLINUX_SYMBOL(__tracedata_end) = .; \
626 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
627 VMLINUX_SYMBOL(__start_notes) = .; \
629 VMLINUX_SYMBOL(__stop_notes) = .; \
632 #define INIT_SETUP(initsetup_align) \
633 . = ALIGN(initsetup_align); \
634 VMLINUX_SYMBOL(__setup_start) = .; \
636 VMLINUX_SYMBOL(__setup_end) = .;
638 #define INIT_CALLS_LEVEL(level) \
639 VMLINUX_SYMBOL(__initcall##level##_start) = .; \
640 *(.initcall##level##.init) \
641 *(.initcall##level##s.init) \
644 VMLINUX_SYMBOL(__initcall_start) = .; \
645 *(.initcallearly.init) \
646 INIT_CALLS_LEVEL(0) \
647 INIT_CALLS_LEVEL(1) \
648 INIT_CALLS_LEVEL(2) \
649 INIT_CALLS_LEVEL(3) \
650 INIT_CALLS_LEVEL(4) \
651 INIT_CALLS_LEVEL(5) \
652 INIT_CALLS_LEVEL(rootfs) \
653 INIT_CALLS_LEVEL(6) \
654 INIT_CALLS_LEVEL(7) \
655 VMLINUX_SYMBOL(__initcall_end) = .;
657 #define CON_INITCALL \
658 VMLINUX_SYMBOL(__con_initcall_start) = .; \
659 *(.con_initcall.init) \
660 VMLINUX_SYMBOL(__con_initcall_end) = .;
662 #define SECURITY_INITCALL \
663 VMLINUX_SYMBOL(__security_initcall_start) = .; \
664 *(.security_initcall.init) \
665 VMLINUX_SYMBOL(__security_initcall_end) = .;
667 #ifdef CONFIG_BLK_DEV_INITRD
668 #define INIT_RAM_FS \
670 VMLINUX_SYMBOL(__initramfs_start) = .; \
679 * Default discarded sections.
681 * Some archs want to discard exit text/data at runtime rather than
682 * link time due to cross-section references such as alt instructions,
683 * bug table, eh_frame, etc. DISCARDS must be the last of output
684 * section definitions so that such archs put those in earlier section
697 * PERCPU_INPUT - the percpu input sections
698 * @cacheline: cacheline size
700 * The core percpu section names and core symbols which do not rely
701 * directly upon load addresses.
703 * @cacheline is used to align subsections to avoid false cacheline
704 * sharing between subsections for different purposes.
706 #define PERCPU_INPUT(cacheline) \
707 VMLINUX_SYMBOL(__per_cpu_start) = .; \
708 *(.data..percpu..first) \
709 . = ALIGN(PAGE_SIZE); \
710 *(.data..percpu..page_aligned) \
711 . = ALIGN(cacheline); \
712 *(.data..percpu..readmostly) \
713 . = ALIGN(cacheline); \
715 *(.data..percpu..shared_aligned) \
716 VMLINUX_SYMBOL(__per_cpu_end) = .;
719 * PERCPU_VADDR - define output section for percpu area
720 * @cacheline: cacheline size
721 * @vaddr: explicit base address (optional)
722 * @phdr: destination PHDR (optional)
724 * Macro which expands to output section for percpu area.
726 * @cacheline is used to align subsections to avoid false cacheline
727 * sharing between subsections for different purposes.
729 * If @vaddr is not blank, it specifies explicit base address and all
730 * percpu symbols will be offset from the given address. If blank,
731 * @vaddr always equals @laddr + LOAD_OFFSET.
733 * @phdr defines the output PHDR to use if not blank. Be warned that
734 * output PHDR is sticky. If @phdr is specified, the next output
735 * section in the linker script will go there too. @phdr should have
738 * Note that this macros defines __per_cpu_load as an absolute symbol.
739 * If there is no need to put the percpu section at a predetermined
740 * address, use PERCPU_SECTION.
742 #define PERCPU_VADDR(cacheline, vaddr, phdr) \
743 VMLINUX_SYMBOL(__per_cpu_load) = .; \
744 .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
746 PERCPU_INPUT(cacheline) \
748 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
751 * PERCPU_SECTION - define output section for percpu area, simple version
752 * @cacheline: cacheline size
754 * Align to PAGE_SIZE and outputs output section for percpu area. This
755 * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
756 * __per_cpu_start will be identical.
758 * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
759 * except that __per_cpu_load is defined as a relative symbol against
760 * .data..percpu which is required for relocatable x86_32 configuration.
762 #define PERCPU_SECTION(cacheline) \
763 . = ALIGN(PAGE_SIZE); \
764 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
765 VMLINUX_SYMBOL(__per_cpu_load) = .; \
766 PERCPU_INPUT(cacheline) \
771 * Definition of the high level *_SECTION macros
772 * They will fit only a subset of the architectures
778 * All sections are combined in a single .data section.
779 * The sections following CONSTRUCTORS are arranged so their
780 * typical alignment matches.
781 * A cacheline is typical/always less than a PAGE_SIZE so
782 * the sections that has this restriction (or similar)
783 * is located before the ones requiring PAGE_SIZE alignment.
784 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
785 * matches the requirement of PAGE_ALIGNED_DATA.
787 * use 0 as page_align if page_aligned data is not used */
788 #define RW_DATA_SECTION(cacheline, pagealigned, inittask) \
789 . = ALIGN(PAGE_SIZE); \
790 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
791 INIT_TASK_DATA(inittask) \
793 PAGE_ALIGNED_DATA(pagealigned) \
794 CACHELINE_ALIGNED_DATA(cacheline) \
795 READ_MOSTLY_DATA(cacheline) \
800 #define INIT_TEXT_SECTION(inittext_align) \
801 . = ALIGN(inittext_align); \
802 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
803 VMLINUX_SYMBOL(_sinittext) = .; \
805 VMLINUX_SYMBOL(_einittext) = .; \
808 #define INIT_DATA_SECTION(initsetup_align) \
809 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
811 INIT_SETUP(initsetup_align) \
818 #define BSS_SECTION(sbss_align, bss_align, stop_align) \
819 . = ALIGN(sbss_align); \
820 VMLINUX_SYMBOL(__bss_start) = .; \
823 . = ALIGN(stop_align); \
824 VMLINUX_SYMBOL(__bss_stop) = .;
This page took 0.051346 seconds and 6 git commands to generate.