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 KEEP(*(_kprobe_blacklist)) \
134 VMLINUX_SYMBOL(__stop_kprobe_blacklist) = .;
136 #define KPROBE_BLACKLIST()
139 #ifdef CONFIG_FUNCTION_ERROR_INJECTION
140 #define ERROR_INJECT_WHITELIST() STRUCT_ALIGN(); \
141 VMLINUX_SYMBOL(__start_error_injection_whitelist) = .;\
142 KEEP(*(_error_injection_whitelist)) \
143 VMLINUX_SYMBOL(__stop_error_injection_whitelist) = .;
145 #define ERROR_INJECT_WHITELIST()
148 #ifdef CONFIG_EVENT_TRACING
149 #define FTRACE_EVENTS() . = ALIGN(8); \
150 VMLINUX_SYMBOL(__start_ftrace_events) = .; \
151 KEEP(*(_ftrace_events)) \
152 VMLINUX_SYMBOL(__stop_ftrace_events) = .; \
153 VMLINUX_SYMBOL(__start_ftrace_eval_maps) = .; \
154 KEEP(*(_ftrace_eval_map)) \
155 VMLINUX_SYMBOL(__stop_ftrace_eval_maps) = .;
157 #define FTRACE_EVENTS()
160 #ifdef CONFIG_TRACING
161 #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
162 KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \
163 VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
164 #define TRACEPOINT_STR() VMLINUX_SYMBOL(__start___tracepoint_str) = .; \
165 KEEP(*(__tracepoint_str)) /* Trace_printk fmt' pointer */ \
166 VMLINUX_SYMBOL(__stop___tracepoint_str) = .;
168 #define TRACE_PRINTKS()
169 #define TRACEPOINT_STR()
172 #ifdef CONFIG_FTRACE_SYSCALLS
173 #define TRACE_SYSCALLS() . = ALIGN(8); \
174 VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
175 KEEP(*(__syscalls_metadata)) \
176 VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
178 #define TRACE_SYSCALLS()
181 #ifdef CONFIG_SERIAL_EARLYCON
182 #define EARLYCON_TABLE() STRUCT_ALIGN(); \
183 VMLINUX_SYMBOL(__earlycon_table) = .; \
184 KEEP(*(__earlycon_table)) \
185 VMLINUX_SYMBOL(__earlycon_table_end) = .;
187 #define EARLYCON_TABLE()
190 #define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
191 #define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name)
192 #define OF_TABLE(cfg, name) __OF_TABLE(IS_ENABLED(cfg), name)
193 #define _OF_TABLE_0(name)
194 #define _OF_TABLE_1(name) \
196 VMLINUX_SYMBOL(__##name##_of_table) = .; \
197 KEEP(*(__##name##_of_table)) \
198 KEEP(*(__##name##_of_table_end))
200 #define TIMER_OF_TABLES() OF_TABLE(CONFIG_TIMER_OF, timer)
201 #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
202 #define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk)
203 #define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu)
204 #define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
205 #define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
206 #define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
209 #define ACPI_PROBE_TABLE(name) \
211 VMLINUX_SYMBOL(__##name##_acpi_probe_table) = .; \
212 KEEP(*(__##name##_acpi_probe_table)) \
213 VMLINUX_SYMBOL(__##name##_acpi_probe_table_end) = .;
215 #define ACPI_PROBE_TABLE(name)
218 #define KERNEL_DTB() \
220 VMLINUX_SYMBOL(__dtb_start) = .; \
221 KEEP(*(.dtb.init.rodata)) \
222 VMLINUX_SYMBOL(__dtb_end) = .;
231 *(.data..shared_aligned) /* percpu related */ \
232 MEM_KEEP(init.data) \
233 MEM_KEEP(exit.data) \
235 VMLINUX_SYMBOL(__start_once) = .; \
237 VMLINUX_SYMBOL(__end_once) = .; \
240 /* implement dynamic printk debug */ \
242 VMLINUX_SYMBOL(__start___jump_table) = .; \
243 KEEP(*(__jump_table)) \
244 VMLINUX_SYMBOL(__stop___jump_table) = .; \
246 VMLINUX_SYMBOL(__start___verbose) = .; \
248 VMLINUX_SYMBOL(__stop___verbose) = .; \
255 * Data section helpers
257 #define NOSAVE_DATA \
258 . = ALIGN(PAGE_SIZE); \
259 VMLINUX_SYMBOL(__nosave_begin) = .; \
261 . = ALIGN(PAGE_SIZE); \
262 VMLINUX_SYMBOL(__nosave_end) = .;
264 #define PAGE_ALIGNED_DATA(page_align) \
265 . = ALIGN(page_align); \
266 *(.data..page_aligned)
268 #define READ_MOSTLY_DATA(align) \
270 *(.data..read_mostly) \
273 #define CACHELINE_ALIGNED_DATA(align) \
275 *(.data..cacheline_aligned)
277 #define INIT_TASK_DATA(align) \
279 VMLINUX_SYMBOL(__start_init_task) = .; \
280 VMLINUX_SYMBOL(init_thread_union) = .; \
281 VMLINUX_SYMBOL(init_stack) = .; \
282 *(.data..init_task) \
283 *(.data..init_thread_info) \
284 . = VMLINUX_SYMBOL(__start_init_task) + THREAD_SIZE; \
285 VMLINUX_SYMBOL(__end_init_task) = .;
288 * Allow architectures to handle ro_after_init data on their
289 * own by defining an empty RO_AFTER_INIT_DATA.
291 #ifndef RO_AFTER_INIT_DATA
292 #define RO_AFTER_INIT_DATA \
293 VMLINUX_SYMBOL(__start_ro_after_init) = .; \
294 *(.data..ro_after_init) \
295 VMLINUX_SYMBOL(__end_ro_after_init) = .;
301 #define RO_DATA_SECTION(align) \
302 . = ALIGN((align)); \
303 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
304 VMLINUX_SYMBOL(__start_rodata) = .; \
305 *(.rodata) *(.rodata.*) \
306 RO_AFTER_INIT_DATA /* Read only after init */ \
307 KEEP(*(__vermagic)) /* Kernel version magic */ \
309 VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \
310 KEEP(*(__tracepoints_ptrs)) /* Tracepoints: pointer array */ \
311 VMLINUX_SYMBOL(__stop___tracepoints_ptrs) = .; \
312 *(__tracepoints_strings)/* Tracepoints: strings */ \
315 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
320 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
321 VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
322 KEEP(*(.pci_fixup_early)) \
323 VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
324 VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
325 KEEP(*(.pci_fixup_header)) \
326 VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
327 VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
328 KEEP(*(.pci_fixup_final)) \
329 VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
330 VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
331 KEEP(*(.pci_fixup_enable)) \
332 VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
333 VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
334 KEEP(*(.pci_fixup_resume)) \
335 VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
336 VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
337 KEEP(*(.pci_fixup_resume_early)) \
338 VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
339 VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
340 KEEP(*(.pci_fixup_suspend)) \
341 VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
342 VMLINUX_SYMBOL(__start_pci_fixups_suspend_late) = .; \
343 KEEP(*(.pci_fixup_suspend_late)) \
344 VMLINUX_SYMBOL(__end_pci_fixups_suspend_late) = .; \
347 /* Built-in firmware blobs */ \
348 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
349 VMLINUX_SYMBOL(__start_builtin_fw) = .; \
350 KEEP(*(.builtin_fw)) \
351 VMLINUX_SYMBOL(__end_builtin_fw) = .; \
356 /* Kernel symbol table: Normal symbols */ \
357 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
358 VMLINUX_SYMBOL(__start___ksymtab) = .; \
359 KEEP(*(SORT(___ksymtab+*))) \
360 VMLINUX_SYMBOL(__stop___ksymtab) = .; \
363 /* Kernel symbol table: GPL-only symbols */ \
364 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
365 VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
366 KEEP(*(SORT(___ksymtab_gpl+*))) \
367 VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
370 /* Kernel symbol table: Normal unused symbols */ \
371 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
372 VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
373 KEEP(*(SORT(___ksymtab_unused+*))) \
374 VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
377 /* Kernel symbol table: GPL-only unused symbols */ \
378 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
379 VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
380 KEEP(*(SORT(___ksymtab_unused_gpl+*))) \
381 VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
384 /* Kernel symbol table: GPL-future-only symbols */ \
385 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
386 VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
387 KEEP(*(SORT(___ksymtab_gpl_future+*))) \
388 VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
391 /* Kernel symbol table: Normal symbols */ \
392 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
393 VMLINUX_SYMBOL(__start___kcrctab) = .; \
394 KEEP(*(SORT(___kcrctab+*))) \
395 VMLINUX_SYMBOL(__stop___kcrctab) = .; \
398 /* Kernel symbol table: GPL-only symbols */ \
399 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
400 VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
401 KEEP(*(SORT(___kcrctab_gpl+*))) \
402 VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
405 /* Kernel symbol table: Normal unused symbols */ \
406 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
407 VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
408 KEEP(*(SORT(___kcrctab_unused+*))) \
409 VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
412 /* Kernel symbol table: GPL-only unused symbols */ \
413 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
414 VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
415 KEEP(*(SORT(___kcrctab_unused_gpl+*))) \
416 VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
419 /* Kernel symbol table: GPL-future-only symbols */ \
420 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
421 VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
422 KEEP(*(SORT(___kcrctab_gpl_future+*))) \
423 VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
426 /* Kernel symbol table: strings */ \
427 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
428 *(__ksymtab_strings) \
431 /* __*init sections */ \
432 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
434 MEM_KEEP(init.rodata) \
435 MEM_KEEP(exit.rodata) \
438 /* Built-in module parameters. */ \
439 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
440 VMLINUX_SYMBOL(__start___param) = .; \
442 VMLINUX_SYMBOL(__stop___param) = .; \
445 /* Built-in module versions. */ \
446 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
447 VMLINUX_SYMBOL(__start___modver) = .; \
449 VMLINUX_SYMBOL(__stop___modver) = .; \
450 . = ALIGN((align)); \
451 VMLINUX_SYMBOL(__end_rodata) = .; \
455 /* RODATA & RO_DATA provided for backward compatibility.
456 * All archs are supposed to use RO_DATA() */
457 #define RODATA RO_DATA_SECTION(4096)
458 #define RO_DATA(align) RO_DATA_SECTION(align)
460 #define SECURITY_INIT \
461 .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
462 VMLINUX_SYMBOL(__security_initcall_start) = .; \
463 KEEP(*(.security_initcall.init)) \
464 VMLINUX_SYMBOL(__security_initcall_end) = .; \
468 * .text section. Map to function alignment to avoid address changes
469 * during second ld run in second ld pass when generating System.map
471 * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead
472 * code elimination is enabled, so these sections should be converted
477 *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \
480 MEM_KEEP(init.text) \
481 MEM_KEEP(exit.text) \
484 /* sched.text is aling to function alignment to secure we have same
485 * address even at second ld pass when generating System.map */
488 VMLINUX_SYMBOL(__sched_text_start) = .; \
490 VMLINUX_SYMBOL(__sched_text_end) = .;
492 /* spinlock.text is aling to function alignment to secure we have same
493 * address even at second ld pass when generating System.map */
496 VMLINUX_SYMBOL(__lock_text_start) = .; \
498 VMLINUX_SYMBOL(__lock_text_end) = .;
500 #define CPUIDLE_TEXT \
502 VMLINUX_SYMBOL(__cpuidle_text_start) = .; \
504 VMLINUX_SYMBOL(__cpuidle_text_end) = .;
506 #define KPROBES_TEXT \
508 VMLINUX_SYMBOL(__kprobes_text_start) = .; \
510 VMLINUX_SYMBOL(__kprobes_text_end) = .;
514 VMLINUX_SYMBOL(__entry_text_start) = .; \
516 VMLINUX_SYMBOL(__entry_text_end) = .;
518 #define IRQENTRY_TEXT \
520 VMLINUX_SYMBOL(__irqentry_text_start) = .; \
522 VMLINUX_SYMBOL(__irqentry_text_end) = .;
524 #define SOFTIRQENTRY_TEXT \
526 VMLINUX_SYMBOL(__softirqentry_text_start) = .; \
527 *(.softirqentry.text) \
528 VMLINUX_SYMBOL(__softirqentry_text_end) = .;
530 /* Section used for early init (in .S files) */
531 #define HEAD_TEXT *(.head.text)
533 #define HEAD_TEXT_SECTION \
534 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
541 #define EXCEPTION_TABLE(align) \
543 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
544 VMLINUX_SYMBOL(__start___ex_table) = .; \
545 KEEP(*(__ex_table)) \
546 VMLINUX_SYMBOL(__stop___ex_table) = .; \
552 #define INIT_TASK_DATA_SECTION(align) \
554 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
555 INIT_TASK_DATA(align) \
558 #ifdef CONFIG_CONSTRUCTORS
559 #define KERNEL_CTORS() . = ALIGN(8); \
560 VMLINUX_SYMBOL(__ctors_start) = .; \
562 KEEP(*(SORT(.init_array.*))) \
563 KEEP(*(.init_array)) \
564 VMLINUX_SYMBOL(__ctors_end) = .;
566 #define KERNEL_CTORS()
569 /* init and exit section handling */
571 KEEP(*(SORT(___kentry+*))) \
573 MEM_DISCARD(init.data) \
580 ERROR_INJECT_WHITELIST() \
581 MEM_DISCARD(init.rodata) \
583 RESERVEDMEM_OF_TABLES() \
586 CPU_METHOD_OF_TABLES() \
587 CPUIDLE_METHOD_OF_TABLES() \
589 IRQCHIP_OF_MATCH_TABLE() \
590 ACPI_PROBE_TABLE(irqchip) \
591 ACPI_PROBE_TABLE(timer) \
592 ACPI_PROBE_TABLE(iort) \
598 MEM_DISCARD(init.text)
604 MEM_DISCARD(exit.data) \
605 MEM_DISCARD(exit.rodata)
610 MEM_DISCARD(exit.text)
616 * bss (Block Started by Symbol) - uninitialized data
617 * zeroed during startup
619 #define SBSS(sbss_align) \
620 . = ALIGN(sbss_align); \
621 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
628 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
629 * sections to the front of bss.
631 #ifndef BSS_FIRST_SECTIONS
632 #define BSS_FIRST_SECTIONS
635 #define BSS(bss_align) \
636 . = ALIGN(bss_align); \
637 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
639 *(.bss..page_aligned) \
646 * DWARF debug sections.
647 * Symbols in the DWARF debugging sections are relative to
648 * the beginning of the section so we begin them at 0.
650 #define DWARF_DEBUG \
652 .debug 0 : { *(.debug) } \
653 .line 0 : { *(.line) } \
654 /* GNU DWARF 1 extensions */ \
655 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
656 .debug_sfnames 0 : { *(.debug_sfnames) } \
657 /* DWARF 1.1 and DWARF 2 */ \
658 .debug_aranges 0 : { *(.debug_aranges) } \
659 .debug_pubnames 0 : { *(.debug_pubnames) } \
661 .debug_info 0 : { *(.debug_info \
662 .gnu.linkonce.wi.*) } \
663 .debug_abbrev 0 : { *(.debug_abbrev) } \
664 .debug_line 0 : { *(.debug_line) } \
665 .debug_frame 0 : { *(.debug_frame) } \
666 .debug_str 0 : { *(.debug_str) } \
667 .debug_loc 0 : { *(.debug_loc) } \
668 .debug_macinfo 0 : { *(.debug_macinfo) } \
669 .debug_pubtypes 0 : { *(.debug_pubtypes) } \
671 .debug_ranges 0 : { *(.debug_ranges) } \
672 /* SGI/MIPS DWARF 2 extensions */ \
673 .debug_weaknames 0 : { *(.debug_weaknames) } \
674 .debug_funcnames 0 : { *(.debug_funcnames) } \
675 .debug_typenames 0 : { *(.debug_typenames) } \
676 .debug_varnames 0 : { *(.debug_varnames) } \
677 /* GNU DWARF 2 extensions */ \
678 .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } \
679 .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } \
681 .debug_types 0 : { *(.debug_types) } \
683 .debug_macro 0 : { *(.debug_macro) } \
684 .debug_addr 0 : { *(.debug_addr) }
686 /* Stabs debugging sections. */
687 #define STABS_DEBUG \
688 .stab 0 : { *(.stab) } \
689 .stabstr 0 : { *(.stabstr) } \
690 .stab.excl 0 : { *(.stab.excl) } \
691 .stab.exclstr 0 : { *(.stab.exclstr) } \
692 .stab.index 0 : { *(.stab.index) } \
693 .stab.indexstr 0 : { *(.stab.indexstr) } \
694 .comment 0 : { *(.comment) }
696 #ifdef CONFIG_GENERIC_BUG
699 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
700 VMLINUX_SYMBOL(__start___bug_table) = .; \
701 KEEP(*(__bug_table)) \
702 VMLINUX_SYMBOL(__stop___bug_table) = .; \
708 #ifdef CONFIG_UNWINDER_ORC
709 #define ORC_UNWIND_TABLE \
711 .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \
712 VMLINUX_SYMBOL(__start_orc_unwind_ip) = .; \
713 KEEP(*(.orc_unwind_ip)) \
714 VMLINUX_SYMBOL(__stop_orc_unwind_ip) = .; \
717 .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \
718 VMLINUX_SYMBOL(__start_orc_unwind) = .; \
719 KEEP(*(.orc_unwind)) \
720 VMLINUX_SYMBOL(__stop_orc_unwind) = .; \
723 .orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \
724 VMLINUX_SYMBOL(orc_lookup) = .; \
725 . += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) / \
726 LOOKUP_BLOCK_SIZE) + 1) * 4; \
727 VMLINUX_SYMBOL(orc_lookup_end) = .; \
730 #define ORC_UNWIND_TABLE
733 #ifdef CONFIG_PM_TRACE
736 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
737 VMLINUX_SYMBOL(__tracedata_start) = .; \
738 KEEP(*(.tracedata)) \
739 VMLINUX_SYMBOL(__tracedata_end) = .; \
746 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
747 VMLINUX_SYMBOL(__start_notes) = .; \
749 VMLINUX_SYMBOL(__stop_notes) = .; \
752 #define INIT_SETUP(initsetup_align) \
753 . = ALIGN(initsetup_align); \
754 VMLINUX_SYMBOL(__setup_start) = .; \
755 KEEP(*(.init.setup)) \
756 VMLINUX_SYMBOL(__setup_end) = .;
758 #define INIT_CALLS_LEVEL(level) \
759 VMLINUX_SYMBOL(__initcall##level##_start) = .; \
760 KEEP(*(.initcall##level##.init)) \
761 KEEP(*(.initcall##level##s.init)) \
764 VMLINUX_SYMBOL(__initcall_start) = .; \
765 KEEP(*(.initcallearly.init)) \
766 INIT_CALLS_LEVEL(0) \
767 INIT_CALLS_LEVEL(1) \
768 INIT_CALLS_LEVEL(2) \
769 INIT_CALLS_LEVEL(3) \
770 INIT_CALLS_LEVEL(4) \
771 INIT_CALLS_LEVEL(5) \
772 INIT_CALLS_LEVEL(rootfs) \
773 INIT_CALLS_LEVEL(6) \
774 INIT_CALLS_LEVEL(7) \
775 VMLINUX_SYMBOL(__initcall_end) = .;
777 #define CON_INITCALL \
778 VMLINUX_SYMBOL(__con_initcall_start) = .; \
779 KEEP(*(.con_initcall.init)) \
780 VMLINUX_SYMBOL(__con_initcall_end) = .;
782 #define SECURITY_INITCALL \
783 VMLINUX_SYMBOL(__security_initcall_start) = .; \
784 KEEP(*(.security_initcall.init)) \
785 VMLINUX_SYMBOL(__security_initcall_end) = .;
787 #ifdef CONFIG_BLK_DEV_INITRD
788 #define INIT_RAM_FS \
790 VMLINUX_SYMBOL(__initramfs_start) = .; \
791 KEEP(*(.init.ramfs)) \
793 KEEP(*(.init.ramfs.info))
799 * Memory encryption operates on a page basis. Since we need to clear
800 * the memory encryption mask for this section, it needs to be aligned
801 * on a page boundary and be a page-size multiple in length.
803 * Note: We use a separate section so that only this section gets
804 * decrypted to avoid exposing more than we wish.
806 #ifdef CONFIG_AMD_MEM_ENCRYPT
807 #define PERCPU_DECRYPTED_SECTION \
808 . = ALIGN(PAGE_SIZE); \
809 *(.data..percpu..decrypted) \
810 . = ALIGN(PAGE_SIZE);
812 #define PERCPU_DECRYPTED_SECTION
817 * Default discarded sections.
819 * Some archs want to discard exit text/data at runtime rather than
820 * link time due to cross-section references such as alt instructions,
821 * bug table, eh_frame, etc. DISCARDS must be the last of output
822 * section definitions so that such archs put those in earlier section
835 * PERCPU_INPUT - the percpu input sections
836 * @cacheline: cacheline size
838 * The core percpu section names and core symbols which do not rely
839 * directly upon load addresses.
841 * @cacheline is used to align subsections to avoid false cacheline
842 * sharing between subsections for different purposes.
844 #define PERCPU_INPUT(cacheline) \
845 VMLINUX_SYMBOL(__per_cpu_start) = .; \
846 *(.data..percpu..first) \
847 . = ALIGN(PAGE_SIZE); \
848 *(.data..percpu..page_aligned) \
849 . = ALIGN(cacheline); \
850 *(.data..percpu..read_mostly) \
851 . = ALIGN(cacheline); \
853 *(.data..percpu..shared_aligned) \
854 PERCPU_DECRYPTED_SECTION \
855 VMLINUX_SYMBOL(__per_cpu_end) = .;
858 * PERCPU_VADDR - define output section for percpu area
859 * @cacheline: cacheline size
860 * @vaddr: explicit base address (optional)
861 * @phdr: destination PHDR (optional)
863 * Macro which expands to output section for percpu area.
865 * @cacheline is used to align subsections to avoid false cacheline
866 * sharing between subsections for different purposes.
868 * If @vaddr is not blank, it specifies explicit base address and all
869 * percpu symbols will be offset from the given address. If blank,
870 * @vaddr always equals @laddr + LOAD_OFFSET.
872 * @phdr defines the output PHDR to use if not blank. Be warned that
873 * output PHDR is sticky. If @phdr is specified, the next output
874 * section in the linker script will go there too. @phdr should have
877 * Note that this macros defines __per_cpu_load as an absolute symbol.
878 * If there is no need to put the percpu section at a predetermined
879 * address, use PERCPU_SECTION.
881 #define PERCPU_VADDR(cacheline, vaddr, phdr) \
882 VMLINUX_SYMBOL(__per_cpu_load) = .; \
883 .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
885 PERCPU_INPUT(cacheline) \
887 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
890 * PERCPU_SECTION - define output section for percpu area, simple version
891 * @cacheline: cacheline size
893 * Align to PAGE_SIZE and outputs output section for percpu area. This
894 * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
895 * __per_cpu_start will be identical.
897 * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
898 * except that __per_cpu_load is defined as a relative symbol against
899 * .data..percpu which is required for relocatable x86_32 configuration.
901 #define PERCPU_SECTION(cacheline) \
902 . = ALIGN(PAGE_SIZE); \
903 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
904 VMLINUX_SYMBOL(__per_cpu_load) = .; \
905 PERCPU_INPUT(cacheline) \
910 * Definition of the high level *_SECTION macros
911 * They will fit only a subset of the architectures
917 * All sections are combined in a single .data section.
918 * The sections following CONSTRUCTORS are arranged so their
919 * typical alignment matches.
920 * A cacheline is typical/always less than a PAGE_SIZE so
921 * the sections that has this restriction (or similar)
922 * is located before the ones requiring PAGE_SIZE alignment.
923 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
924 * matches the requirement of PAGE_ALIGNED_DATA.
926 * use 0 as page_align if page_aligned data is not used */
927 #define RW_DATA_SECTION(cacheline, pagealigned, inittask) \
928 . = ALIGN(PAGE_SIZE); \
929 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
930 INIT_TASK_DATA(inittask) \
932 PAGE_ALIGNED_DATA(pagealigned) \
933 CACHELINE_ALIGNED_DATA(cacheline) \
934 READ_MOSTLY_DATA(cacheline) \
940 #define INIT_TEXT_SECTION(inittext_align) \
941 . = ALIGN(inittext_align); \
942 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
943 VMLINUX_SYMBOL(_sinittext) = .; \
945 VMLINUX_SYMBOL(_einittext) = .; \
948 #define INIT_DATA_SECTION(initsetup_align) \
949 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
951 INIT_SETUP(initsetup_align) \
958 #define BSS_SECTION(sbss_align, bss_align, stop_align) \
959 . = ALIGN(sbss_align); \
960 VMLINUX_SYMBOL(__bss_start) = .; \
963 . = ALIGN(stop_align); \
964 VMLINUX_SYMBOL(__bss_stop) = .;