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 * // __init_begin and __init_end should be page aligned, so that we can
44 * // free the whole .init memory
45 * [_stext, _etext] is the text section
46 * [_sdata, _edata] is the data section
48 * Some of the included output section have their own set of constants.
49 * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
50 * [__nosave_begin, __nosave_end] for the nosave data
57 #include <linux/export.h>
59 /* Align . to a 8 byte boundary equals to maximum function alignment. */
60 #define ALIGN_FUNCTION() . = ALIGN(8)
63 * LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections, which
64 * generates .data.identifier sections, which need to be pulled in with
65 * .data. We don't want to pull in .data..other sections, which Linux
66 * has defined. Same for text and bss.
68 #ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
69 #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
70 #define DATA_MAIN .data .data.[0-9a-zA-Z_]*
71 #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
73 #define TEXT_MAIN .text
74 #define DATA_MAIN .data
79 * Align to a 32 byte boundary equal to the
80 * alignment gcc 4.5 uses for a struct
82 #define STRUCT_ALIGNMENT 32
83 #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
85 /* The actual configuration determine if the init/exit sections
86 * are handled as text/data or they can be discarded (which
87 * often happens at runtime)
89 #ifdef CONFIG_HOTPLUG_CPU
90 #define CPU_KEEP(sec) *(.cpu##sec)
91 #define CPU_DISCARD(sec)
94 #define CPU_DISCARD(sec) *(.cpu##sec)
97 #if defined(CONFIG_MEMORY_HOTPLUG)
98 #define MEM_KEEP(sec) *(.mem##sec)
99 #define MEM_DISCARD(sec)
101 #define MEM_KEEP(sec)
102 #define MEM_DISCARD(sec) *(.mem##sec)
105 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
106 #define MCOUNT_REC() . = ALIGN(8); \
107 VMLINUX_SYMBOL(__start_mcount_loc) = .; \
109 VMLINUX_SYMBOL(__stop_mcount_loc) = .;
114 #ifdef CONFIG_TRACE_BRANCH_PROFILING
115 #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
116 *(_ftrace_annotated_branch) \
117 VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
119 #define LIKELY_PROFILE()
122 #ifdef CONFIG_PROFILE_ALL_BRANCHES
123 #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
125 VMLINUX_SYMBOL(__stop_branch_profile) = .;
127 #define BRANCH_PROFILE()
130 #ifdef CONFIG_KPROBES
131 #define KPROBE_BLACKLIST() . = ALIGN(8); \
132 VMLINUX_SYMBOL(__start_kprobe_blacklist) = .; \
133 *(_kprobe_blacklist) \
134 VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
136 #define KPROBE_BLACKLIST()
139 #ifdef CONFIG_EVENT_TRACING
140 #define FTRACE_EVENTS() . = ALIGN(8); \
141 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
143 VMLINUX_SYMBOL(__stop_ftrace_events) = .; \
144 VMLINUX_SYMBOL(__start_ftrace_enum_maps) = .; \
145 *(_ftrace_enum_map) \
146 VMLINUX_SYMBOL(__stop_ftrace_enum_maps) = .;
148 #define FTRACE_EVENTS()
151 #ifdef CONFIG_TRACING
152 #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
153 *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
154 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
155 #define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \
156 *(__tracepoint_str) /* Trace_printk fmt' pointer */ \
157 VMLINUX_SYMBOL(__stop___tracepoint_str) = .;
159 #define TRACE_PRINTKS()
160 #define TRACEPOINT_STR()
163 #ifdef CONFIG_FTRACE_SYSCALLS
164 #define TRACE_SYSCALLS() . = ALIGN(8); \
165 VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
166 *(__syscalls_metadata) \
167 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
169 #define TRACE_SYSCALLS()
172 #ifdef CONFIG_SERIAL_EARLYCON
173 #define EARLYCON_TABLE() . = ALIGN(8); \
174 VMLINUX_SYMBOL(__earlycon_table) = .; \
175 *(__earlycon_table) \
176 VMLINUX_SYMBOL(__earlycon_table_end) = .;
178 #define EARLYCON_TABLE()
181 #define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
182 #define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name)
183 #define OF_TABLE(cfg, name) __OF_TABLE(IS_ENABLED(cfg), name)
184 #define _OF_TABLE_0(name)
185 #define _OF_TABLE_1(name) \
187 VMLINUX_SYMBOL(__##name##_of_table) = .; \
188 *(__##name##_of_table) \
189 *(__##name##_of_table_end)
191 #define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc)
192 #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
193 #define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk)
194 #define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu)
195 #define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
196 #define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
197 #define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
200 #define ACPI_PROBE_TABLE(name) \
202 VMLINUX_SYMBOL(__##name##_acpi_probe_table) = .; \
203 *(__##name##_acpi_probe_table) \
204 VMLINUX_SYMBOL(__##name##_acpi_probe_table_end) = .;
206 #define ACPI_PROBE_TABLE(name)
209 #define KERNEL_DTB() \
211 VMLINUX_SYMBOL(__dtb_start) = .; \
212 *(.dtb.init.rodata) \
213 VMLINUX_SYMBOL(__dtb_end) = .;
221 *(.data..shared_aligned) /* percpu related */ \
222 MEM_KEEP(init.data) \
223 MEM_KEEP(exit.data) \
227 /* implement dynamic printk debug */ \
229 VMLINUX_SYMBOL(__start___jump_table) = .; \
231 VMLINUX_SYMBOL(__stop___jump_table) = .; \
233 VMLINUX_SYMBOL(__start___verbose) = .; \
235 VMLINUX_SYMBOL(__stop___verbose) = .; \
242 * Data section helpers
244 #define NOSAVE_DATA \
245 . = ALIGN(PAGE_SIZE); \
246 VMLINUX_SYMBOL(__nosave_begin) = .; \
248 . = ALIGN(PAGE_SIZE); \
249 VMLINUX_SYMBOL(__nosave_end) = .;
251 #define PAGE_ALIGNED_DATA(page_align) \
252 . = ALIGN(page_align); \
253 *(.data..page_aligned) \
254 . = ALIGN(page_align);
256 #define READ_MOSTLY_DATA(align) \
258 *(.data..read_mostly) \
261 #define CACHELINE_ALIGNED_DATA(align) \
263 *(.data..cacheline_aligned)
265 #define INIT_TASK_DATA(align) \
267 VMLINUX_SYMBOL(__start_init_task) = .; \
268 *(.data..init_task) \
269 VMLINUX_SYMBOL(__end_init_task) = .;
272 * Allow architectures to handle ro_after_init data on their
273 * own by defining an empty RO_AFTER_INIT_DATA.
275 #ifndef RO_AFTER_INIT_DATA
276 #define RO_AFTER_INIT_DATA \
277 __start_data_ro_after_init = .; \
278 *(.data..ro_after_init) \
279 __end_data_ro_after_init = .;
285 #define RO_DATA_SECTION(align) \
286 . = ALIGN((align)); \
287 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
288 VMLINUX_SYMBOL(__start_rodata) = .; \
289 *(.rodata) *(.rodata.*) \
290 RO_AFTER_INIT_DATA /* Read only after init */ \
291 *(__vermagic) /* Kernel version magic */ \
293 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
294 *(__tracepoints_ptrs) /* Tracepoints: pointer array */\
295 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
296 *(__tracepoints_strings)/* Tracepoints: strings */ \
299 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
306 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
307 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
308 *(.pci_fixup_early) \
309 VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
310 VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
311 *(.pci_fixup_header) \
312 VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
313 VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
314 *(.pci_fixup_final) \
315 VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
316 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
317 *(.pci_fixup_enable) \
318 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
319 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
320 *(.pci_fixup_resume) \
321 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
322 VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
323 *(.pci_fixup_resume_early) \
324 VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
325 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
326 *(.pci_fixup_suspend) \
327 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
328 VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \
329 *(.pci_fixup_suspend_late) \
330 VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
333 /* Built-in firmware blobs */ \
334 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
335 VMLINUX_SYMBOL(__start_builtin_fw) = .; \
337 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
342 /* Kernel symbol table: Normal symbols */ \
343 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
344 VMLINUX_SYMBOL(__start___ksymtab) = .; \
345 KEEP(*(SORT(___ksymtab+*))) \
346 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
349 /* Kernel symbol table: GPL-only symbols */ \
350 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
351 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
352 KEEP(*(SORT(___ksymtab_gpl+*))) \
353 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
356 /* Kernel symbol table: Normal unused symbols */ \
357 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
358 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
359 KEEP(*(SORT(___ksymtab_unused+*))) \
360 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
363 /* Kernel symbol table: GPL-only unused symbols */ \
364 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
365 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
366 KEEP(*(SORT(___ksymtab_unused_gpl+*))) \
367 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
370 /* Kernel symbol table: GPL-future-only symbols */ \
371 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
372 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
373 KEEP(*(SORT(___ksymtab_gpl_future+*))) \
374 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
377 /* Kernel symbol table: Normal symbols */ \
378 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
379 VMLINUX_SYMBOL(__start___kcrctab) = .; \
380 KEEP(*(SORT(___kcrctab+*))) \
381 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
384 /* Kernel symbol table: GPL-only symbols */ \
385 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
386 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
387 KEEP(*(SORT(___kcrctab_gpl+*))) \
388 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
391 /* Kernel symbol table: Normal unused symbols */ \
392 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
393 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
394 KEEP(*(SORT(___kcrctab_unused+*))) \
395 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
398 /* Kernel symbol table: GPL-only unused symbols */ \
399 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
400 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
401 KEEP(*(SORT(___kcrctab_unused_gpl+*))) \
402 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
405 /* Kernel symbol table: GPL-future-only symbols */ \
406 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
407 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
408 KEEP(*(SORT(___kcrctab_gpl_future+*))) \
409 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
412 /* Kernel symbol table: strings */ \
413 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
414 KEEP(*(__ksymtab_strings)) \
417 /* __*init sections */ \
418 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
420 MEM_KEEP(init.rodata) \
421 MEM_KEEP(exit.rodata) \
424 /* Built-in module parameters. */ \
425 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
426 VMLINUX_SYMBOL(__start___param) = .; \
428 VMLINUX_SYMBOL(__stop___param) = .; \
431 /* Built-in module versions. */ \
432 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
433 VMLINUX_SYMBOL(__start___modver) = .; \
435 VMLINUX_SYMBOL(__stop___modver) = .; \
436 . = ALIGN((align)); \
437 VMLINUX_SYMBOL(__end_rodata) = .; \
441 /* RODATA & RO_DATA provided for backward compatibility.
442 * All archs are supposed to use RO_DATA() */
443 #define RODATA RO_DATA_SECTION(4096)
444 #define RO_DATA(align) RO_DATA_SECTION(align)
446 #define SECURITY_INIT \
447 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
448 VMLINUX_SYMBOL(__security_initcall_start) = .; \
449 KEEP(*(.security_initcall.init)) \
450 VMLINUX_SYMBOL(__security_initcall_end) = .; \
454 * .text section. Map to function alignment to avoid address changes
455 * during second ld run in second ld pass when generating System.map
457 * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead
458 * code elimination is enabled, so these sections should be converted
463 *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \
465 MEM_KEEP(init.text) \
466 MEM_KEEP(exit.text) \
469 /* sched.text is aling to function alignment to secure we have same
470 * address even at second ld pass when generating System.map */
473 VMLINUX_SYMBOL(__sched_text_start) = .; \
475 VMLINUX_SYMBOL(__sched_text_end) = .;
477 /* spinlock.text is aling to function alignment to secure we have same
478 * address even at second ld pass when generating System.map */
481 VMLINUX_SYMBOL(__lock_text_start) = .; \
483 VMLINUX_SYMBOL(__lock_text_end) = .;
485 #define CPUIDLE_TEXT \
487 VMLINUX_SYMBOL(__cpuidle_text_start) = .; \
489 VMLINUX_SYMBOL(__cpuidle_text_end) = .;
491 #define KPROBES_TEXT \
493 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
495 VMLINUX_SYMBOL(__kprobes_text_end) = .;
499 VMLINUX_SYMBOL(__entry_text_start) = .; \
501 VMLINUX_SYMBOL(__entry_text_end) = .;
503 #if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
504 #define IRQENTRY_TEXT \
506 VMLINUX_SYMBOL(__irqentry_text_start) = .; \
508 VMLINUX_SYMBOL(__irqentry_text_end) = .;
510 #define IRQENTRY_TEXT
513 #if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_KASAN)
514 #define SOFTIRQENTRY_TEXT \
516 VMLINUX_SYMBOL(__softirqentry_text_start) = .; \
517 *(.softirqentry.text) \
518 VMLINUX_SYMBOL(__softirqentry_text_end) = .;
520 #define SOFTIRQENTRY_TEXT
523 /* Section used for early init (in .S files) */
524 #define HEAD_TEXT *(.head.text)
526 #define HEAD_TEXT_SECTION \
527 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
534 #define EXCEPTION_TABLE(align) \
536 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
537 VMLINUX_SYMBOL(__start___ex_table) = .; \
539 VMLINUX_SYMBOL(__stop___ex_table) = .; \
545 #define INIT_TASK_DATA_SECTION(align) \
547 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
548 INIT_TASK_DATA(align) \
551 #ifdef CONFIG_CONSTRUCTORS
552 #define KERNEL_CTORS() . = ALIGN(8); \
553 VMLINUX_SYMBOL(__ctors_start) = .; \
555 *(SORT(.init_array.*)) \
557 VMLINUX_SYMBOL(__ctors_end) = .;
559 #define KERNEL_CTORS()
562 /* init and exit section handling */
564 KEEP(*(SORT(___kentry+*))) \
566 MEM_DISCARD(init.data) \
573 MEM_DISCARD(init.rodata) \
575 RESERVEDMEM_OF_TABLES() \
578 CPU_METHOD_OF_TABLES() \
579 CPUIDLE_METHOD_OF_TABLES() \
581 IRQCHIP_OF_MATCH_TABLE() \
582 ACPI_PROBE_TABLE(irqchip) \
583 ACPI_PROBE_TABLE(clksrc) \
589 MEM_DISCARD(init.text)
595 MEM_DISCARD(exit.data) \
596 MEM_DISCARD(exit.rodata)
601 MEM_DISCARD(exit.text)
607 * bss (Block Started by Symbol) - uninitialized data
608 * zeroed during startup
610 #define SBSS(sbss_align) \
611 . = ALIGN(sbss_align); \
612 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
618 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
619 * sections to the front of bss.
621 #ifndef BSS_FIRST_SECTIONS
622 #define BSS_FIRST_SECTIONS
625 #define BSS(bss_align) \
626 . = ALIGN(bss_align); \
627 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
629 . = ALIGN(PAGE_SIZE); \
630 *(.bss..page_aligned) \
631 . = ALIGN(PAGE_SIZE); \
638 * DWARF debug sections.
639 * Symbols in the DWARF debugging sections are relative to
640 * the beginning of the section so we begin them at 0.
642 #define DWARF_DEBUG \
644 .debug 0 : { *(.debug) } \
645 .line 0 : { *(.line) } \
646 /* GNU DWARF 1 extensions */ \
647 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
648 .debug_sfnames 0 : { *(.debug_sfnames) } \
649 /* DWARF 1.1 and DWARF 2 */ \
650 .debug_aranges 0 : { *(.debug_aranges) } \
651 .debug_pubnames 0 : { *(.debug_pubnames) } \
653 .debug_info 0 : { *(.debug_info \
654 .gnu.linkonce.wi.*) } \
655 .debug_abbrev 0 : { *(.debug_abbrev) } \
656 .debug_line 0 : { *(.debug_line) } \
657 .debug_frame 0 : { *(.debug_frame) } \
658 .debug_str 0 : { *(.debug_str) } \
659 .debug_loc 0 : { *(.debug_loc) } \
660 .debug_macinfo 0 : { *(.debug_macinfo) } \
661 /* SGI/MIPS DWARF 2 extensions */ \
662 .debug_weaknames 0 : { *(.debug_weaknames) } \
663 .debug_funcnames 0 : { *(.debug_funcnames) } \
664 .debug_typenames 0 : { *(.debug_typenames) } \
665 .debug_varnames 0 : { *(.debug_varnames) } \
667 /* Stabs debugging sections. */
668 #define STABS_DEBUG \
669 .stab 0 : { *(.stab) } \
670 .stabstr 0 : { *(.stabstr) } \
671 .stab.excl 0 : { *(.stab.excl) } \
672 .stab.exclstr 0 : { *(.stab.exclstr) } \
673 .stab.index 0 : { *(.stab.index) } \
674 .stab.indexstr 0 : { *(.stab.indexstr) } \
675 .comment 0 : { *(.comment) }
677 #ifdef CONFIG_GENERIC_BUG
680 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
681 VMLINUX_SYMBOL(__start___bug_table) = .; \
683 VMLINUX_SYMBOL(__stop___bug_table) = .; \
689 #ifdef CONFIG_PM_TRACE
692 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
693 VMLINUX_SYMBOL(__tracedata_start) = .; \
695 VMLINUX_SYMBOL(__tracedata_end) = .; \
702 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
703 VMLINUX_SYMBOL(__start_notes) = .; \
705 VMLINUX_SYMBOL(__stop_notes) = .; \
708 #define INIT_SETUP(initsetup_align) \
709 . = ALIGN(initsetup_align); \
710 VMLINUX_SYMBOL(__setup_start) = .; \
712 VMLINUX_SYMBOL(__setup_end) = .;
714 #define INIT_CALLS_LEVEL(level) \
715 VMLINUX_SYMBOL(__initcall##level##_start) = .; \
716 KEEP(*(.initcall##level##.init)) \
717 KEEP(*(.initcall##level##s.init)) \
720 VMLINUX_SYMBOL(__initcall_start) = .; \
721 KEEP(*(.initcallearly.init)) \
722 INIT_CALLS_LEVEL(0) \
723 INIT_CALLS_LEVEL(1) \
724 INIT_CALLS_LEVEL(2) \
725 INIT_CALLS_LEVEL(3) \
726 INIT_CALLS_LEVEL(4) \
727 INIT_CALLS_LEVEL(5) \
728 INIT_CALLS_LEVEL(rootfs) \
729 INIT_CALLS_LEVEL(6) \
730 INIT_CALLS_LEVEL(7) \
731 VMLINUX_SYMBOL(__initcall_end) = .;
733 #define CON_INITCALL \
734 VMLINUX_SYMBOL(__con_initcall_start) = .; \
735 KEEP(*(.con_initcall.init)) \
736 VMLINUX_SYMBOL(__con_initcall_end) = .;
738 #define SECURITY_INITCALL \
739 VMLINUX_SYMBOL(__security_initcall_start) = .; \
740 KEEP(*(.security_initcall.init)) \
741 VMLINUX_SYMBOL(__security_initcall_end) = .;
743 #ifdef CONFIG_BLK_DEV_INITRD
744 #define INIT_RAM_FS \
746 VMLINUX_SYMBOL(__initramfs_start) = .; \
747 KEEP(*(.init.ramfs)) \
749 KEEP(*(.init.ramfs.info))
755 * Default discarded sections.
757 * Some archs want to discard exit text/data at runtime rather than
758 * link time due to cross-section references such as alt instructions,
759 * bug table, eh_frame, etc. DISCARDS must be the last of output
760 * section definitions so that such archs put those in earlier section
773 * PERCPU_INPUT - the percpu input sections
774 * @cacheline: cacheline size
776 * The core percpu section names and core symbols which do not rely
777 * directly upon load addresses.
779 * @cacheline is used to align subsections to avoid false cacheline
780 * sharing between subsections for different purposes.
782 #define PERCPU_INPUT(cacheline) \
783 VMLINUX_SYMBOL(__per_cpu_start) = .; \
784 VMLINUX_SYMBOL(__per_cpu_user_mapped_start) = .; \
785 *(.data..percpu..first) \
786 . = ALIGN(cacheline); \
787 *(.data..percpu..user_mapped) \
788 *(.data..percpu..user_mapped..shared_aligned) \
789 . = ALIGN(PAGE_SIZE); \
790 *(.data..percpu..user_mapped..page_aligned) \
791 VMLINUX_SYMBOL(__per_cpu_user_mapped_end) = .; \
792 . = ALIGN(PAGE_SIZE); \
793 *(.data..percpu..page_aligned) \
794 . = ALIGN(cacheline); \
795 *(.data..percpu..read_mostly) \
796 . = ALIGN(cacheline); \
798 *(.data..percpu..shared_aligned) \
799 VMLINUX_SYMBOL(__per_cpu_end) = .;
802 * PERCPU_VADDR - define output section for percpu area
803 * @cacheline: cacheline size
804 * @vaddr: explicit base address (optional)
805 * @phdr: destination PHDR (optional)
807 * Macro which expands to output section for percpu area.
809 * @cacheline is used to align subsections to avoid false cacheline
810 * sharing between subsections for different purposes.
812 * If @vaddr is not blank, it specifies explicit base address and all
813 * percpu symbols will be offset from the given address. If blank,
814 * @vaddr always equals @laddr + LOAD_OFFSET.
816 * @phdr defines the output PHDR to use if not blank. Be warned that
817 * output PHDR is sticky. If @phdr is specified, the next output
818 * section in the linker script will go there too. @phdr should have
821 * Note that this macros defines __per_cpu_load as an absolute symbol.
822 * If there is no need to put the percpu section at a predetermined
823 * address, use PERCPU_SECTION.
825 #define PERCPU_VADDR(cacheline, vaddr, phdr) \
826 VMLINUX_SYMBOL(__per_cpu_load) = .; \
827 .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
829 PERCPU_INPUT(cacheline) \
831 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
834 * PERCPU_SECTION - define output section for percpu area, simple version
835 * @cacheline: cacheline size
837 * Align to PAGE_SIZE and outputs output section for percpu area. This
838 * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
839 * __per_cpu_start will be identical.
841 * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
842 * except that __per_cpu_load is defined as a relative symbol against
843 * .data..percpu which is required for relocatable x86_32 configuration.
845 #define PERCPU_SECTION(cacheline) \
846 . = ALIGN(PAGE_SIZE); \
847 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
848 VMLINUX_SYMBOL(__per_cpu_load) = .; \
849 PERCPU_INPUT(cacheline) \
854 * Definition of the high level *_SECTION macros
855 * They will fit only a subset of the architectures
861 * All sections are combined in a single .data section.
862 * The sections following CONSTRUCTORS are arranged so their
863 * typical alignment matches.
864 * A cacheline is typical/always less than a PAGE_SIZE so
865 * the sections that has this restriction (or similar)
866 * is located before the ones requiring PAGE_SIZE alignment.
867 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
868 * matches the requirement of PAGE_ALIGNED_DATA.
870 * use 0 as page_align if page_aligned data is not used */
871 #define RW_DATA_SECTION(cacheline, pagealigned, inittask) \
872 . = ALIGN(PAGE_SIZE); \
873 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
874 INIT_TASK_DATA(inittask) \
876 PAGE_ALIGNED_DATA(pagealigned) \
877 CACHELINE_ALIGNED_DATA(cacheline) \
878 READ_MOSTLY_DATA(cacheline) \
883 #define INIT_TEXT_SECTION(inittext_align) \
884 . = ALIGN(inittext_align); \
885 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
886 VMLINUX_SYMBOL(_sinittext) = .; \
888 VMLINUX_SYMBOL(_einittext) = .; \
891 #define INIT_DATA_SECTION(initsetup_align) \
892 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
894 INIT_SETUP(initsetup_align) \
901 #define BSS_SECTION(sbss_align, bss_align, stop_align) \
902 . = ALIGN(sbss_align); \
903 VMLINUX_SYMBOL(__bss_start) = .; \
906 . = ALIGN(stop_align); \
907 VMLINUX_SYMBOL(__bss_stop) = .;