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)
30 * EXCEPTION_TABLE(...)
32 * BSS_SECTION(0, 0, 0)
38 * DISCARDS // must be the last
41 * [__init_begin, __init_end] is the init section that may be freed after init
42 * // __init_begin and __init_end should be page aligned, so that we can
43 * // free the whole .init memory
44 * [_stext, _etext] is the text section
45 * [_sdata, _edata] is the data section
47 * Some of the included output section have their own set of constants.
48 * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
49 * [__nosave_begin, __nosave_end] for the nosave data
57 * Only some architectures want to have the .notes segment visible in
58 * a separate PT_NOTE ELF Program Header. When this happens, it needs
59 * to be visible in both the kernel text's PT_LOAD and the PT_NOTE
60 * Program Headers. In this case, though, the PT_LOAD needs to be made
61 * the default again so that all the following sections don't also end
62 * up in the PT_NOTE Program Header.
65 #define NOTES_HEADERS :text :note
66 #define NOTES_HEADERS_RESTORE __restore_ph : { *(.__restore_ph) } :text
69 #define NOTES_HEADERS_RESTORE
73 * Some architectures have non-executable read-only exception tables.
74 * They can be added to the RO_DATA segment by specifying their desired
77 #ifdef RO_EXCEPTION_TABLE_ALIGN
78 #define RO_EXCEPTION_TABLE EXCEPTION_TABLE(RO_EXCEPTION_TABLE_ALIGN)
80 #define RO_EXCEPTION_TABLE
83 /* Align . to a 8 byte boundary equals to maximum function alignment. */
84 #define ALIGN_FUNCTION() . = ALIGN(8)
87 * LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections, which
88 * generates .data.identifier sections, which need to be pulled in with
89 * .data. We don't want to pull in .data..other sections, which Linux
90 * has defined. Same for text and bss.
92 * RODATA_MAIN is not used because existing code already defines .rodata.x
93 * sections to be brought in with rodata.
95 #ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION
96 #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
97 #define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..LPBX*
98 #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
99 #define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]*
100 #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]*
101 #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*
103 #define TEXT_MAIN .text
104 #define DATA_MAIN .data
105 #define SDATA_MAIN .sdata
106 #define RODATA_MAIN .rodata
107 #define BSS_MAIN .bss
108 #define SBSS_MAIN .sbss
112 * Align to a 32 byte boundary equal to the
113 * alignment gcc 4.5 uses for a struct
115 #define STRUCT_ALIGNMENT 32
116 #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
118 /* The actual configuration determine if the init/exit sections
119 * are handled as text/data or they can be discarded (which
120 * often happens at runtime)
122 #ifdef CONFIG_HOTPLUG_CPU
123 #define CPU_KEEP(sec) *(.cpu##sec)
124 #define CPU_DISCARD(sec)
126 #define CPU_KEEP(sec)
127 #define CPU_DISCARD(sec) *(.cpu##sec)
130 #if defined(CONFIG_MEMORY_HOTPLUG)
131 #define MEM_KEEP(sec) *(.mem##sec)
132 #define MEM_DISCARD(sec)
134 #define MEM_KEEP(sec)
135 #define MEM_DISCARD(sec) *(.mem##sec)
138 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
140 * The ftrace call sites are logged to a section whose name depends on the
141 * compiler option used. A given kernel image will only use one, AKA
142 * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
143 * dependencies for FTRACE_CALLSITE_SECTION's definition.
145 * Need to also make ftrace_stub_graph point to ftrace_stub
146 * so that the same stub location may have different protocols
147 * and not mess up with C verifiers.
149 #define MCOUNT_REC() . = ALIGN(8); \
150 __start_mcount_loc = .; \
151 KEEP(*(__mcount_loc)) \
152 KEEP(*(__patchable_function_entries)) \
153 __stop_mcount_loc = .; \
154 ftrace_stub_graph = ftrace_stub;
156 # ifdef CONFIG_FUNCTION_TRACER
157 # define MCOUNT_REC() ftrace_stub_graph = ftrace_stub;
159 # define MCOUNT_REC()
163 #ifdef CONFIG_TRACE_BRANCH_PROFILING
164 #define LIKELY_PROFILE() __start_annotated_branch_profile = .; \
165 KEEP(*(_ftrace_annotated_branch)) \
166 __stop_annotated_branch_profile = .;
168 #define LIKELY_PROFILE()
171 #ifdef CONFIG_PROFILE_ALL_BRANCHES
172 #define BRANCH_PROFILE() __start_branch_profile = .; \
173 KEEP(*(_ftrace_branch)) \
174 __stop_branch_profile = .;
176 #define BRANCH_PROFILE()
179 #ifdef CONFIG_KPROBES
180 #define KPROBE_BLACKLIST() . = ALIGN(8); \
181 __start_kprobe_blacklist = .; \
182 KEEP(*(_kprobe_blacklist)) \
183 __stop_kprobe_blacklist = .;
185 #define KPROBE_BLACKLIST()
188 #ifdef CONFIG_FUNCTION_ERROR_INJECTION
189 #define ERROR_INJECT_WHITELIST() STRUCT_ALIGN(); \
190 __start_error_injection_whitelist = .; \
191 KEEP(*(_error_injection_whitelist)) \
192 __stop_error_injection_whitelist = .;
194 #define ERROR_INJECT_WHITELIST()
197 #ifdef CONFIG_EVENT_TRACING
198 #define FTRACE_EVENTS() . = ALIGN(8); \
199 __start_ftrace_events = .; \
200 KEEP(*(_ftrace_events)) \
201 __stop_ftrace_events = .; \
202 __start_ftrace_eval_maps = .; \
203 KEEP(*(_ftrace_eval_map)) \
204 __stop_ftrace_eval_maps = .;
206 #define FTRACE_EVENTS()
209 #ifdef CONFIG_TRACING
210 #define TRACE_PRINTKS() __start___trace_bprintk_fmt = .; \
211 KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \
212 __stop___trace_bprintk_fmt = .;
213 #define TRACEPOINT_STR() __start___tracepoint_str = .; \
214 KEEP(*(__tracepoint_str)) /* Trace_printk fmt' pointer */ \
215 __stop___tracepoint_str = .;
217 #define TRACE_PRINTKS()
218 #define TRACEPOINT_STR()
221 #ifdef CONFIG_FTRACE_SYSCALLS
222 #define TRACE_SYSCALLS() . = ALIGN(8); \
223 __start_syscalls_metadata = .; \
224 KEEP(*(__syscalls_metadata)) \
225 __stop_syscalls_metadata = .;
227 #define TRACE_SYSCALLS()
230 #ifdef CONFIG_BPF_EVENTS
231 #define BPF_RAW_TP() STRUCT_ALIGN(); \
232 __start__bpf_raw_tp = .; \
233 KEEP(*(__bpf_raw_tp_map)) \
234 __stop__bpf_raw_tp = .;
239 #ifdef CONFIG_SERIAL_EARLYCON
240 #define EARLYCON_TABLE() . = ALIGN(8); \
241 __earlycon_table = .; \
242 KEEP(*(__earlycon_table)) \
243 __earlycon_table_end = .;
245 #define EARLYCON_TABLE()
248 #ifdef CONFIG_SECURITY
249 #define LSM_TABLE() . = ALIGN(8); \
250 __start_lsm_info = .; \
251 KEEP(*(.lsm_info.init)) \
253 #define EARLY_LSM_TABLE() . = ALIGN(8); \
254 __start_early_lsm_info = .; \
255 KEEP(*(.early_lsm_info.init)) \
256 __end_early_lsm_info = .;
259 #define EARLY_LSM_TABLE()
262 #define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name)
263 #define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name)
264 #define OF_TABLE(cfg, name) __OF_TABLE(IS_ENABLED(cfg), name)
265 #define _OF_TABLE_0(name)
266 #define _OF_TABLE_1(name) \
268 __##name##_of_table = .; \
269 KEEP(*(__##name##_of_table)) \
270 KEEP(*(__##name##_of_table_end))
272 #define TIMER_OF_TABLES() OF_TABLE(CONFIG_TIMER_OF, timer)
273 #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
274 #define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk)
275 #define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
276 #define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method)
277 #define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
280 #define ACPI_PROBE_TABLE(name) \
282 __##name##_acpi_probe_table = .; \
283 KEEP(*(__##name##_acpi_probe_table)) \
284 __##name##_acpi_probe_table_end = .;
286 #define ACPI_PROBE_TABLE(name)
289 #ifdef CONFIG_THERMAL
290 #define THERMAL_TABLE(name) \
292 __##name##_thermal_table = .; \
293 KEEP(*(__##name##_thermal_table)) \
294 __##name##_thermal_table_end = .;
296 #define THERMAL_TABLE(name)
299 #define KERNEL_DTB() \
302 KEEP(*(.dtb.init.rodata)) \
312 *(.data..shared_aligned) /* percpu related */ \
313 MEM_KEEP(init.data*) \
314 MEM_KEEP(exit.data*) \
321 /* implement dynamic printk debug */ \
323 __start___verbose = .; \
325 __stop___verbose = .; \
333 * Data section helpers
335 #define NOSAVE_DATA \
336 . = ALIGN(PAGE_SIZE); \
337 __nosave_begin = .; \
339 . = ALIGN(PAGE_SIZE); \
342 #define PAGE_ALIGNED_DATA(page_align) \
343 . = ALIGN(page_align); \
344 *(.data..page_aligned)
346 #define READ_MOSTLY_DATA(align) \
348 *(.data..read_mostly) \
351 #define CACHELINE_ALIGNED_DATA(align) \
353 *(.data..cacheline_aligned)
355 #define INIT_TASK_DATA(align) \
357 __start_init_task = .; \
358 init_thread_union = .; \
360 KEEP(*(.data..init_task)) \
361 KEEP(*(.data..init_thread_info)) \
362 . = __start_init_task + THREAD_SIZE; \
365 #define JUMP_TABLE_DATA \
367 __start___jump_table = .; \
368 KEEP(*(__jump_table)) \
369 __stop___jump_table = .;
372 * Allow architectures to handle ro_after_init data on their
373 * own by defining an empty RO_AFTER_INIT_DATA.
375 #ifndef RO_AFTER_INIT_DATA
376 #define RO_AFTER_INIT_DATA \
377 __start_ro_after_init = .; \
378 *(.data..ro_after_init) \
380 __end_ro_after_init = .;
386 #define RO_DATA(align) \
387 . = ALIGN((align)); \
388 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
389 __start_rodata = .; \
390 *(.rodata) *(.rodata.*) \
391 RO_AFTER_INIT_DATA /* Read only after init */ \
393 __start___tracepoints_ptrs = .; \
394 KEEP(*(__tracepoints_ptrs)) /* Tracepoints: pointer array */ \
395 __stop___tracepoints_ptrs = .; \
396 *(__tracepoints_strings)/* Tracepoints: strings */ \
399 .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
404 .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
405 __start_pci_fixups_early = .; \
406 KEEP(*(.pci_fixup_early)) \
407 __end_pci_fixups_early = .; \
408 __start_pci_fixups_header = .; \
409 KEEP(*(.pci_fixup_header)) \
410 __end_pci_fixups_header = .; \
411 __start_pci_fixups_final = .; \
412 KEEP(*(.pci_fixup_final)) \
413 __end_pci_fixups_final = .; \
414 __start_pci_fixups_enable = .; \
415 KEEP(*(.pci_fixup_enable)) \
416 __end_pci_fixups_enable = .; \
417 __start_pci_fixups_resume = .; \
418 KEEP(*(.pci_fixup_resume)) \
419 __end_pci_fixups_resume = .; \
420 __start_pci_fixups_resume_early = .; \
421 KEEP(*(.pci_fixup_resume_early)) \
422 __end_pci_fixups_resume_early = .; \
423 __start_pci_fixups_suspend = .; \
424 KEEP(*(.pci_fixup_suspend)) \
425 __end_pci_fixups_suspend = .; \
426 __start_pci_fixups_suspend_late = .; \
427 KEEP(*(.pci_fixup_suspend_late)) \
428 __end_pci_fixups_suspend_late = .; \
431 /* Built-in firmware blobs */ \
432 .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
433 __start_builtin_fw = .; \
434 KEEP(*(.builtin_fw)) \
435 __end_builtin_fw = .; \
440 /* Kernel symbol table: Normal symbols */ \
441 __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
442 __start___ksymtab = .; \
443 KEEP(*(SORT(___ksymtab+*))) \
444 __stop___ksymtab = .; \
447 /* Kernel symbol table: GPL-only symbols */ \
448 __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
449 __start___ksymtab_gpl = .; \
450 KEEP(*(SORT(___ksymtab_gpl+*))) \
451 __stop___ksymtab_gpl = .; \
454 /* Kernel symbol table: Normal unused symbols */ \
455 __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
456 __start___ksymtab_unused = .; \
457 KEEP(*(SORT(___ksymtab_unused+*))) \
458 __stop___ksymtab_unused = .; \
461 /* Kernel symbol table: GPL-only unused symbols */ \
462 __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
463 __start___ksymtab_unused_gpl = .; \
464 KEEP(*(SORT(___ksymtab_unused_gpl+*))) \
465 __stop___ksymtab_unused_gpl = .; \
468 /* Kernel symbol table: GPL-future-only symbols */ \
469 __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
470 __start___ksymtab_gpl_future = .; \
471 KEEP(*(SORT(___ksymtab_gpl_future+*))) \
472 __stop___ksymtab_gpl_future = .; \
475 /* Kernel symbol table: Normal symbols */ \
476 __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
477 __start___kcrctab = .; \
478 KEEP(*(SORT(___kcrctab+*))) \
479 __stop___kcrctab = .; \
482 /* Kernel symbol table: GPL-only symbols */ \
483 __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
484 __start___kcrctab_gpl = .; \
485 KEEP(*(SORT(___kcrctab_gpl+*))) \
486 __stop___kcrctab_gpl = .; \
489 /* Kernel symbol table: Normal unused symbols */ \
490 __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
491 __start___kcrctab_unused = .; \
492 KEEP(*(SORT(___kcrctab_unused+*))) \
493 __stop___kcrctab_unused = .; \
496 /* Kernel symbol table: GPL-only unused symbols */ \
497 __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
498 __start___kcrctab_unused_gpl = .; \
499 KEEP(*(SORT(___kcrctab_unused_gpl+*))) \
500 __stop___kcrctab_unused_gpl = .; \
503 /* Kernel symbol table: GPL-future-only symbols */ \
504 __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
505 __start___kcrctab_gpl_future = .; \
506 KEEP(*(SORT(___kcrctab_gpl_future+*))) \
507 __stop___kcrctab_gpl_future = .; \
510 /* Kernel symbol table: strings */ \
511 __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
512 *(__ksymtab_strings) \
515 /* __*init sections */ \
516 __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
518 MEM_KEEP(init.rodata) \
519 MEM_KEEP(exit.rodata) \
522 /* Built-in module parameters. */ \
523 __param : AT(ADDR(__param) - LOAD_OFFSET) { \
524 __start___param = .; \
526 __stop___param = .; \
529 /* Built-in module versions. */ \
530 __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \
531 __start___modver = .; \
533 __stop___modver = .; \
540 . = ALIGN((align)); \
544 * .text section. Map to function alignment to avoid address changes
545 * during second ld run in second ld pass when generating System.map
547 * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead
548 * code elimination is enabled, so these sections should be converted
553 *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \
556 MEM_KEEP(init.text*) \
557 MEM_KEEP(exit.text*) \
560 /* sched.text is aling to function alignment to secure we have same
561 * address even at second ld pass when generating System.map */
564 __sched_text_start = .; \
566 __sched_text_end = .;
568 /* spinlock.text is aling to function alignment to secure we have same
569 * address even at second ld pass when generating System.map */
572 __lock_text_start = .; \
576 #define CPUIDLE_TEXT \
578 __cpuidle_text_start = .; \
580 __cpuidle_text_end = .;
582 #define KPROBES_TEXT \
584 __kprobes_text_start = .; \
586 __kprobes_text_end = .;
590 __entry_text_start = .; \
592 __entry_text_end = .;
594 #define IRQENTRY_TEXT \
596 __irqentry_text_start = .; \
598 __irqentry_text_end = .;
600 #define SOFTIRQENTRY_TEXT \
602 __softirqentry_text_start = .; \
603 *(.softirqentry.text) \
604 __softirqentry_text_end = .;
606 /* Section used for early init (in .S files) */
607 #define HEAD_TEXT KEEP(*(.head.text))
609 #define HEAD_TEXT_SECTION \
610 .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
617 #define EXCEPTION_TABLE(align) \
619 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
620 __start___ex_table = .; \
621 KEEP(*(__ex_table)) \
622 __stop___ex_table = .; \
628 #ifdef CONFIG_DEBUG_INFO_BTF
630 .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { \
642 #define INIT_TASK_DATA_SECTION(align) \
644 .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
645 INIT_TASK_DATA(align) \
648 #ifdef CONFIG_CONSTRUCTORS
649 #define KERNEL_CTORS() . = ALIGN(8); \
652 KEEP(*(SORT(.init_array.*))) \
653 KEEP(*(.init_array)) \
656 #define KERNEL_CTORS()
659 /* init and exit section handling */
661 KEEP(*(SORT(___kentry+*))) \
662 *(.init.data init.data.*) \
663 MEM_DISCARD(init.data*) \
666 *(.init.rodata .init.rodata.*) \
670 ERROR_INJECT_WHITELIST() \
671 MEM_DISCARD(init.rodata) \
673 RESERVEDMEM_OF_TABLES() \
675 CPU_METHOD_OF_TABLES() \
676 CPUIDLE_METHOD_OF_TABLES() \
678 IRQCHIP_OF_MATCH_TABLE() \
679 ACPI_PROBE_TABLE(irqchip) \
680 ACPI_PROBE_TABLE(timer) \
681 THERMAL_TABLE(governor) \
687 *(.init.text .init.text.*) \
689 MEM_DISCARD(init.text*)
692 *(.exit.data .exit.data.*) \
693 *(.fini_array .fini_array.*) \
695 MEM_DISCARD(exit.data*) \
696 MEM_DISCARD(exit.rodata*)
701 MEM_DISCARD(exit.text)
707 * bss (Block Started by Symbol) - uninitialized data
708 * zeroed during startup
710 #define SBSS(sbss_align) \
711 . = ALIGN(sbss_align); \
712 .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
719 * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
720 * sections to the front of bss.
722 #ifndef BSS_FIRST_SECTIONS
723 #define BSS_FIRST_SECTIONS
726 #define BSS(bss_align) \
727 . = ALIGN(bss_align); \
728 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
730 *(.bss..page_aligned) \
737 * DWARF debug sections.
738 * Symbols in the DWARF debugging sections are relative to
739 * the beginning of the section so we begin them at 0.
741 #define DWARF_DEBUG \
743 .debug 0 : { *(.debug) } \
744 .line 0 : { *(.line) } \
745 /* GNU DWARF 1 extensions */ \
746 .debug_srcinfo 0 : { *(.debug_srcinfo) } \
747 .debug_sfnames 0 : { *(.debug_sfnames) } \
748 /* DWARF 1.1 and DWARF 2 */ \
749 .debug_aranges 0 : { *(.debug_aranges) } \
750 .debug_pubnames 0 : { *(.debug_pubnames) } \
752 .debug_info 0 : { *(.debug_info \
753 .gnu.linkonce.wi.*) } \
754 .debug_abbrev 0 : { *(.debug_abbrev) } \
755 .debug_line 0 : { *(.debug_line) } \
756 .debug_frame 0 : { *(.debug_frame) } \
757 .debug_str 0 : { *(.debug_str) } \
758 .debug_loc 0 : { *(.debug_loc) } \
759 .debug_macinfo 0 : { *(.debug_macinfo) } \
760 .debug_pubtypes 0 : { *(.debug_pubtypes) } \
762 .debug_ranges 0 : { *(.debug_ranges) } \
763 /* SGI/MIPS DWARF 2 extensions */ \
764 .debug_weaknames 0 : { *(.debug_weaknames) } \
765 .debug_funcnames 0 : { *(.debug_funcnames) } \
766 .debug_typenames 0 : { *(.debug_typenames) } \
767 .debug_varnames 0 : { *(.debug_varnames) } \
768 /* GNU DWARF 2 extensions */ \
769 .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } \
770 .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } \
772 .debug_types 0 : { *(.debug_types) } \
774 .debug_macro 0 : { *(.debug_macro) } \
775 .debug_addr 0 : { *(.debug_addr) }
777 /* Stabs debugging sections. */
778 #define STABS_DEBUG \
779 .stab 0 : { *(.stab) } \
780 .stabstr 0 : { *(.stabstr) } \
781 .stab.excl 0 : { *(.stab.excl) } \
782 .stab.exclstr 0 : { *(.stab.exclstr) } \
783 .stab.index 0 : { *(.stab.index) } \
784 .stab.indexstr 0 : { *(.stab.indexstr) } \
785 .comment 0 : { *(.comment) }
787 #ifdef CONFIG_GENERIC_BUG
790 __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
791 __start___bug_table = .; \
792 KEEP(*(__bug_table)) \
793 __stop___bug_table = .; \
799 #ifdef CONFIG_UNWINDER_ORC
800 #define ORC_UNWIND_TABLE \
802 .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \
803 __start_orc_unwind_ip = .; \
804 KEEP(*(.orc_unwind_ip)) \
805 __stop_orc_unwind_ip = .; \
808 .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \
809 __start_orc_unwind = .; \
810 KEEP(*(.orc_unwind)) \
811 __stop_orc_unwind = .; \
814 .orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \
816 . += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) / \
817 LOOKUP_BLOCK_SIZE) + 1) * 4; \
818 orc_lookup_end = .; \
821 #define ORC_UNWIND_TABLE
824 #ifdef CONFIG_PM_TRACE
827 .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
828 __tracedata_start = .; \
829 KEEP(*(.tracedata)) \
830 __tracedata_end = .; \
837 .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
842 NOTES_HEADERS_RESTORE
844 #define INIT_SETUP(initsetup_align) \
845 . = ALIGN(initsetup_align); \
847 KEEP(*(.init.setup)) \
850 #define INIT_CALLS_LEVEL(level) \
851 __initcall##level##_start = .; \
852 KEEP(*(.initcall##level##.init)) \
853 KEEP(*(.initcall##level##s.init)) \
856 __initcall_start = .; \
857 KEEP(*(.initcallearly.init)) \
858 INIT_CALLS_LEVEL(0) \
859 INIT_CALLS_LEVEL(1) \
860 INIT_CALLS_LEVEL(2) \
861 INIT_CALLS_LEVEL(3) \
862 INIT_CALLS_LEVEL(4) \
863 INIT_CALLS_LEVEL(5) \
864 INIT_CALLS_LEVEL(rootfs) \
865 INIT_CALLS_LEVEL(6) \
866 INIT_CALLS_LEVEL(7) \
869 #define CON_INITCALL \
870 __con_initcall_start = .; \
871 KEEP(*(.con_initcall.init)) \
872 __con_initcall_end = .;
874 #ifdef CONFIG_BLK_DEV_INITRD
875 #define INIT_RAM_FS \
877 __initramfs_start = .; \
878 KEEP(*(.init.ramfs)) \
880 KEEP(*(.init.ramfs.info))
886 * Memory encryption operates on a page basis. Since we need to clear
887 * the memory encryption mask for this section, it needs to be aligned
888 * on a page boundary and be a page-size multiple in length.
890 * Note: We use a separate section so that only this section gets
891 * decrypted to avoid exposing more than we wish.
893 #ifdef CONFIG_AMD_MEM_ENCRYPT
894 #define PERCPU_DECRYPTED_SECTION \
895 . = ALIGN(PAGE_SIZE); \
896 *(.data..percpu..decrypted) \
897 . = ALIGN(PAGE_SIZE);
899 #define PERCPU_DECRYPTED_SECTION
904 * Default discarded sections.
906 * Some archs want to discard exit text/data at runtime rather than
907 * link time due to cross-section references such as alt instructions,
908 * bug table, eh_frame, etc. DISCARDS must be the last of output
909 * section definitions so that such archs put those in earlier section
912 #ifdef RUNTIME_DISCARD_EXIT
913 #define EXIT_DISCARDS
915 #define EXIT_DISCARDS \
930 * PERCPU_INPUT - the percpu input sections
931 * @cacheline: cacheline size
933 * The core percpu section names and core symbols which do not rely
934 * directly upon load addresses.
936 * @cacheline is used to align subsections to avoid false cacheline
937 * sharing between subsections for different purposes.
939 #define PERCPU_INPUT(cacheline) \
940 __per_cpu_start = .; \
941 *(.data..percpu..first) \
942 . = ALIGN(PAGE_SIZE); \
943 *(.data..percpu..page_aligned) \
944 . = ALIGN(cacheline); \
945 *(.data..percpu..read_mostly) \
946 . = ALIGN(cacheline); \
948 *(.data..percpu..shared_aligned) \
949 PERCPU_DECRYPTED_SECTION \
953 * PERCPU_VADDR - define output section for percpu area
954 * @cacheline: cacheline size
955 * @vaddr: explicit base address (optional)
956 * @phdr: destination PHDR (optional)
958 * Macro which expands to output section for percpu area.
960 * @cacheline is used to align subsections to avoid false cacheline
961 * sharing between subsections for different purposes.
963 * If @vaddr is not blank, it specifies explicit base address and all
964 * percpu symbols will be offset from the given address. If blank,
965 * @vaddr always equals @laddr + LOAD_OFFSET.
967 * @phdr defines the output PHDR to use if not blank. Be warned that
968 * output PHDR is sticky. If @phdr is specified, the next output
969 * section in the linker script will go there too. @phdr should have
972 * Note that this macros defines __per_cpu_load as an absolute symbol.
973 * If there is no need to put the percpu section at a predetermined
974 * address, use PERCPU_SECTION.
976 #define PERCPU_VADDR(cacheline, vaddr, phdr) \
977 __per_cpu_load = .; \
978 .data..percpu vaddr : AT(__per_cpu_load - LOAD_OFFSET) { \
979 PERCPU_INPUT(cacheline) \
981 . = __per_cpu_load + SIZEOF(.data..percpu);
984 * PERCPU_SECTION - define output section for percpu area, simple version
985 * @cacheline: cacheline size
987 * Align to PAGE_SIZE and outputs output section for percpu area. This
988 * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
989 * __per_cpu_start will be identical.
991 * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
992 * except that __per_cpu_load is defined as a relative symbol against
993 * .data..percpu which is required for relocatable x86_32 configuration.
995 #define PERCPU_SECTION(cacheline) \
996 . = ALIGN(PAGE_SIZE); \
997 .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
998 __per_cpu_load = .; \
999 PERCPU_INPUT(cacheline) \
1004 * Definition of the high level *_SECTION macros
1005 * They will fit only a subset of the architectures
1011 * All sections are combined in a single .data section.
1012 * The sections following CONSTRUCTORS are arranged so their
1013 * typical alignment matches.
1014 * A cacheline is typical/always less than a PAGE_SIZE so
1015 * the sections that has this restriction (or similar)
1016 * is located before the ones requiring PAGE_SIZE alignment.
1017 * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
1018 * matches the requirement of PAGE_ALIGNED_DATA.
1020 * use 0 as page_align if page_aligned data is not used */
1021 #define RW_DATA(cacheline, pagealigned, inittask) \
1022 . = ALIGN(PAGE_SIZE); \
1023 .data : AT(ADDR(.data) - LOAD_OFFSET) { \
1024 INIT_TASK_DATA(inittask) \
1026 PAGE_ALIGNED_DATA(pagealigned) \
1027 CACHELINE_ALIGNED_DATA(cacheline) \
1028 READ_MOSTLY_DATA(cacheline) \
1034 #define INIT_TEXT_SECTION(inittext_align) \
1035 . = ALIGN(inittext_align); \
1036 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
1042 #define INIT_DATA_SECTION(initsetup_align) \
1043 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
1045 INIT_SETUP(initsetup_align) \
1051 #define BSS_SECTION(sbss_align, bss_align, stop_align) \
1052 . = ALIGN(sbss_align); \
1056 . = ALIGN(stop_align); \