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