xref: /linux/include/asm-generic/vmlinux.lds.h (revision 2a52ca7c98960aafb0eca9ef96b2d0c932171357)
1 /*
2  * Helper macros to support writing architecture specific
3  * linker scripts.
4  *
5  * A minimal linker scripts has following content:
6  * [This is a sample, architectures may have special requirements]
7  *
8  * OUTPUT_FORMAT(...)
9  * OUTPUT_ARCH(...)
10  * ENTRY(...)
11  * SECTIONS
12  * {
13  *	. = START;
14  *	__init_begin = .;
15  *	HEAD_TEXT_SECTION
16  *	INIT_TEXT_SECTION(PAGE_SIZE)
17  *	INIT_DATA_SECTION(...)
18  *	PERCPU_SECTION(CACHELINE_SIZE)
19  *	__init_end = .;
20  *
21  *	_stext = .;
22  *	TEXT_SECTION = 0
23  *	_etext = .;
24  *
25  *      _sdata = .;
26  *	RO_DATA(PAGE_SIZE)
27  *	RW_DATA(...)
28  *	_edata = .;
29  *
30  *	EXCEPTION_TABLE(...)
31  *
32  *	BSS_SECTION(0, 0, 0)
33  *	_end = .;
34  *
35  *	STABS_DEBUG
36  *	DWARF_DEBUG
37  *	ELF_DETAILS
38  *
39  *	DISCARDS		// must be the last
40  * }
41  *
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
47  *
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
51  */
52 
53 #include <asm-generic/codetag.lds.h>
54 
55 #ifndef LOAD_OFFSET
56 #define LOAD_OFFSET 0
57 #endif
58 
59 /*
60  * Only some architectures want to have the .notes segment visible in
61  * a separate PT_NOTE ELF Program Header. When this happens, it needs
62  * to be visible in both the kernel text's PT_LOAD and the PT_NOTE
63  * Program Headers. In this case, though, the PT_LOAD needs to be made
64  * the default again so that all the following sections don't also end
65  * up in the PT_NOTE Program Header.
66  */
67 #ifdef EMITS_PT_NOTE
68 #define NOTES_HEADERS		:text :note
69 #define NOTES_HEADERS_RESTORE	__restore_ph : { *(.__restore_ph) } :text
70 #else
71 #define NOTES_HEADERS
72 #define NOTES_HEADERS_RESTORE
73 #endif
74 
75 /*
76  * Some architectures have non-executable read-only exception tables.
77  * They can be added to the RO_DATA segment by specifying their desired
78  * alignment.
79  */
80 #ifdef RO_EXCEPTION_TABLE_ALIGN
81 #define RO_EXCEPTION_TABLE	EXCEPTION_TABLE(RO_EXCEPTION_TABLE_ALIGN)
82 #else
83 #define RO_EXCEPTION_TABLE
84 #endif
85 
86 /* Align . function alignment. */
87 #define ALIGN_FUNCTION()  . = ALIGN(CONFIG_FUNCTION_ALIGNMENT)
88 
89 /*
90  * LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections, which
91  * generates .data.identifier sections, which need to be pulled in with
92  * .data. We don't want to pull in .data..other sections, which Linux
93  * has defined. Same for text and bss.
94  *
95  * With LTO_CLANG, the linker also splits sections by default, so we need
96  * these macros to combine the sections during the final link.
97  *
98  * RODATA_MAIN is not used because existing code already defines .rodata.x
99  * sections to be brought in with rodata.
100  */
101 #if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG)
102 #define TEXT_MAIN .text .text.[0-9a-zA-Z_]*
103 #define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$L*
104 #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]*
105 #define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* .rodata..L*
106 #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* .bss..compoundliteral*
107 #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]*
108 #else
109 #define TEXT_MAIN .text
110 #define DATA_MAIN .data
111 #define SDATA_MAIN .sdata
112 #define RODATA_MAIN .rodata
113 #define BSS_MAIN .bss
114 #define SBSS_MAIN .sbss
115 #endif
116 
117 /*
118  * GCC 4.5 and later have a 32 bytes section alignment for structures.
119  * Except GCC 4.9, that feels the need to align on 64 bytes.
120  */
121 #define STRUCT_ALIGNMENT 32
122 #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
123 
124 /*
125  * The order of the sched class addresses are important, as they are
126  * used to determine the order of the priority of each sched class in
127  * relation to each other.
128  */
129 #define SCHED_DATA				\
130 	STRUCT_ALIGN();				\
131 	__sched_class_highest = .;		\
132 	*(__stop_sched_class)			\
133 	*(__dl_sched_class)			\
134 	*(__rt_sched_class)			\
135 	*(__fair_sched_class)			\
136 	*(__ext_sched_class)			\
137 	*(__idle_sched_class)			\
138 	__sched_class_lowest = .;
139 
140 /* The actual configuration determine if the init/exit sections
141  * are handled as text/data or they can be discarded (which
142  * often happens at runtime)
143  */
144 
145 #if defined(CONFIG_MEMORY_HOTPLUG)
146 #define MEM_KEEP(sec)    *(.mem##sec)
147 #define MEM_DISCARD(sec)
148 #else
149 #define MEM_KEEP(sec)
150 #define MEM_DISCARD(sec) *(.mem##sec)
151 #endif
152 
153 #ifndef CONFIG_HAVE_DYNAMIC_FTRACE_NO_PATCHABLE
154 #define KEEP_PATCHABLE		KEEP(*(__patchable_function_entries))
155 #define PATCHABLE_DISCARDS
156 #else
157 #define KEEP_PATCHABLE
158 #define PATCHABLE_DISCARDS	*(__patchable_function_entries)
159 #endif
160 
161 #ifndef CONFIG_ARCH_SUPPORTS_CFI_CLANG
162 /*
163  * Simply points to ftrace_stub, but with the proper protocol.
164  * Defined by the linker script in linux/vmlinux.lds.h
165  */
166 #define	FTRACE_STUB_HACK	ftrace_stub_graph = ftrace_stub;
167 #else
168 #define FTRACE_STUB_HACK
169 #endif
170 
171 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
172 /*
173  * The ftrace call sites are logged to a section whose name depends on the
174  * compiler option used. A given kernel image will only use one, AKA
175  * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
176  * dependencies for FTRACE_CALLSITE_SECTION's definition.
177  *
178  * ftrace_ops_list_func will be defined as arch_ftrace_ops_list_func
179  * as some archs will have a different prototype for that function
180  * but ftrace_ops_list_func() will have a single prototype.
181  */
182 #define MCOUNT_REC()	. = ALIGN(8);				\
183 			__start_mcount_loc = .;			\
184 			KEEP(*(__mcount_loc))			\
185 			KEEP_PATCHABLE				\
186 			__stop_mcount_loc = .;			\
187 			FTRACE_STUB_HACK			\
188 			ftrace_ops_list_func = arch_ftrace_ops_list_func;
189 #else
190 # ifdef CONFIG_FUNCTION_TRACER
191 #  define MCOUNT_REC()	FTRACE_STUB_HACK			\
192 			ftrace_ops_list_func = arch_ftrace_ops_list_func;
193 # else
194 #  define MCOUNT_REC()
195 # endif
196 #endif
197 
198 #define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_)	\
199 	_BEGIN_##_label_ = .;						\
200 	KEEP(*(_sec_))							\
201 	_END_##_label_ = .;
202 
203 #define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_)	\
204 	_label_##_BEGIN_ = .;						\
205 	KEEP(*(_sec_))							\
206 	_label_##_END_ = .;
207 
208 #define BOUNDED_SECTION_BY(_sec_, _label_)				\
209 	BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop)
210 
211 #define BOUNDED_SECTION(_sec)	 BOUNDED_SECTION_BY(_sec, _sec)
212 
213 #define HEADERED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \
214 	_HDR_##_label_	= .;						\
215 	KEEP(*(.gnu.linkonce.##_sec_))					\
216 	BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_)
217 
218 #define HEADERED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_, _HDR_) \
219 	_label_##_HDR_ = .;						\
220 	KEEP(*(.gnu.linkonce.##_sec_))					\
221 	BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_)
222 
223 #define HEADERED_SECTION_BY(_sec_, _label_)				\
224 	HEADERED_SECTION_PRE_LABEL(_sec_, _label_, __start, __stop)
225 
226 #define HEADERED_SECTION(_sec)	 HEADERED_SECTION_BY(_sec, _sec)
227 
228 #ifdef CONFIG_TRACE_BRANCH_PROFILING
229 #define LIKELY_PROFILE()						\
230 	BOUNDED_SECTION_BY(_ftrace_annotated_branch, _annotated_branch_profile)
231 #else
232 #define LIKELY_PROFILE()
233 #endif
234 
235 #ifdef CONFIG_PROFILE_ALL_BRANCHES
236 #define BRANCH_PROFILE()					\
237 	BOUNDED_SECTION_BY(_ftrace_branch, _branch_profile)
238 #else
239 #define BRANCH_PROFILE()
240 #endif
241 
242 #ifdef CONFIG_KPROBES
243 #define KPROBE_BLACKLIST()				\
244 	. = ALIGN(8);					\
245 	BOUNDED_SECTION(_kprobe_blacklist)
246 #else
247 #define KPROBE_BLACKLIST()
248 #endif
249 
250 #ifdef CONFIG_FUNCTION_ERROR_INJECTION
251 #define ERROR_INJECT_WHITELIST()			\
252 	STRUCT_ALIGN();					\
253 	BOUNDED_SECTION(_error_injection_whitelist)
254 #else
255 #define ERROR_INJECT_WHITELIST()
256 #endif
257 
258 #ifdef CONFIG_EVENT_TRACING
259 #define FTRACE_EVENTS()							\
260 	. = ALIGN(8);							\
261 	BOUNDED_SECTION(_ftrace_events)					\
262 	BOUNDED_SECTION_BY(_ftrace_eval_map, _ftrace_eval_maps)
263 #else
264 #define FTRACE_EVENTS()
265 #endif
266 
267 #ifdef CONFIG_TRACING
268 #define TRACE_PRINTKS()		BOUNDED_SECTION_BY(__trace_printk_fmt, ___trace_bprintk_fmt)
269 #define TRACEPOINT_STR()	BOUNDED_SECTION_BY(__tracepoint_str, ___tracepoint_str)
270 #else
271 #define TRACE_PRINTKS()
272 #define TRACEPOINT_STR()
273 #endif
274 
275 #ifdef CONFIG_FTRACE_SYSCALLS
276 #define TRACE_SYSCALLS()			\
277 	. = ALIGN(8);				\
278 	BOUNDED_SECTION_BY(__syscalls_metadata, _syscalls_metadata)
279 #else
280 #define TRACE_SYSCALLS()
281 #endif
282 
283 #ifdef CONFIG_BPF_EVENTS
284 #define BPF_RAW_TP() STRUCT_ALIGN();				\
285 	BOUNDED_SECTION_BY(__bpf_raw_tp_map, __bpf_raw_tp)
286 #else
287 #define BPF_RAW_TP()
288 #endif
289 
290 #ifdef CONFIG_SERIAL_EARLYCON
291 #define EARLYCON_TABLE()						\
292 	. = ALIGN(8);							\
293 	BOUNDED_SECTION_POST_LABEL(__earlycon_table, __earlycon_table, , _end)
294 #else
295 #define EARLYCON_TABLE()
296 #endif
297 
298 #ifdef CONFIG_SECURITY
299 #define LSM_TABLE()					\
300 	. = ALIGN(8);					\
301 	BOUNDED_SECTION_PRE_LABEL(.lsm_info.init, _lsm_info, __start, __end)
302 
303 #define EARLY_LSM_TABLE()						\
304 	. = ALIGN(8);							\
305 	BOUNDED_SECTION_PRE_LABEL(.early_lsm_info.init, _early_lsm_info, __start, __end)
306 #else
307 #define LSM_TABLE()
308 #define EARLY_LSM_TABLE()
309 #endif
310 
311 #define ___OF_TABLE(cfg, name)	_OF_TABLE_##cfg(name)
312 #define __OF_TABLE(cfg, name)	___OF_TABLE(cfg, name)
313 #define OF_TABLE(cfg, name)	__OF_TABLE(IS_ENABLED(cfg), name)
314 #define _OF_TABLE_0(name)
315 #define _OF_TABLE_1(name)						\
316 	. = ALIGN(8);							\
317 	__##name##_of_table = .;					\
318 	KEEP(*(__##name##_of_table))					\
319 	KEEP(*(__##name##_of_table_end))
320 
321 #define TIMER_OF_TABLES()	OF_TABLE(CONFIG_TIMER_OF, timer)
322 #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
323 #define CLK_OF_TABLES()		OF_TABLE(CONFIG_COMMON_CLK, clk)
324 #define RESERVEDMEM_OF_TABLES()	OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem)
325 #define CPU_METHOD_OF_TABLES()	OF_TABLE(CONFIG_SMP, cpu_method)
326 #define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method)
327 
328 #ifdef CONFIG_ACPI
329 #define ACPI_PROBE_TABLE(name)						\
330 	. = ALIGN(8);							\
331 	BOUNDED_SECTION_POST_LABEL(__##name##_acpi_probe_table,		\
332 				   __##name##_acpi_probe_table,, _end)
333 #else
334 #define ACPI_PROBE_TABLE(name)
335 #endif
336 
337 #ifdef CONFIG_THERMAL
338 #define THERMAL_TABLE(name)						\
339 	. = ALIGN(8);							\
340 	BOUNDED_SECTION_POST_LABEL(__##name##_thermal_table,		\
341 				   __##name##_thermal_table,, _end)
342 #else
343 #define THERMAL_TABLE(name)
344 #endif
345 
346 #define KERNEL_DTB()							\
347 	STRUCT_ALIGN();							\
348 	__dtb_start = .;						\
349 	KEEP(*(.dtb.init.rodata))					\
350 	__dtb_end = .;
351 
352 /*
353  * .data section
354  */
355 #define DATA_DATA							\
356 	*(.xiptext)							\
357 	*(DATA_MAIN)							\
358 	*(.data..decrypted)						\
359 	*(.ref.data)							\
360 	*(.data..shared_aligned) /* percpu related */			\
361 	MEM_KEEP(init.data*)						\
362 	*(.data.unlikely)						\
363 	__start_once = .;						\
364 	*(.data.once)							\
365 	__end_once = .;							\
366 	STRUCT_ALIGN();							\
367 	*(__tracepoints)						\
368 	/* implement dynamic printk debug */				\
369 	. = ALIGN(8);							\
370 	BOUNDED_SECTION_BY(__dyndbg_classes, ___dyndbg_classes)		\
371 	BOUNDED_SECTION_BY(__dyndbg, ___dyndbg)				\
372 	CODETAG_SECTIONS()						\
373 	LIKELY_PROFILE()		       				\
374 	BRANCH_PROFILE()						\
375 	TRACE_PRINTKS()							\
376 	BPF_RAW_TP()							\
377 	TRACEPOINT_STR()						\
378 	KUNIT_TABLE()
379 
380 /*
381  * Data section helpers
382  */
383 #define NOSAVE_DATA							\
384 	. = ALIGN(PAGE_SIZE);						\
385 	__nosave_begin = .;						\
386 	*(.data..nosave)						\
387 	. = ALIGN(PAGE_SIZE);						\
388 	__nosave_end = .;
389 
390 #define PAGE_ALIGNED_DATA(page_align)					\
391 	. = ALIGN(page_align);						\
392 	*(.data..page_aligned)						\
393 	. = ALIGN(page_align);
394 
395 #define READ_MOSTLY_DATA(align)						\
396 	. = ALIGN(align);						\
397 	*(.data..read_mostly)						\
398 	. = ALIGN(align);
399 
400 #define CACHELINE_ALIGNED_DATA(align)					\
401 	. = ALIGN(align);						\
402 	*(.data..cacheline_aligned)
403 
404 #define INIT_TASK_DATA(align)						\
405 	. = ALIGN(align);						\
406 	__start_init_stack = .;						\
407 	init_thread_union = .;						\
408 	init_stack = .;							\
409 	KEEP(*(.data..init_task))					\
410 	KEEP(*(.data..init_thread_info))				\
411 	. = __start_init_stack + THREAD_SIZE;				\
412 	__end_init_stack = .;
413 
414 #define JUMP_TABLE_DATA							\
415 	. = ALIGN(8);							\
416 	BOUNDED_SECTION_BY(__jump_table, ___jump_table)
417 
418 #ifdef CONFIG_HAVE_STATIC_CALL_INLINE
419 #define STATIC_CALL_DATA						\
420 	. = ALIGN(8);							\
421 	BOUNDED_SECTION_BY(.static_call_sites, _static_call_sites)	\
422 	BOUNDED_SECTION_BY(.static_call_tramp_key, _static_call_tramp_key)
423 #else
424 #define STATIC_CALL_DATA
425 #endif
426 
427 /*
428  * Allow architectures to handle ro_after_init data on their
429  * own by defining an empty RO_AFTER_INIT_DATA.
430  */
431 #ifndef RO_AFTER_INIT_DATA
432 #define RO_AFTER_INIT_DATA						\
433 	. = ALIGN(8);							\
434 	__start_ro_after_init = .;					\
435 	*(.data..ro_after_init)						\
436 	JUMP_TABLE_DATA							\
437 	STATIC_CALL_DATA						\
438 	__end_ro_after_init = .;
439 #endif
440 
441 /*
442  * .kcfi_traps contains a list KCFI trap locations.
443  */
444 #ifndef KCFI_TRAPS
445 #ifdef CONFIG_ARCH_USES_CFI_TRAPS
446 #define KCFI_TRAPS							\
447 	__kcfi_traps : AT(ADDR(__kcfi_traps) - LOAD_OFFSET) {		\
448 		BOUNDED_SECTION_BY(.kcfi_traps, ___kcfi_traps)		\
449 	}
450 #else
451 #define KCFI_TRAPS
452 #endif
453 #endif
454 
455 /*
456  * Some symbol definitions will not exist yet during the first pass of the
457  * link, but are guaranteed to exist in the final link. Provide preliminary
458  * definitions that will be superseded in the final link to avoid having to
459  * rely on weak external linkage, which requires a GOT when used in position
460  * independent code.
461  */
462 #define PRELIMINARY_SYMBOL_DEFINITIONS					\
463 	PROVIDE(kallsyms_addresses = .);				\
464 	PROVIDE(kallsyms_offsets = .);					\
465 	PROVIDE(kallsyms_names = .);					\
466 	PROVIDE(kallsyms_num_syms = .);					\
467 	PROVIDE(kallsyms_relative_base = .);				\
468 	PROVIDE(kallsyms_token_table = .);				\
469 	PROVIDE(kallsyms_token_index = .);				\
470 	PROVIDE(kallsyms_markers = .);					\
471 	PROVIDE(kallsyms_seqs_of_names = .);
472 
473 /*
474  * Read only Data
475  */
476 #define RO_DATA(align)							\
477 	. = ALIGN((align));						\
478 	PRELIMINARY_SYMBOL_DEFINITIONS					\
479 	.rodata           : AT(ADDR(.rodata) - LOAD_OFFSET) {		\
480 		__start_rodata = .;					\
481 		*(.rodata) *(.rodata.*)					\
482 		SCHED_DATA						\
483 		RO_AFTER_INIT_DATA	/* Read only after init */	\
484 		. = ALIGN(8);						\
485 		BOUNDED_SECTION_BY(__tracepoints_ptrs, ___tracepoints_ptrs) \
486 		*(__tracepoints_strings)/* Tracepoints: strings */	\
487 	}								\
488 									\
489 	.rodata1          : AT(ADDR(.rodata1) - LOAD_OFFSET) {		\
490 		*(.rodata1)						\
491 	}								\
492 									\
493 	/* PCI quirks */						\
494 	.pci_fixup        : AT(ADDR(.pci_fixup) - LOAD_OFFSET) {	\
495 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_early,  _pci_fixups_early,  __start, __end) \
496 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_header, _pci_fixups_header, __start, __end) \
497 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_final,  _pci_fixups_final,  __start, __end) \
498 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_enable, _pci_fixups_enable, __start, __end) \
499 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_resume, _pci_fixups_resume, __start, __end) \
500 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_suspend, _pci_fixups_suspend, __start, __end) \
501 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_resume_early, _pci_fixups_resume_early, __start, __end) \
502 		BOUNDED_SECTION_PRE_LABEL(.pci_fixup_suspend_late, _pci_fixups_suspend_late, __start, __end) \
503 	}								\
504 									\
505 	FW_LOADER_BUILT_IN_DATA						\
506 	TRACEDATA							\
507 									\
508 	PRINTK_INDEX							\
509 									\
510 	/* Kernel symbol table: Normal symbols */			\
511 	__ksymtab         : AT(ADDR(__ksymtab) - LOAD_OFFSET) {		\
512 		__start___ksymtab = .;					\
513 		KEEP(*(SORT(___ksymtab+*)))				\
514 		__stop___ksymtab = .;					\
515 	}								\
516 									\
517 	/* Kernel symbol table: GPL-only symbols */			\
518 	__ksymtab_gpl     : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) {	\
519 		__start___ksymtab_gpl = .;				\
520 		KEEP(*(SORT(___ksymtab_gpl+*)))				\
521 		__stop___ksymtab_gpl = .;				\
522 	}								\
523 									\
524 	/* Kernel symbol table: Normal symbols */			\
525 	__kcrctab         : AT(ADDR(__kcrctab) - LOAD_OFFSET) {		\
526 		__start___kcrctab = .;					\
527 		KEEP(*(SORT(___kcrctab+*)))				\
528 		__stop___kcrctab = .;					\
529 	}								\
530 									\
531 	/* Kernel symbol table: GPL-only symbols */			\
532 	__kcrctab_gpl     : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) {	\
533 		__start___kcrctab_gpl = .;				\
534 		KEEP(*(SORT(___kcrctab_gpl+*)))				\
535 		__stop___kcrctab_gpl = .;				\
536 	}								\
537 									\
538 	/* Kernel symbol table: strings */				\
539         __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) {	\
540 		*(__ksymtab_strings)					\
541 	}								\
542 									\
543 	/* __*init sections */						\
544 	__init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) {		\
545 		*(.ref.rodata)						\
546 		MEM_KEEP(init.rodata)					\
547 	}								\
548 									\
549 	/* Built-in module parameters. */				\
550 	__param : AT(ADDR(__param) - LOAD_OFFSET) {			\
551 		BOUNDED_SECTION_BY(__param, ___param)			\
552 	}								\
553 									\
554 	/* Built-in module versions. */					\
555 	__modver : AT(ADDR(__modver) - LOAD_OFFSET) {			\
556 		BOUNDED_SECTION_BY(__modver, ___modver)			\
557 	}								\
558 									\
559 	KCFI_TRAPS							\
560 									\
561 	RO_EXCEPTION_TABLE						\
562 	NOTES								\
563 	BTF								\
564 									\
565 	. = ALIGN((align));						\
566 	__end_rodata = .;
567 
568 
569 /*
570  * Non-instrumentable text section
571  */
572 #define NOINSTR_TEXT							\
573 		ALIGN_FUNCTION();					\
574 		__noinstr_text_start = .;				\
575 		*(.noinstr.text)					\
576 		__cpuidle_text_start = .;				\
577 		*(.cpuidle.text)					\
578 		__cpuidle_text_end = .;					\
579 		__noinstr_text_end = .;
580 
581 /*
582  * .text section. Map to function alignment to avoid address changes
583  * during second ld run in second ld pass when generating System.map
584  *
585  * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead
586  * code elimination is enabled, so these sections should be converted
587  * to use ".." first.
588  */
589 #define TEXT_TEXT							\
590 		ALIGN_FUNCTION();					\
591 		*(.text.hot .text.hot.*)				\
592 		*(TEXT_MAIN .text.fixup)				\
593 		*(.text.unlikely .text.unlikely.*)			\
594 		*(.text.unknown .text.unknown.*)			\
595 		NOINSTR_TEXT						\
596 		*(.ref.text)						\
597 		*(.text.asan.* .text.tsan.*)				\
598 	MEM_KEEP(init.text*)						\
599 
600 
601 /* sched.text is aling to function alignment to secure we have same
602  * address even at second ld pass when generating System.map */
603 #define SCHED_TEXT							\
604 		ALIGN_FUNCTION();					\
605 		__sched_text_start = .;					\
606 		*(.sched.text)						\
607 		__sched_text_end = .;
608 
609 /* spinlock.text is aling to function alignment to secure we have same
610  * address even at second ld pass when generating System.map */
611 #define LOCK_TEXT							\
612 		ALIGN_FUNCTION();					\
613 		__lock_text_start = .;					\
614 		*(.spinlock.text)					\
615 		__lock_text_end = .;
616 
617 #define KPROBES_TEXT							\
618 		ALIGN_FUNCTION();					\
619 		__kprobes_text_start = .;				\
620 		*(.kprobes.text)					\
621 		__kprobes_text_end = .;
622 
623 #define ENTRY_TEXT							\
624 		ALIGN_FUNCTION();					\
625 		__entry_text_start = .;					\
626 		*(.entry.text)						\
627 		__entry_text_end = .;
628 
629 #define IRQENTRY_TEXT							\
630 		ALIGN_FUNCTION();					\
631 		__irqentry_text_start = .;				\
632 		*(.irqentry.text)					\
633 		__irqentry_text_end = .;
634 
635 #define SOFTIRQENTRY_TEXT						\
636 		ALIGN_FUNCTION();					\
637 		__softirqentry_text_start = .;				\
638 		*(.softirqentry.text)					\
639 		__softirqentry_text_end = .;
640 
641 #define STATIC_CALL_TEXT						\
642 		ALIGN_FUNCTION();					\
643 		__static_call_text_start = .;				\
644 		*(.static_call.text)					\
645 		__static_call_text_end = .;
646 
647 /* Section used for early init (in .S files) */
648 #define HEAD_TEXT  KEEP(*(.head.text))
649 
650 #define HEAD_TEXT_SECTION							\
651 	.head.text : AT(ADDR(.head.text) - LOAD_OFFSET) {		\
652 		HEAD_TEXT						\
653 	}
654 
655 /*
656  * Exception table
657  */
658 #define EXCEPTION_TABLE(align)						\
659 	. = ALIGN(align);						\
660 	__ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {		\
661 		BOUNDED_SECTION_BY(__ex_table, ___ex_table)		\
662 	}
663 
664 /*
665  * .BTF
666  */
667 #ifdef CONFIG_DEBUG_INFO_BTF
668 #define BTF								\
669 	.BTF : AT(ADDR(.BTF) - LOAD_OFFSET) {				\
670 		BOUNDED_SECTION_BY(.BTF, _BTF)				\
671 	}								\
672 	. = ALIGN(4);							\
673 	.BTF_ids : AT(ADDR(.BTF_ids) - LOAD_OFFSET) {			\
674 		*(.BTF_ids)						\
675 	}
676 #else
677 #define BTF
678 #endif
679 
680 /*
681  * Init task
682  */
683 #define INIT_TASK_DATA_SECTION(align)					\
684 	. = ALIGN(align);						\
685 	.data..init_task :  AT(ADDR(.data..init_task) - LOAD_OFFSET) {	\
686 		INIT_TASK_DATA(align)					\
687 	}
688 
689 #ifdef CONFIG_CONSTRUCTORS
690 #define KERNEL_CTORS()	. = ALIGN(8);			   \
691 			__ctors_start = .;		   \
692 			KEEP(*(SORT(.ctors.*)))		   \
693 			KEEP(*(.ctors))			   \
694 			KEEP(*(SORT(.init_array.*)))	   \
695 			KEEP(*(.init_array))		   \
696 			__ctors_end = .;
697 #else
698 #define KERNEL_CTORS()
699 #endif
700 
701 /* init and exit section handling */
702 #define INIT_DATA							\
703 	KEEP(*(SORT(___kentry+*)))					\
704 	*(.init.data .init.data.*)					\
705 	MEM_DISCARD(init.data*)						\
706 	KERNEL_CTORS()							\
707 	MCOUNT_REC()							\
708 	*(.init.rodata .init.rodata.*)					\
709 	FTRACE_EVENTS()							\
710 	TRACE_SYSCALLS()						\
711 	KPROBE_BLACKLIST()						\
712 	ERROR_INJECT_WHITELIST()					\
713 	MEM_DISCARD(init.rodata)					\
714 	CLK_OF_TABLES()							\
715 	RESERVEDMEM_OF_TABLES()						\
716 	TIMER_OF_TABLES()						\
717 	CPU_METHOD_OF_TABLES()						\
718 	CPUIDLE_METHOD_OF_TABLES()					\
719 	KERNEL_DTB()							\
720 	IRQCHIP_OF_MATCH_TABLE()					\
721 	ACPI_PROBE_TABLE(irqchip)					\
722 	ACPI_PROBE_TABLE(timer)						\
723 	THERMAL_TABLE(governor)						\
724 	EARLYCON_TABLE()						\
725 	LSM_TABLE()							\
726 	EARLY_LSM_TABLE()						\
727 	KUNIT_INIT_TABLE()
728 
729 #define INIT_TEXT							\
730 	*(.init.text .init.text.*)					\
731 	*(.text.startup)						\
732 	MEM_DISCARD(init.text*)
733 
734 #define EXIT_DATA							\
735 	*(.exit.data .exit.data.*)					\
736 	*(.fini_array .fini_array.*)					\
737 	*(.dtors .dtors.*)						\
738 
739 #define EXIT_TEXT							\
740 	*(.exit.text)							\
741 	*(.text.exit)							\
742 
743 #define EXIT_CALL							\
744 	*(.exitcall.exit)
745 
746 /*
747  * bss (Block Started by Symbol) - uninitialized data
748  * zeroed during startup
749  */
750 #define SBSS(sbss_align)						\
751 	. = ALIGN(sbss_align);						\
752 	.sbss : AT(ADDR(.sbss) - LOAD_OFFSET) {				\
753 		*(.dynsbss)						\
754 		*(SBSS_MAIN)						\
755 		*(.scommon)						\
756 	}
757 
758 /*
759  * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra
760  * sections to the front of bss.
761  */
762 #ifndef BSS_FIRST_SECTIONS
763 #define BSS_FIRST_SECTIONS
764 #endif
765 
766 #define BSS(bss_align)							\
767 	. = ALIGN(bss_align);						\
768 	.bss : AT(ADDR(.bss) - LOAD_OFFSET) {				\
769 		BSS_FIRST_SECTIONS					\
770 		. = ALIGN(PAGE_SIZE);					\
771 		*(.bss..page_aligned)					\
772 		. = ALIGN(PAGE_SIZE);					\
773 		*(.dynbss)						\
774 		*(BSS_MAIN)						\
775 		*(COMMON)						\
776 	}
777 
778 /*
779  * DWARF debug sections.
780  * Symbols in the DWARF debugging sections are relative to
781  * the beginning of the section so we begin them at 0.
782  */
783 #define DWARF_DEBUG							\
784 		/* DWARF 1 */						\
785 		.debug          0 : { *(.debug) }			\
786 		.line           0 : { *(.line) }			\
787 		/* GNU DWARF 1 extensions */				\
788 		.debug_srcinfo  0 : { *(.debug_srcinfo) }		\
789 		.debug_sfnames  0 : { *(.debug_sfnames) }		\
790 		/* DWARF 1.1 and DWARF 2 */				\
791 		.debug_aranges  0 : { *(.debug_aranges) }		\
792 		.debug_pubnames 0 : { *(.debug_pubnames) }		\
793 		/* DWARF 2 */						\
794 		.debug_info     0 : { *(.debug_info			\
795 				.gnu.linkonce.wi.*) }			\
796 		.debug_abbrev   0 : { *(.debug_abbrev) }		\
797 		.debug_line     0 : { *(.debug_line) }			\
798 		.debug_frame    0 : { *(.debug_frame) }			\
799 		.debug_str      0 : { *(.debug_str) }			\
800 		.debug_loc      0 : { *(.debug_loc) }			\
801 		.debug_macinfo  0 : { *(.debug_macinfo) }		\
802 		.debug_pubtypes 0 : { *(.debug_pubtypes) }		\
803 		/* DWARF 3 */						\
804 		.debug_ranges	0 : { *(.debug_ranges) }		\
805 		/* SGI/MIPS DWARF 2 extensions */			\
806 		.debug_weaknames 0 : { *(.debug_weaknames) }		\
807 		.debug_funcnames 0 : { *(.debug_funcnames) }		\
808 		.debug_typenames 0 : { *(.debug_typenames) }		\
809 		.debug_varnames  0 : { *(.debug_varnames) }		\
810 		/* GNU DWARF 2 extensions */				\
811 		.debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) }	\
812 		.debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) }	\
813 		/* DWARF 4 */						\
814 		.debug_types	0 : { *(.debug_types) }			\
815 		/* DWARF 5 */						\
816 		.debug_addr	0 : { *(.debug_addr) }			\
817 		.debug_line_str	0 : { *(.debug_line_str) }		\
818 		.debug_loclists	0 : { *(.debug_loclists) }		\
819 		.debug_macro	0 : { *(.debug_macro) }			\
820 		.debug_names	0 : { *(.debug_names) }			\
821 		.debug_rnglists	0 : { *(.debug_rnglists) }		\
822 		.debug_str_offsets	0 : { *(.debug_str_offsets) }
823 
824 /* Stabs debugging sections. */
825 #define STABS_DEBUG							\
826 		.stab 0 : { *(.stab) }					\
827 		.stabstr 0 : { *(.stabstr) }				\
828 		.stab.excl 0 : { *(.stab.excl) }			\
829 		.stab.exclstr 0 : { *(.stab.exclstr) }			\
830 		.stab.index 0 : { *(.stab.index) }			\
831 		.stab.indexstr 0 : { *(.stab.indexstr) }
832 
833 /* Required sections not related to debugging. */
834 #define ELF_DETAILS							\
835 		.comment 0 : { *(.comment) }				\
836 		.symtab 0 : { *(.symtab) }				\
837 		.strtab 0 : { *(.strtab) }				\
838 		.shstrtab 0 : { *(.shstrtab) }
839 
840 #ifdef CONFIG_GENERIC_BUG
841 #define BUG_TABLE							\
842 	. = ALIGN(8);							\
843 	__bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) {		\
844 		BOUNDED_SECTION_BY(__bug_table, ___bug_table)		\
845 	}
846 #else
847 #define BUG_TABLE
848 #endif
849 
850 #ifdef CONFIG_UNWINDER_ORC
851 #define ORC_UNWIND_TABLE						\
852 	.orc_header : AT(ADDR(.orc_header) - LOAD_OFFSET) {		\
853 		BOUNDED_SECTION_BY(.orc_header, _orc_header)		\
854 	}								\
855 	. = ALIGN(4);							\
856 	.orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) {	\
857 		BOUNDED_SECTION_BY(.orc_unwind_ip, _orc_unwind_ip)	\
858 	}								\
859 	. = ALIGN(2);							\
860 	.orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) {		\
861 		BOUNDED_SECTION_BY(.orc_unwind, _orc_unwind)		\
862 	}								\
863 	text_size = _etext - _stext;					\
864 	. = ALIGN(4);							\
865 	.orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) {		\
866 		orc_lookup = .;						\
867 		. += (((text_size + LOOKUP_BLOCK_SIZE - 1) /		\
868 			LOOKUP_BLOCK_SIZE) + 1) * 4;			\
869 		orc_lookup_end = .;					\
870 	}
871 #else
872 #define ORC_UNWIND_TABLE
873 #endif
874 
875 /* Built-in firmware blobs */
876 #ifdef CONFIG_FW_LOADER
877 #define FW_LOADER_BUILT_IN_DATA						\
878 	.builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) ALIGN(8) {	\
879 		BOUNDED_SECTION_PRE_LABEL(.builtin_fw, _builtin_fw, __start, __end) \
880 	}
881 #else
882 #define FW_LOADER_BUILT_IN_DATA
883 #endif
884 
885 #ifdef CONFIG_PM_TRACE
886 #define TRACEDATA							\
887 	. = ALIGN(4);							\
888 	.tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) {		\
889 		BOUNDED_SECTION_POST_LABEL(.tracedata, __tracedata, _start, _end) \
890 	}
891 #else
892 #define TRACEDATA
893 #endif
894 
895 #ifdef CONFIG_PRINTK_INDEX
896 #define PRINTK_INDEX							\
897 	.printk_index : AT(ADDR(.printk_index) - LOAD_OFFSET) {		\
898 		BOUNDED_SECTION_BY(.printk_index, _printk_index)	\
899 	}
900 #else
901 #define PRINTK_INDEX
902 #endif
903 
904 /*
905  * Discard .note.GNU-stack, which is emitted as PROGBITS by the compiler.
906  * Otherwise, the type of .notes section would become PROGBITS instead of NOTES.
907  *
908  * Also, discard .note.gnu.property, otherwise it forces the notes section to
909  * be 8-byte aligned which causes alignment mismatches with the kernel's custom
910  * 4-byte aligned notes.
911  */
912 #define NOTES								\
913 	/DISCARD/ : {							\
914 		*(.note.GNU-stack)					\
915 		*(.note.gnu.property)					\
916 	}								\
917 	.notes : AT(ADDR(.notes) - LOAD_OFFSET) {			\
918 		BOUNDED_SECTION_BY(.note.*, _notes)			\
919 	} NOTES_HEADERS							\
920 	NOTES_HEADERS_RESTORE
921 
922 #define INIT_SETUP(initsetup_align)					\
923 		. = ALIGN(initsetup_align);				\
924 		BOUNDED_SECTION_POST_LABEL(.init.setup, __setup, _start, _end)
925 
926 #define INIT_CALLS_LEVEL(level)						\
927 		__initcall##level##_start = .;				\
928 		KEEP(*(.initcall##level##.init))			\
929 		KEEP(*(.initcall##level##s.init))			\
930 
931 #define INIT_CALLS							\
932 		__initcall_start = .;					\
933 		KEEP(*(.initcallearly.init))				\
934 		INIT_CALLS_LEVEL(0)					\
935 		INIT_CALLS_LEVEL(1)					\
936 		INIT_CALLS_LEVEL(2)					\
937 		INIT_CALLS_LEVEL(3)					\
938 		INIT_CALLS_LEVEL(4)					\
939 		INIT_CALLS_LEVEL(5)					\
940 		INIT_CALLS_LEVEL(rootfs)				\
941 		INIT_CALLS_LEVEL(6)					\
942 		INIT_CALLS_LEVEL(7)					\
943 		__initcall_end = .;
944 
945 #define CON_INITCALL							\
946 	BOUNDED_SECTION_POST_LABEL(.con_initcall.init, __con_initcall, _start, _end)
947 
948 /* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */
949 #define KUNIT_TABLE()							\
950 		. = ALIGN(8);						\
951 		BOUNDED_SECTION_POST_LABEL(.kunit_test_suites, __kunit_suites, _start, _end)
952 
953 /* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */
954 #define KUNIT_INIT_TABLE()						\
955 		. = ALIGN(8);						\
956 		BOUNDED_SECTION_POST_LABEL(.kunit_init_test_suites, \
957 				__kunit_init_suites, _start, _end)
958 
959 #ifdef CONFIG_BLK_DEV_INITRD
960 #define INIT_RAM_FS							\
961 	. = ALIGN(4);							\
962 	__initramfs_start = .;						\
963 	KEEP(*(.init.ramfs))						\
964 	. = ALIGN(8);							\
965 	KEEP(*(.init.ramfs.info))
966 #else
967 #define INIT_RAM_FS
968 #endif
969 
970 /*
971  * Memory encryption operates on a page basis. Since we need to clear
972  * the memory encryption mask for this section, it needs to be aligned
973  * on a page boundary and be a page-size multiple in length.
974  *
975  * Note: We use a separate section so that only this section gets
976  * decrypted to avoid exposing more than we wish.
977  */
978 #ifdef CONFIG_AMD_MEM_ENCRYPT
979 #define PERCPU_DECRYPTED_SECTION					\
980 	. = ALIGN(PAGE_SIZE);						\
981 	*(.data..percpu..decrypted)					\
982 	. = ALIGN(PAGE_SIZE);
983 #else
984 #define PERCPU_DECRYPTED_SECTION
985 #endif
986 
987 
988 /*
989  * Default discarded sections.
990  *
991  * Some archs want to discard exit text/data at runtime rather than
992  * link time due to cross-section references such as alt instructions,
993  * bug table, eh_frame, etc.  DISCARDS must be the last of output
994  * section definitions so that such archs put those in earlier section
995  * definitions.
996  */
997 #ifdef RUNTIME_DISCARD_EXIT
998 #define EXIT_DISCARDS
999 #else
1000 #define EXIT_DISCARDS							\
1001 	EXIT_TEXT							\
1002 	EXIT_DATA
1003 #endif
1004 
1005 /*
1006  * Clang's -fprofile-arcs, -fsanitize=kernel-address, and
1007  * -fsanitize=thread produce unwanted sections (.eh_frame
1008  * and .init_array.*), but CONFIG_CONSTRUCTORS wants to
1009  * keep any .init_array.* sections.
1010  * https://llvm.org/pr46478
1011  */
1012 #ifdef CONFIG_UNWIND_TABLES
1013 #define DISCARD_EH_FRAME
1014 #else
1015 #define DISCARD_EH_FRAME	*(.eh_frame)
1016 #endif
1017 #if defined(CONFIG_GCOV_KERNEL) || defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KCSAN)
1018 # ifdef CONFIG_CONSTRUCTORS
1019 #  define SANITIZER_DISCARDS						\
1020 	DISCARD_EH_FRAME
1021 # else
1022 #  define SANITIZER_DISCARDS						\
1023 	*(.init_array) *(.init_array.*)					\
1024 	DISCARD_EH_FRAME
1025 # endif
1026 #else
1027 # define SANITIZER_DISCARDS
1028 #endif
1029 
1030 #define COMMON_DISCARDS							\
1031 	SANITIZER_DISCARDS						\
1032 	PATCHABLE_DISCARDS						\
1033 	*(.discard)							\
1034 	*(.discard.*)							\
1035 	*(.export_symbol)						\
1036 	*(.modinfo)							\
1037 	/* ld.bfd warns about .gnu.version* even when not emitted */	\
1038 	*(.gnu.version*)						\
1039 
1040 #define DISCARDS							\
1041 	/DISCARD/ : {							\
1042 	EXIT_DISCARDS							\
1043 	EXIT_CALL							\
1044 	COMMON_DISCARDS							\
1045 	}
1046 
1047 /**
1048  * PERCPU_INPUT - the percpu input sections
1049  * @cacheline: cacheline size
1050  *
1051  * The core percpu section names and core symbols which do not rely
1052  * directly upon load addresses.
1053  *
1054  * @cacheline is used to align subsections to avoid false cacheline
1055  * sharing between subsections for different purposes.
1056  */
1057 #define PERCPU_INPUT(cacheline)						\
1058 	__per_cpu_start = .;						\
1059 	*(.data..percpu..first)						\
1060 	. = ALIGN(PAGE_SIZE);						\
1061 	*(.data..percpu..page_aligned)					\
1062 	. = ALIGN(cacheline);						\
1063 	*(.data..percpu..read_mostly)					\
1064 	. = ALIGN(cacheline);						\
1065 	*(.data..percpu)						\
1066 	*(.data..percpu..shared_aligned)				\
1067 	PERCPU_DECRYPTED_SECTION					\
1068 	__per_cpu_end = .;
1069 
1070 /**
1071  * PERCPU_VADDR - define output section for percpu area
1072  * @cacheline: cacheline size
1073  * @vaddr: explicit base address (optional)
1074  * @phdr: destination PHDR (optional)
1075  *
1076  * Macro which expands to output section for percpu area.
1077  *
1078  * @cacheline is used to align subsections to avoid false cacheline
1079  * sharing between subsections for different purposes.
1080  *
1081  * If @vaddr is not blank, it specifies explicit base address and all
1082  * percpu symbols will be offset from the given address.  If blank,
1083  * @vaddr always equals @laddr + LOAD_OFFSET.
1084  *
1085  * @phdr defines the output PHDR to use if not blank.  Be warned that
1086  * output PHDR is sticky.  If @phdr is specified, the next output
1087  * section in the linker script will go there too.  @phdr should have
1088  * a leading colon.
1089  *
1090  * Note that this macros defines __per_cpu_load as an absolute symbol.
1091  * If there is no need to put the percpu section at a predetermined
1092  * address, use PERCPU_SECTION.
1093  */
1094 #define PERCPU_VADDR(cacheline, vaddr, phdr)				\
1095 	__per_cpu_load = .;						\
1096 	.data..percpu vaddr : AT(__per_cpu_load - LOAD_OFFSET) {	\
1097 		PERCPU_INPUT(cacheline)					\
1098 	} phdr								\
1099 	. = __per_cpu_load + SIZEOF(.data..percpu);
1100 
1101 /**
1102  * PERCPU_SECTION - define output section for percpu area, simple version
1103  * @cacheline: cacheline size
1104  *
1105  * Align to PAGE_SIZE and outputs output section for percpu area.  This
1106  * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and
1107  * __per_cpu_start will be identical.
1108  *
1109  * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,)
1110  * except that __per_cpu_load is defined as a relative symbol against
1111  * .data..percpu which is required for relocatable x86_32 configuration.
1112  */
1113 #define PERCPU_SECTION(cacheline)					\
1114 	. = ALIGN(PAGE_SIZE);						\
1115 	.data..percpu	: AT(ADDR(.data..percpu) - LOAD_OFFSET) {	\
1116 		__per_cpu_load = .;					\
1117 		PERCPU_INPUT(cacheline)					\
1118 	}
1119 
1120 
1121 /*
1122  * Definition of the high level *_SECTION macros
1123  * They will fit only a subset of the architectures
1124  */
1125 
1126 
1127 /*
1128  * Writeable data.
1129  * All sections are combined in a single .data section.
1130  * The sections following CONSTRUCTORS are arranged so their
1131  * typical alignment matches.
1132  * A cacheline is typical/always less than a PAGE_SIZE so
1133  * the sections that has this restriction (or similar)
1134  * is located before the ones requiring PAGE_SIZE alignment.
1135  * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
1136  * matches the requirement of PAGE_ALIGNED_DATA.
1137  *
1138  * use 0 as page_align if page_aligned data is not used */
1139 #define RW_DATA(cacheline, pagealigned, inittask)			\
1140 	. = ALIGN(PAGE_SIZE);						\
1141 	.data : AT(ADDR(.data) - LOAD_OFFSET) {				\
1142 		INIT_TASK_DATA(inittask)				\
1143 		NOSAVE_DATA						\
1144 		PAGE_ALIGNED_DATA(pagealigned)				\
1145 		CACHELINE_ALIGNED_DATA(cacheline)			\
1146 		READ_MOSTLY_DATA(cacheline)				\
1147 		DATA_DATA						\
1148 		CONSTRUCTORS						\
1149 	}								\
1150 	BUG_TABLE							\
1151 
1152 #define INIT_TEXT_SECTION(inittext_align)				\
1153 	. = ALIGN(inittext_align);					\
1154 	.init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {		\
1155 		_sinittext = .;						\
1156 		INIT_TEXT						\
1157 		_einittext = .;						\
1158 	}
1159 
1160 #define INIT_DATA_SECTION(initsetup_align)				\
1161 	.init.data : AT(ADDR(.init.data) - LOAD_OFFSET) {		\
1162 		INIT_DATA						\
1163 		INIT_SETUP(initsetup_align)				\
1164 		INIT_CALLS						\
1165 		CON_INITCALL						\
1166 		INIT_RAM_FS						\
1167 	}
1168 
1169 #define BSS_SECTION(sbss_align, bss_align, stop_align)			\
1170 	. = ALIGN(sbss_align);						\
1171 	__bss_start = .;						\
1172 	SBSS(sbss_align)						\
1173 	BSS(bss_align)							\
1174 	. = ALIGN(stop_align);						\
1175 	__bss_stop = .;
1176