]>
Commit | Line | Data |
---|---|---|
ef53dae8 SR |
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 = .; | |
7923f90f | 15 | * HEAD_TEXT_SECTION |
ef53dae8 SR |
16 | * INIT_TEXT_SECTION(PAGE_SIZE) |
17 | * INIT_DATA_SECTION(...) | |
0415b00d | 18 | * PERCPU_SECTION(CACHELINE_SIZE) |
ef53dae8 SR |
19 | * __init_end = .; |
20 | * | |
21 | * _stext = .; | |
22 | * TEXT_SECTION = 0 | |
23 | * _etext = .; | |
24 | * | |
25 | * _sdata = .; | |
93240b32 | 26 | * RO_DATA(PAGE_SIZE) |
c9174047 | 27 | * RW_DATA(...) |
ef53dae8 SR |
28 | * _edata = .; |
29 | * | |
30 | * EXCEPTION_TABLE(...) | |
ef53dae8 | 31 | * |
04e448d9 | 32 | * BSS_SECTION(0, 0, 0) |
ef53dae8 SR |
33 | * _end = .; |
34 | * | |
ef53dae8 SR |
35 | * STABS_DEBUG |
36 | * DWARF_DEBUG | |
023bf6f1 TH |
37 | * |
38 | * DISCARDS // must be the last | |
ef53dae8 SR |
39 | * } |
40 | * | |
41 | * [__init_begin, __init_end] is the init section that may be freed after init | |
562c85ca YW |
42 | * // __init_begin and __init_end should be page aligned, so that we can |
43 | * // free the whole .init memory | |
ef53dae8 SR |
44 | * [_stext, _etext] is the text section |
45 | * [_sdata, _edata] is the data section | |
46 | * | |
47 | * Some of the included output section have their own set of constants. | |
48 | * Examples are: [__initramfs_start, __initramfs_end] for initramfs and | |
49 | * [__nosave_begin, __nosave_end] for the nosave data | |
50 | */ | |
c80d471a | 51 | |
1da177e4 LT |
52 | #ifndef LOAD_OFFSET |
53 | #define LOAD_OFFSET 0 | |
54 | #endif | |
55 | ||
441110a5 KC |
56 | /* |
57 | * Only some architectures want to have the .notes segment visible in | |
fbe6a8e6 KC |
58 | * a separate PT_NOTE ELF Program Header. When this happens, it needs |
59 | * to be visible in both the kernel text's PT_LOAD and the PT_NOTE | |
60 | * Program Headers. In this case, though, the PT_LOAD needs to be made | |
61 | * the default again so that all the following sections don't also end | |
62 | * up in the PT_NOTE Program Header. | |
441110a5 KC |
63 | */ |
64 | #ifdef EMITS_PT_NOTE | |
65 | #define NOTES_HEADERS :text :note | |
fbe6a8e6 KC |
66 | #define NOTES_HEADERS_RESTORE __restore_ph : { *(.__restore_ph) } :text |
67 | #else | |
68 | #define NOTES_HEADERS | |
69 | #define NOTES_HEADERS_RESTORE | |
441110a5 KC |
70 | #endif |
71 | ||
b8c2f776 KC |
72 | /* |
73 | * Some architectures have non-executable read-only exception tables. | |
74 | * They can be added to the RO_DATA segment by specifying their desired | |
75 | * alignment. | |
76 | */ | |
77 | #ifdef RO_EXCEPTION_TABLE_ALIGN | |
78 | #define RO_EXCEPTION_TABLE EXCEPTION_TABLE(RO_EXCEPTION_TABLE_ALIGN) | |
79 | #else | |
80 | #define RO_EXCEPTION_TABLE | |
81 | #endif | |
82 | ||
6d30e3a8 SR |
83 | /* Align . to a 8 byte boundary equals to maximum function alignment. */ |
84 | #define ALIGN_FUNCTION() . = ALIGN(8) | |
85 | ||
cb87481e NP |
86 | /* |
87 | * LD_DEAD_CODE_DATA_ELIMINATION option enables -fdata-sections, which | |
88 | * generates .data.identifier sections, which need to be pulled in with | |
89 | * .data. We don't want to pull in .data..other sections, which Linux | |
90 | * has defined. Same for text and bss. | |
266ff2a8 NP |
91 | * |
92 | * RODATA_MAIN is not used because existing code already defines .rodata.x | |
93 | * sections to be brought in with rodata. | |
cb87481e NP |
94 | */ |
95 | #ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATION | |
96 | #define TEXT_MAIN .text .text.[0-9a-zA-Z_]* | |
52c8ee5b | 97 | #define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..LPBX* |
266ff2a8 NP |
98 | #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]* |
99 | #define RODATA_MAIN .rodata .rodata.[0-9a-zA-Z_]* | |
cb87481e | 100 | #define BSS_MAIN .bss .bss.[0-9a-zA-Z_]* |
266ff2a8 | 101 | #define SBSS_MAIN .sbss .sbss.[0-9a-zA-Z_]* |
cb87481e NP |
102 | #else |
103 | #define TEXT_MAIN .text | |
104 | #define DATA_MAIN .data | |
266ff2a8 NP |
105 | #define SDATA_MAIN .sdata |
106 | #define RODATA_MAIN .rodata | |
cb87481e | 107 | #define BSS_MAIN .bss |
266ff2a8 | 108 | #define SBSS_MAIN .sbss |
cb87481e NP |
109 | #endif |
110 | ||
07fca0e5 SR |
111 | /* |
112 | * Align to a 32 byte boundary equal to the | |
113 | * alignment gcc 4.5 uses for a struct | |
114 | */ | |
aab94339 DB |
115 | #define STRUCT_ALIGNMENT 32 |
116 | #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT) | |
07fca0e5 | 117 | |
eb8f6890 SR |
118 | /* The actual configuration determine if the init/exit sections |
119 | * are handled as text/data or they can be discarded (which | |
120 | * often happens at runtime) | |
121 | */ | |
eb8f6890 SR |
122 | #ifdef CONFIG_HOTPLUG_CPU |
123 | #define CPU_KEEP(sec) *(.cpu##sec) | |
124 | #define CPU_DISCARD(sec) | |
125 | #else | |
126 | #define CPU_KEEP(sec) | |
127 | #define CPU_DISCARD(sec) *(.cpu##sec) | |
128 | #endif | |
129 | ||
1a3fb6d4 | 130 | #if defined(CONFIG_MEMORY_HOTPLUG) |
eb8f6890 SR |
131 | #define MEM_KEEP(sec) *(.mem##sec) |
132 | #define MEM_DISCARD(sec) | |
133 | #else | |
134 | #define MEM_KEEP(sec) | |
135 | #define MEM_DISCARD(sec) *(.mem##sec) | |
136 | #endif | |
137 | ||
8da3821b | 138 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
a1326b17 MR |
139 | /* |
140 | * The ftrace call sites are logged to a section whose name depends on the | |
141 | * compiler option used. A given kernel image will only use one, AKA | |
142 | * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header | |
143 | * dependencies for FTRACE_CALLSITE_SECTION's definition. | |
95f1fa9e | 144 | * |
46f94692 | 145 | * Need to also make ftrace_stub_graph point to ftrace_stub |
b83b43ff SRV |
146 | * so that the same stub location may have different protocols |
147 | * and not mess up with C verifiers. | |
a1326b17 | 148 | */ |
4b3b4c5e | 149 | #define MCOUNT_REC() . = ALIGN(8); \ |
a6214385 | 150 | __start_mcount_loc = .; \ |
266ff2a8 | 151 | KEEP(*(__mcount_loc)) \ |
a1326b17 | 152 | KEEP(*(__patchable_function_entries)) \ |
b83b43ff | 153 | __stop_mcount_loc = .; \ |
46f94692 | 154 | ftrace_stub_graph = ftrace_stub; |
8da3821b | 155 | #else |
b83b43ff | 156 | # ifdef CONFIG_FUNCTION_TRACER |
46f94692 | 157 | # define MCOUNT_REC() ftrace_stub_graph = ftrace_stub; |
b83b43ff SRV |
158 | # else |
159 | # define MCOUNT_REC() | |
160 | # endif | |
8da3821b | 161 | #endif |
eb8f6890 | 162 | |
2ed84eeb | 163 | #ifdef CONFIG_TRACE_BRANCH_PROFILING |
a6214385 | 164 | #define LIKELY_PROFILE() __start_annotated_branch_profile = .; \ |
266ff2a8 | 165 | KEEP(*(_ftrace_annotated_branch)) \ |
a6214385 | 166 | __stop_annotated_branch_profile = .; |
1f0d69a9 SR |
167 | #else |
168 | #define LIKELY_PROFILE() | |
169 | #endif | |
170 | ||
2bcd521a | 171 | #ifdef CONFIG_PROFILE_ALL_BRANCHES |
a6214385 | 172 | #define BRANCH_PROFILE() __start_branch_profile = .; \ |
266ff2a8 | 173 | KEEP(*(_ftrace_branch)) \ |
a6214385 | 174 | __stop_branch_profile = .; |
2bcd521a SR |
175 | #else |
176 | #define BRANCH_PROFILE() | |
177 | #endif | |
178 | ||
376e2424 | 179 | #ifdef CONFIG_KPROBES |
69902c71 | 180 | #define KPROBE_BLACKLIST() . = ALIGN(8); \ |
a6214385 | 181 | __start_kprobe_blacklist = .; \ |
4b89b7f7 | 182 | KEEP(*(_kprobe_blacklist)) \ |
a6214385 | 183 | __stop_kprobe_blacklist = .; |
376e2424 MH |
184 | #else |
185 | #define KPROBE_BLACKLIST() | |
186 | #endif | |
187 | ||
540adea3 | 188 | #ifdef CONFIG_FUNCTION_ERROR_INJECTION |
663faf9f | 189 | #define ERROR_INJECT_WHITELIST() STRUCT_ALIGN(); \ |
a6214385 | 190 | __start_error_injection_whitelist = .; \ |
540adea3 | 191 | KEEP(*(_error_injection_whitelist)) \ |
a6214385 | 192 | __stop_error_injection_whitelist = .; |
92ace999 | 193 | #else |
540adea3 | 194 | #define ERROR_INJECT_WHITELIST() |
92ace999 JB |
195 | #endif |
196 | ||
5f77a88b | 197 | #ifdef CONFIG_EVENT_TRACING |
e4a9ea5e | 198 | #define FTRACE_EVENTS() . = ALIGN(8); \ |
a6214385 | 199 | __start_ftrace_events = .; \ |
4b89b7f7 | 200 | KEEP(*(_ftrace_events)) \ |
a6214385 MY |
201 | __stop_ftrace_events = .; \ |
202 | __start_ftrace_eval_maps = .; \ | |
02fd7f68 | 203 | KEEP(*(_ftrace_eval_map)) \ |
a6214385 | 204 | __stop_ftrace_eval_maps = .; |
b77e38aa SR |
205 | #else |
206 | #define FTRACE_EVENTS() | |
207 | #endif | |
208 | ||
1ba28e02 | 209 | #ifdef CONFIG_TRACING |
a6214385 | 210 | #define TRACE_PRINTKS() __start___trace_bprintk_fmt = .; \ |
4b89b7f7 | 211 | KEEP(*(__trace_printk_fmt)) /* Trace_printk fmt' pointer */ \ |
a6214385 MY |
212 | __stop___trace_bprintk_fmt = .; |
213 | #define TRACEPOINT_STR() __start___tracepoint_str = .; \ | |
4b89b7f7 | 214 | KEEP(*(__tracepoint_str)) /* Trace_printk fmt' pointer */ \ |
a6214385 | 215 | __stop___tracepoint_str = .; |
1ba28e02 LJ |
216 | #else |
217 | #define TRACE_PRINTKS() | |
102c9323 | 218 | #define TRACEPOINT_STR() |
1ba28e02 LJ |
219 | #endif |
220 | ||
bed1ffca | 221 | #ifdef CONFIG_FTRACE_SYSCALLS |
3d56e331 | 222 | #define TRACE_SYSCALLS() . = ALIGN(8); \ |
a6214385 | 223 | __start_syscalls_metadata = .; \ |
4b89b7f7 | 224 | KEEP(*(__syscalls_metadata)) \ |
a6214385 | 225 | __stop_syscalls_metadata = .; |
bed1ffca FW |
226 | #else |
227 | #define TRACE_SYSCALLS() | |
228 | #endif | |
229 | ||
c4f6699d AS |
230 | #ifdef CONFIG_BPF_EVENTS |
231 | #define BPF_RAW_TP() STRUCT_ALIGN(); \ | |
a6214385 | 232 | __start__bpf_raw_tp = .; \ |
c4f6699d | 233 | KEEP(*(__bpf_raw_tp_map)) \ |
a6214385 | 234 | __stop__bpf_raw_tp = .; |
c4f6699d AS |
235 | #else |
236 | #define BPF_RAW_TP() | |
237 | #endif | |
238 | ||
470ca0de | 239 | #ifdef CONFIG_SERIAL_EARLYCON |
dd709e72 | 240 | #define EARLYCON_TABLE() . = ALIGN(8); \ |
a6214385 | 241 | __earlycon_table = .; \ |
4b89b7f7 | 242 | KEEP(*(__earlycon_table)) \ |
a6214385 | 243 | __earlycon_table_end = .; |
470ca0de PH |
244 | #else |
245 | #define EARLYCON_TABLE() | |
246 | #endif | |
aab94339 | 247 | |
3ac946d1 KC |
248 | #ifdef CONFIG_SECURITY |
249 | #define LSM_TABLE() . = ALIGN(8); \ | |
250 | __start_lsm_info = .; \ | |
251 | KEEP(*(.lsm_info.init)) \ | |
252 | __end_lsm_info = .; | |
e6b1db98 MG |
253 | #define EARLY_LSM_TABLE() . = ALIGN(8); \ |
254 | __start_early_lsm_info = .; \ | |
255 | KEEP(*(.early_lsm_info.init)) \ | |
256 | __end_early_lsm_info = .; | |
3ac946d1 KC |
257 | #else |
258 | #define LSM_TABLE() | |
e6b1db98 | 259 | #define EARLY_LSM_TABLE() |
3ac946d1 KC |
260 | #endif |
261 | ||
06309288 RH |
262 | #define ___OF_TABLE(cfg, name) _OF_TABLE_##cfg(name) |
263 | #define __OF_TABLE(cfg, name) ___OF_TABLE(cfg, name) | |
5ee02af1 | 264 | #define OF_TABLE(cfg, name) __OF_TABLE(IS_ENABLED(cfg), name) |
06309288 RH |
265 | #define _OF_TABLE_0(name) |
266 | #define _OF_TABLE_1(name) \ | |
f6e916b8 | 267 | . = ALIGN(8); \ |
a6214385 | 268 | __##name##_of_table = .; \ |
4b89b7f7 NP |
269 | KEEP(*(__##name##_of_table)) \ |
270 | KEEP(*(__##name##_of_table_end)) | |
06309288 | 271 | |
bb0eb050 | 272 | #define TIMER_OF_TABLES() OF_TABLE(CONFIG_TIMER_OF, timer) |
06309288 RH |
273 | #define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip) |
274 | #define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk) | |
275 | #define RESERVEDMEM_OF_TABLES() OF_TABLE(CONFIG_OF_RESERVED_MEM, reservedmem) | |
276 | #define CPU_METHOD_OF_TABLES() OF_TABLE(CONFIG_SMP, cpu_method) | |
449e056c | 277 | #define CPUIDLE_METHOD_OF_TABLES() OF_TABLE(CONFIG_CPU_IDLE, cpuidle_method) |
6c3ff8b1 | 278 | |
e647b532 MZ |
279 | #ifdef CONFIG_ACPI |
280 | #define ACPI_PROBE_TABLE(name) \ | |
281 | . = ALIGN(8); \ | |
a6214385 | 282 | __##name##_acpi_probe_table = .; \ |
4b89b7f7 | 283 | KEEP(*(__##name##_acpi_probe_table)) \ |
a6214385 | 284 | __##name##_acpi_probe_table_end = .; |
e647b532 MZ |
285 | #else |
286 | #define ACPI_PROBE_TABLE(name) | |
287 | #endif | |
288 | ||
980af75e DL |
289 | #ifdef CONFIG_THERMAL |
290 | #define THERMAL_TABLE(name) \ | |
291 | . = ALIGN(8); \ | |
292 | __##name##_thermal_table = .; \ | |
293 | KEEP(*(__##name##_thermal_table)) \ | |
294 | __##name##_thermal_table_end = .; | |
295 | #else | |
296 | #define THERMAL_TABLE(name) | |
297 | #endif | |
298 | ||
aab94339 DB |
299 | #define KERNEL_DTB() \ |
300 | STRUCT_ALIGN(); \ | |
a6214385 | 301 | __dtb_start = .; \ |
4b89b7f7 | 302 | KEEP(*(.dtb.init.rodata)) \ |
a6214385 | 303 | __dtb_end = .; |
aab94339 | 304 | |
b67067f1 NP |
305 | /* |
306 | * .data section | |
b67067f1 | 307 | */ |
ca967258 | 308 | #define DATA_DATA \ |
129f6c48 | 309 | *(.xiptext) \ |
cb87481e | 310 | *(DATA_MAIN) \ |
312b1485 | 311 | *(.ref.data) \ |
d356c0b6 | 312 | *(.data..shared_aligned) /* percpu related */ \ |
266ff2a8 NP |
313 | MEM_KEEP(init.data*) \ |
314 | MEM_KEEP(exit.data*) \ | |
7ccaba53 | 315 | *(.data.unlikely) \ |
a6214385 | 316 | __start_once = .; \ |
b1fca27d | 317 | *(.data.once) \ |
a6214385 | 318 | __end_once = .; \ |
65498646 | 319 | STRUCT_ALIGN(); \ |
97e1c18e | 320 | *(__tracepoints) \ |
e9d376f0 JB |
321 | /* implement dynamic printk debug */ \ |
322 | . = ALIGN(8); \ | |
a6214385 | 323 | __start___verbose = .; \ |
4b89b7f7 | 324 | KEEP(*(__verbose)) \ |
a6214385 | 325 | __stop___verbose = .; \ |
2bcd521a | 326 | LIKELY_PROFILE() \ |
b77e38aa | 327 | BRANCH_PROFILE() \ |
102c9323 | 328 | TRACE_PRINTKS() \ |
c4f6699d | 329 | BPF_RAW_TP() \ |
102c9323 | 330 | TRACEPOINT_STR() |
ca967258 | 331 | |
ef53dae8 SR |
332 | /* |
333 | * Data section helpers | |
334 | */ | |
335 | #define NOSAVE_DATA \ | |
336 | . = ALIGN(PAGE_SIZE); \ | |
a6214385 | 337 | __nosave_begin = .; \ |
07b3bb1e | 338 | *(.data..nosave) \ |
ef53dae8 | 339 | . = ALIGN(PAGE_SIZE); \ |
a6214385 | 340 | __nosave_end = .; |
ef53dae8 SR |
341 | |
342 | #define PAGE_ALIGNED_DATA(page_align) \ | |
343 | . = ALIGN(page_align); \ | |
75b13483 | 344 | *(.data..page_aligned) |
ef53dae8 SR |
345 | |
346 | #define READ_MOSTLY_DATA(align) \ | |
347 | . = ALIGN(align); \ | |
8369744f SL |
348 | *(.data..read_mostly) \ |
349 | . = ALIGN(align); | |
ef53dae8 SR |
350 | |
351 | #define CACHELINE_ALIGNED_DATA(align) \ | |
352 | . = ALIGN(align); \ | |
4af57b78 | 353 | *(.data..cacheline_aligned) |
ef53dae8 | 354 | |
39a449d9 | 355 | #define INIT_TASK_DATA(align) \ |
ef53dae8 | 356 | . = ALIGN(align); \ |
a6214385 MY |
357 | __start_init_task = .; \ |
358 | init_thread_union = .; \ | |
359 | init_stack = .; \ | |
266ff2a8 NP |
360 | KEEP(*(.data..init_task)) \ |
361 | KEEP(*(.data..init_thread_info)) \ | |
a6214385 MY |
362 | . = __start_init_task + THREAD_SIZE; \ |
363 | __end_init_task = .; | |
ef53dae8 | 364 | |
e872267b AB |
365 | #define JUMP_TABLE_DATA \ |
366 | . = ALIGN(8); \ | |
367 | __start___jump_table = .; \ | |
368 | KEEP(*(__jump_table)) \ | |
369 | __stop___jump_table = .; | |
370 | ||
32fb2fc5 HC |
371 | /* |
372 | * Allow architectures to handle ro_after_init data on their | |
373 | * own by defining an empty RO_AFTER_INIT_DATA. | |
374 | */ | |
375 | #ifndef RO_AFTER_INIT_DATA | |
d7c19b06 | 376 | #define RO_AFTER_INIT_DATA \ |
a6214385 | 377 | __start_ro_after_init = .; \ |
d7c19b06 | 378 | *(.data..ro_after_init) \ |
e872267b | 379 | JUMP_TABLE_DATA \ |
a6214385 | 380 | __end_ro_after_init = .; |
32fb2fc5 HC |
381 | #endif |
382 | ||
ef53dae8 SR |
383 | /* |
384 | * Read only Data | |
385 | */ | |
93240b32 | 386 | #define RO_DATA(align) \ |
4096b46f | 387 | . = ALIGN((align)); \ |
1da177e4 | 388 | .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ |
a6214385 | 389 | __start_rodata = .; \ |
1da177e4 | 390 | *(.rodata) *(.rodata.*) \ |
32fb2fc5 | 391 | RO_AFTER_INIT_DATA /* Read only after init */ \ |
65498646 | 392 | . = ALIGN(8); \ |
a6214385 | 393 | __start___tracepoints_ptrs = .; \ |
4b89b7f7 | 394 | KEEP(*(__tracepoints_ptrs)) /* Tracepoints: pointer array */ \ |
a6214385 | 395 | __stop___tracepoints_ptrs = .; \ |
97e1c18e | 396 | *(__tracepoints_strings)/* Tracepoints: strings */ \ |
1da177e4 LT |
397 | } \ |
398 | \ | |
399 | .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \ | |
400 | *(.rodata1) \ | |
401 | } \ | |
402 | \ | |
403 | /* PCI quirks */ \ | |
404 | .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \ | |
a6214385 | 405 | __start_pci_fixups_early = .; \ |
4b89b7f7 | 406 | KEEP(*(.pci_fixup_early)) \ |
a6214385 MY |
407 | __end_pci_fixups_early = .; \ |
408 | __start_pci_fixups_header = .; \ | |
4b89b7f7 | 409 | KEEP(*(.pci_fixup_header)) \ |
a6214385 MY |
410 | __end_pci_fixups_header = .; \ |
411 | __start_pci_fixups_final = .; \ | |
4b89b7f7 | 412 | KEEP(*(.pci_fixup_final)) \ |
a6214385 MY |
413 | __end_pci_fixups_final = .; \ |
414 | __start_pci_fixups_enable = .; \ | |
4b89b7f7 | 415 | KEEP(*(.pci_fixup_enable)) \ |
a6214385 MY |
416 | __end_pci_fixups_enable = .; \ |
417 | __start_pci_fixups_resume = .; \ | |
4b89b7f7 | 418 | KEEP(*(.pci_fixup_resume)) \ |
a6214385 MY |
419 | __end_pci_fixups_resume = .; \ |
420 | __start_pci_fixups_resume_early = .; \ | |
4b89b7f7 | 421 | KEEP(*(.pci_fixup_resume_early)) \ |
a6214385 MY |
422 | __end_pci_fixups_resume_early = .; \ |
423 | __start_pci_fixups_suspend = .; \ | |
4b89b7f7 | 424 | KEEP(*(.pci_fixup_suspend)) \ |
a6214385 MY |
425 | __end_pci_fixups_suspend = .; \ |
426 | __start_pci_fixups_suspend_late = .; \ | |
4b89b7f7 | 427 | KEEP(*(.pci_fixup_suspend_late)) \ |
a6214385 | 428 | __end_pci_fixups_suspend_late = .; \ |
1da177e4 LT |
429 | } \ |
430 | \ | |
5658c769 DW |
431 | /* Built-in firmware blobs */ \ |
432 | .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \ | |
a6214385 | 433 | __start_builtin_fw = .; \ |
4b89b7f7 | 434 | KEEP(*(.builtin_fw)) \ |
a6214385 | 435 | __end_builtin_fw = .; \ |
5658c769 DW |
436 | } \ |
437 | \ | |
63687a52 JB |
438 | TRACEDATA \ |
439 | \ | |
1da177e4 LT |
440 | /* Kernel symbol table: Normal symbols */ \ |
441 | __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \ | |
a6214385 | 442 | __start___ksymtab = .; \ |
b67067f1 | 443 | KEEP(*(SORT(___ksymtab+*))) \ |
a6214385 | 444 | __stop___ksymtab = .; \ |
1da177e4 LT |
445 | } \ |
446 | \ | |
447 | /* Kernel symbol table: GPL-only symbols */ \ | |
448 | __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \ | |
a6214385 | 449 | __start___ksymtab_gpl = .; \ |
b67067f1 | 450 | KEEP(*(SORT(___ksymtab_gpl+*))) \ |
a6214385 | 451 | __stop___ksymtab_gpl = .; \ |
1da177e4 LT |
452 | } \ |
453 | \ | |
f71d20e9 AV |
454 | /* Kernel symbol table: Normal unused symbols */ \ |
455 | __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \ | |
a6214385 | 456 | __start___ksymtab_unused = .; \ |
b67067f1 | 457 | KEEP(*(SORT(___ksymtab_unused+*))) \ |
a6214385 | 458 | __stop___ksymtab_unused = .; \ |
f71d20e9 AV |
459 | } \ |
460 | \ | |
461 | /* Kernel symbol table: GPL-only unused symbols */ \ | |
462 | __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \ | |
a6214385 | 463 | __start___ksymtab_unused_gpl = .; \ |
b67067f1 | 464 | KEEP(*(SORT(___ksymtab_unused_gpl+*))) \ |
a6214385 | 465 | __stop___ksymtab_unused_gpl = .; \ |
f71d20e9 AV |
466 | } \ |
467 | \ | |
9f28bb7e GKH |
468 | /* Kernel symbol table: GPL-future-only symbols */ \ |
469 | __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \ | |
a6214385 | 470 | __start___ksymtab_gpl_future = .; \ |
b67067f1 | 471 | KEEP(*(SORT(___ksymtab_gpl_future+*))) \ |
a6214385 | 472 | __stop___ksymtab_gpl_future = .; \ |
9f28bb7e GKH |
473 | } \ |
474 | \ | |
1da177e4 LT |
475 | /* Kernel symbol table: Normal symbols */ \ |
476 | __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \ | |
a6214385 | 477 | __start___kcrctab = .; \ |
b67067f1 | 478 | KEEP(*(SORT(___kcrctab+*))) \ |
a6214385 | 479 | __stop___kcrctab = .; \ |
1da177e4 LT |
480 | } \ |
481 | \ | |
482 | /* Kernel symbol table: GPL-only symbols */ \ | |
483 | __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \ | |
a6214385 | 484 | __start___kcrctab_gpl = .; \ |
b67067f1 | 485 | KEEP(*(SORT(___kcrctab_gpl+*))) \ |
a6214385 | 486 | __stop___kcrctab_gpl = .; \ |
1da177e4 LT |
487 | } \ |
488 | \ | |
f71d20e9 AV |
489 | /* Kernel symbol table: Normal unused symbols */ \ |
490 | __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \ | |
a6214385 | 491 | __start___kcrctab_unused = .; \ |
b67067f1 | 492 | KEEP(*(SORT(___kcrctab_unused+*))) \ |
a6214385 | 493 | __stop___kcrctab_unused = .; \ |
f71d20e9 AV |
494 | } \ |
495 | \ | |
496 | /* Kernel symbol table: GPL-only unused symbols */ \ | |
497 | __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \ | |
a6214385 | 498 | __start___kcrctab_unused_gpl = .; \ |
b67067f1 | 499 | KEEP(*(SORT(___kcrctab_unused_gpl+*))) \ |
a6214385 | 500 | __stop___kcrctab_unused_gpl = .; \ |
f71d20e9 AV |
501 | } \ |
502 | \ | |
9f28bb7e GKH |
503 | /* Kernel symbol table: GPL-future-only symbols */ \ |
504 | __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \ | |
a6214385 | 505 | __start___kcrctab_gpl_future = .; \ |
b67067f1 | 506 | KEEP(*(SORT(___kcrctab_gpl_future+*))) \ |
a6214385 | 507 | __stop___kcrctab_gpl_future = .; \ |
9f28bb7e GKH |
508 | } \ |
509 | \ | |
1da177e4 LT |
510 | /* Kernel symbol table: strings */ \ |
511 | __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \ | |
4b89b7f7 | 512 | *(__ksymtab_strings) \ |
1da177e4 LT |
513 | } \ |
514 | \ | |
eb8f6890 SR |
515 | /* __*init sections */ \ |
516 | __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \ | |
312b1485 | 517 | *(.ref.rodata) \ |
eb8f6890 SR |
518 | MEM_KEEP(init.rodata) \ |
519 | MEM_KEEP(exit.rodata) \ | |
520 | } \ | |
521 | \ | |
1da177e4 LT |
522 | /* Built-in module parameters. */ \ |
523 | __param : AT(ADDR(__param) - LOAD_OFFSET) { \ | |
a6214385 | 524 | __start___param = .; \ |
4b89b7f7 | 525 | KEEP(*(__param)) \ |
a6214385 | 526 | __stop___param = .; \ |
e94965ed DT |
527 | } \ |
528 | \ | |
529 | /* Built-in module versions. */ \ | |
530 | __modver : AT(ADDR(__modver) - LOAD_OFFSET) { \ | |
a6214385 | 531 | __start___modver = .; \ |
4b89b7f7 | 532 | KEEP(*(__modver)) \ |
a6214385 | 533 | __stop___modver = .; \ |
7583ddfd | 534 | } \ |
eaf93707 | 535 | \ |
b8c2f776 | 536 | RO_EXCEPTION_TABLE \ |
eaf93707 | 537 | NOTES \ |
90ceddcb | 538 | BTF \ |
eaf93707 KC |
539 | \ |
540 | . = ALIGN((align)); \ | |
541 | __end_rodata = .; | |
1da177e4 | 542 | |
65538966 TG |
543 | /* |
544 | * Non-instrumentable text section | |
545 | */ | |
546 | #define NOINSTR_TEXT \ | |
547 | ALIGN_FUNCTION(); \ | |
548 | __noinstr_text_start = .; \ | |
549 | *(.noinstr.text) \ | |
550 | __noinstr_text_end = .; | |
551 | ||
cb87481e NP |
552 | /* |
553 | * .text section. Map to function alignment to avoid address changes | |
0f4c4af0 | 554 | * during second ld run in second ld pass when generating System.map |
cb87481e NP |
555 | * |
556 | * TEXT_MAIN here will match .text.fixup and .text.unlikely if dead | |
557 | * code elimination is enabled, so these sections should be converted | |
558 | * to use ".." first. | |
559 | */ | |
7664709b SR |
560 | #define TEXT_TEXT \ |
561 | ALIGN_FUNCTION(); \ | |
cb87481e | 562 | *(.text.hot TEXT_MAIN .text.fixup .text.unlikely) \ |
65538966 | 563 | NOINSTR_TEXT \ |
564c9cc8 | 564 | *(.text..refcount) \ |
312b1485 | 565 | *(.ref.text) \ |
266ff2a8 NP |
566 | MEM_KEEP(init.text*) \ |
567 | MEM_KEEP(exit.text*) \ | |
eb8f6890 | 568 | |
7664709b | 569 | |
6d30e3a8 SR |
570 | /* sched.text is aling to function alignment to secure we have same |
571 | * address even at second ld pass when generating System.map */ | |
1da177e4 | 572 | #define SCHED_TEXT \ |
6d30e3a8 | 573 | ALIGN_FUNCTION(); \ |
a6214385 | 574 | __sched_text_start = .; \ |
1da177e4 | 575 | *(.sched.text) \ |
a6214385 | 576 | __sched_text_end = .; |
1da177e4 | 577 | |
6d30e3a8 SR |
578 | /* spinlock.text is aling to function alignment to secure we have same |
579 | * address even at second ld pass when generating System.map */ | |
1da177e4 | 580 | #define LOCK_TEXT \ |
6d30e3a8 | 581 | ALIGN_FUNCTION(); \ |
a6214385 | 582 | __lock_text_start = .; \ |
1da177e4 | 583 | *(.spinlock.text) \ |
a6214385 | 584 | __lock_text_end = .; |
d0aaff97 | 585 | |
6727ad9e CM |
586 | #define CPUIDLE_TEXT \ |
587 | ALIGN_FUNCTION(); \ | |
a6214385 | 588 | __cpuidle_text_start = .; \ |
6727ad9e | 589 | *(.cpuidle.text) \ |
a6214385 | 590 | __cpuidle_text_end = .; |
6727ad9e | 591 | |
d0aaff97 PP |
592 | #define KPROBES_TEXT \ |
593 | ALIGN_FUNCTION(); \ | |
a6214385 | 594 | __kprobes_text_start = .; \ |
d0aaff97 | 595 | *(.kprobes.text) \ |
a6214385 | 596 | __kprobes_text_end = .; |
a7d0c210 | 597 | |
ea714547 JO |
598 | #define ENTRY_TEXT \ |
599 | ALIGN_FUNCTION(); \ | |
a6214385 | 600 | __entry_text_start = .; \ |
ea714547 | 601 | *(.entry.text) \ |
a6214385 | 602 | __entry_text_end = .; |
ea714547 | 603 | |
a0343e82 FW |
604 | #define IRQENTRY_TEXT \ |
605 | ALIGN_FUNCTION(); \ | |
a6214385 | 606 | __irqentry_text_start = .; \ |
a0343e82 | 607 | *(.irqentry.text) \ |
a6214385 | 608 | __irqentry_text_end = .; |
a0343e82 | 609 | |
be7635e7 AP |
610 | #define SOFTIRQENTRY_TEXT \ |
611 | ALIGN_FUNCTION(); \ | |
a6214385 | 612 | __softirqentry_text_start = .; \ |
be7635e7 | 613 | *(.softirqentry.text) \ |
a6214385 | 614 | __softirqentry_text_end = .; |
be7635e7 | 615 | |
37c514e3 | 616 | /* Section used for early init (in .S files) */ |
266ff2a8 | 617 | #define HEAD_TEXT KEEP(*(.head.text)) |
37c514e3 | 618 | |
7923f90f | 619 | #define HEAD_TEXT_SECTION \ |
ef53dae8 SR |
620 | .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \ |
621 | HEAD_TEXT \ | |
622 | } | |
623 | ||
624 | /* | |
625 | * Exception table | |
626 | */ | |
627 | #define EXCEPTION_TABLE(align) \ | |
628 | . = ALIGN(align); \ | |
629 | __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \ | |
a6214385 | 630 | __start___ex_table = .; \ |
4b89b7f7 | 631 | KEEP(*(__ex_table)) \ |
a6214385 | 632 | __stop___ex_table = .; \ |
ef53dae8 SR |
633 | } |
634 | ||
90ceddcb FS |
635 | /* |
636 | * .BTF | |
637 | */ | |
638 | #ifdef CONFIG_DEBUG_INFO_BTF | |
639 | #define BTF \ | |
640 | .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { \ | |
641 | __start_BTF = .; \ | |
642 | *(.BTF) \ | |
643 | __stop_BTF = .; \ | |
644 | } | |
645 | #else | |
646 | #define BTF | |
647 | #endif | |
648 | ||
ef53dae8 SR |
649 | /* |
650 | * Init task | |
651 | */ | |
39a449d9 | 652 | #define INIT_TASK_DATA_SECTION(align) \ |
ef53dae8 | 653 | . = ALIGN(align); \ |
da5e37ef | 654 | .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \ |
39a449d9 | 655 | INIT_TASK_DATA(align) \ |
ef53dae8 | 656 | } |
37c514e3 | 657 | |
b99b87f7 | 658 | #ifdef CONFIG_CONSTRUCTORS |
2a2325e6 | 659 | #define KERNEL_CTORS() . = ALIGN(8); \ |
a6214385 | 660 | __ctors_start = .; \ |
4b89b7f7 NP |
661 | KEEP(*(.ctors)) \ |
662 | KEEP(*(SORT(.init_array.*))) \ | |
663 | KEEP(*(.init_array)) \ | |
a6214385 | 664 | __ctors_end = .; |
b99b87f7 PO |
665 | #else |
666 | #define KERNEL_CTORS() | |
667 | #endif | |
668 | ||
01ba2bdc | 669 | /* init and exit section handling */ |
eb8f6890 | 670 | #define INIT_DATA \ |
b67067f1 | 671 | KEEP(*(SORT(___kentry+*))) \ |
266ff2a8 NP |
672 | *(.init.data init.data.*) \ |
673 | MEM_DISCARD(init.data*) \ | |
b99b87f7 | 674 | KERNEL_CTORS() \ |
4b3b4c5e | 675 | MCOUNT_REC() \ |
266ff2a8 | 676 | *(.init.rodata .init.rodata.*) \ |
e4a9ea5e | 677 | FTRACE_EVENTS() \ |
3d56e331 | 678 | TRACE_SYSCALLS() \ |
376e2424 | 679 | KPROBE_BLACKLIST() \ |
540adea3 | 680 | ERROR_INJECT_WHITELIST() \ |
aab94339 | 681 | MEM_DISCARD(init.rodata) \ |
f2f6c255 | 682 | CLK_OF_TABLES() \ |
f618c470 | 683 | RESERVEDMEM_OF_TABLES() \ |
2fcc112a | 684 | TIMER_OF_TABLES() \ |
6c3ff8b1 | 685 | CPU_METHOD_OF_TABLES() \ |
449e056c | 686 | CPUIDLE_METHOD_OF_TABLES() \ |
f6e916b8 | 687 | KERNEL_DTB() \ |
b0b6abd3 | 688 | IRQCHIP_OF_MATCH_TABLE() \ |
46e589a3 | 689 | ACPI_PROBE_TABLE(irqchip) \ |
2fcc112a | 690 | ACPI_PROBE_TABLE(timer) \ |
980af75e | 691 | THERMAL_TABLE(governor) \ |
3ac946d1 | 692 | EARLYCON_TABLE() \ |
e6b1db98 MG |
693 | LSM_TABLE() \ |
694 | EARLY_LSM_TABLE() | |
eb8f6890 SR |
695 | |
696 | #define INIT_TEXT \ | |
266ff2a8 | 697 | *(.init.text .init.text.*) \ |
e41f501d | 698 | *(.text.startup) \ |
266ff2a8 | 699 | MEM_DISCARD(init.text*) |
eb8f6890 SR |
700 | |
701 | #define EXIT_DATA \ | |
266ff2a8 | 702 | *(.exit.data .exit.data.*) \ |
8dcf86ca PO |
703 | *(.fini_array .fini_array.*) \ |
704 | *(.dtors .dtors.*) \ | |
266ff2a8 NP |
705 | MEM_DISCARD(exit.data*) \ |
706 | MEM_DISCARD(exit.rodata*) | |
01ba2bdc | 707 | |
eb8f6890 SR |
708 | #define EXIT_TEXT \ |
709 | *(.exit.text) \ | |
e41f501d | 710 | *(.text.exit) \ |
eb8f6890 | 711 | MEM_DISCARD(exit.text) |
01ba2bdc | 712 | |
7923f90f SR |
713 | #define EXIT_CALL \ |
714 | *(.exitcall.exit) | |
715 | ||
ef53dae8 SR |
716 | /* |
717 | * bss (Block Started by Symbol) - uninitialized data | |
718 | * zeroed during startup | |
719 | */ | |
04e448d9 TA |
720 | #define SBSS(sbss_align) \ |
721 | . = ALIGN(sbss_align); \ | |
ef53dae8 | 722 | .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \ |
83a092cf | 723 | *(.dynsbss) \ |
266ff2a8 | 724 | *(SBSS_MAIN) \ |
ef53dae8 SR |
725 | *(.scommon) \ |
726 | } | |
727 | ||
c87728ca DD |
728 | /* |
729 | * Allow archectures to redefine BSS_FIRST_SECTIONS to add extra | |
730 | * sections to the front of bss. | |
731 | */ | |
732 | #ifndef BSS_FIRST_SECTIONS | |
733 | #define BSS_FIRST_SECTIONS | |
734 | #endif | |
735 | ||
ef53dae8 SR |
736 | #define BSS(bss_align) \ |
737 | . = ALIGN(bss_align); \ | |
738 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \ | |
c87728ca | 739 | BSS_FIRST_SECTIONS \ |
7c74df07 | 740 | *(.bss..page_aligned) \ |
ef53dae8 | 741 | *(.dynbss) \ |
cb87481e | 742 | *(BSS_MAIN) \ |
ef53dae8 | 743 | *(COMMON) \ |
ef53dae8 SR |
744 | } |
745 | ||
746 | /* | |
747 | * DWARF debug sections. | |
748 | * Symbols in the DWARF debugging sections are relative to | |
749 | * the beginning of the section so we begin them at 0. | |
750 | */ | |
a7d0c210 PBG |
751 | #define DWARF_DEBUG \ |
752 | /* DWARF 1 */ \ | |
753 | .debug 0 : { *(.debug) } \ | |
754 | .line 0 : { *(.line) } \ | |
755 | /* GNU DWARF 1 extensions */ \ | |
756 | .debug_srcinfo 0 : { *(.debug_srcinfo) } \ | |
757 | .debug_sfnames 0 : { *(.debug_sfnames) } \ | |
758 | /* DWARF 1.1 and DWARF 2 */ \ | |
759 | .debug_aranges 0 : { *(.debug_aranges) } \ | |
760 | .debug_pubnames 0 : { *(.debug_pubnames) } \ | |
761 | /* DWARF 2 */ \ | |
762 | .debug_info 0 : { *(.debug_info \ | |
763 | .gnu.linkonce.wi.*) } \ | |
764 | .debug_abbrev 0 : { *(.debug_abbrev) } \ | |
765 | .debug_line 0 : { *(.debug_line) } \ | |
766 | .debug_frame 0 : { *(.debug_frame) } \ | |
767 | .debug_str 0 : { *(.debug_str) } \ | |
768 | .debug_loc 0 : { *(.debug_loc) } \ | |
769 | .debug_macinfo 0 : { *(.debug_macinfo) } \ | |
83a092cf NP |
770 | .debug_pubtypes 0 : { *(.debug_pubtypes) } \ |
771 | /* DWARF 3 */ \ | |
772 | .debug_ranges 0 : { *(.debug_ranges) } \ | |
a7d0c210 PBG |
773 | /* SGI/MIPS DWARF 2 extensions */ \ |
774 | .debug_weaknames 0 : { *(.debug_weaknames) } \ | |
775 | .debug_funcnames 0 : { *(.debug_funcnames) } \ | |
776 | .debug_typenames 0 : { *(.debug_typenames) } \ | |
777 | .debug_varnames 0 : { *(.debug_varnames) } \ | |
83a092cf NP |
778 | /* GNU DWARF 2 extensions */ \ |
779 | .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } \ | |
780 | .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } \ | |
781 | /* DWARF 4 */ \ | |
782 | .debug_types 0 : { *(.debug_types) } \ | |
783 | /* DWARF 5 */ \ | |
784 | .debug_macro 0 : { *(.debug_macro) } \ | |
785 | .debug_addr 0 : { *(.debug_addr) } | |
a7d0c210 PBG |
786 | |
787 | /* Stabs debugging sections. */ | |
788 | #define STABS_DEBUG \ | |
789 | .stab 0 : { *(.stab) } \ | |
790 | .stabstr 0 : { *(.stabstr) } \ | |
791 | .stab.excl 0 : { *(.stab.excl) } \ | |
792 | .stab.exclstr 0 : { *(.stab.exclstr) } \ | |
793 | .stab.index 0 : { *(.stab.index) } \ | |
794 | .stab.indexstr 0 : { *(.stab.indexstr) } \ | |
795 | .comment 0 : { *(.comment) } | |
9c9b8b38 | 796 | |
6360b1fb | 797 | #ifdef CONFIG_GENERIC_BUG |
7664c5a1 JF |
798 | #define BUG_TABLE \ |
799 | . = ALIGN(8); \ | |
800 | __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \ | |
a6214385 | 801 | __start___bug_table = .; \ |
4b89b7f7 | 802 | KEEP(*(__bug_table)) \ |
a6214385 | 803 | __stop___bug_table = .; \ |
7664c5a1 | 804 | } |
6360b1fb JB |
805 | #else |
806 | #define BUG_TABLE | |
807 | #endif | |
7664c5a1 | 808 | |
11af8474 | 809 | #ifdef CONFIG_UNWINDER_ORC |
ee9f8fce JP |
810 | #define ORC_UNWIND_TABLE \ |
811 | . = ALIGN(4); \ | |
812 | .orc_unwind_ip : AT(ADDR(.orc_unwind_ip) - LOAD_OFFSET) { \ | |
a6214385 | 813 | __start_orc_unwind_ip = .; \ |
ee9f8fce | 814 | KEEP(*(.orc_unwind_ip)) \ |
a6214385 | 815 | __stop_orc_unwind_ip = .; \ |
ee9f8fce | 816 | } \ |
f76a16ad | 817 | . = ALIGN(2); \ |
ee9f8fce | 818 | .orc_unwind : AT(ADDR(.orc_unwind) - LOAD_OFFSET) { \ |
a6214385 | 819 | __start_orc_unwind = .; \ |
ee9f8fce | 820 | KEEP(*(.orc_unwind)) \ |
a6214385 | 821 | __stop_orc_unwind = .; \ |
ee9f8fce JP |
822 | } \ |
823 | . = ALIGN(4); \ | |
824 | .orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \ | |
a6214385 | 825 | orc_lookup = .; \ |
ee9f8fce JP |
826 | . += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) / \ |
827 | LOOKUP_BLOCK_SIZE) + 1) * 4; \ | |
a6214385 | 828 | orc_lookup_end = .; \ |
ee9f8fce JP |
829 | } |
830 | #else | |
831 | #define ORC_UNWIND_TABLE | |
832 | #endif | |
833 | ||
63687a52 JB |
834 | #ifdef CONFIG_PM_TRACE |
835 | #define TRACEDATA \ | |
836 | . = ALIGN(4); \ | |
837 | .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \ | |
a6214385 | 838 | __tracedata_start = .; \ |
4b89b7f7 | 839 | KEEP(*(.tracedata)) \ |
a6214385 | 840 | __tracedata_end = .; \ |
63687a52 JB |
841 | } |
842 | #else | |
843 | #define TRACEDATA | |
844 | #endif | |
845 | ||
9c9b8b38 | 846 | #define NOTES \ |
cbe87121 | 847 | .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \ |
a6214385 | 848 | __start_notes = .; \ |
266ff2a8 | 849 | KEEP(*(.note.*)) \ |
a6214385 | 850 | __stop_notes = .; \ |
fbe6a8e6 KC |
851 | } NOTES_HEADERS \ |
852 | NOTES_HEADERS_RESTORE | |
61ce1efe | 853 | |
ef53dae8 SR |
854 | #define INIT_SETUP(initsetup_align) \ |
855 | . = ALIGN(initsetup_align); \ | |
a6214385 | 856 | __setup_start = .; \ |
4b89b7f7 | 857 | KEEP(*(.init.setup)) \ |
a6214385 | 858 | __setup_end = .; |
ef53dae8 | 859 | |
026cee00 | 860 | #define INIT_CALLS_LEVEL(level) \ |
a6214385 | 861 | __initcall##level##_start = .; \ |
b67067f1 NP |
862 | KEEP(*(.initcall##level##.init)) \ |
863 | KEEP(*(.initcall##level##s.init)) \ | |
61ce1efe | 864 | |
ef53dae8 | 865 | #define INIT_CALLS \ |
a6214385 | 866 | __initcall_start = .; \ |
b67067f1 | 867 | KEEP(*(.initcallearly.init)) \ |
026cee00 PM |
868 | INIT_CALLS_LEVEL(0) \ |
869 | INIT_CALLS_LEVEL(1) \ | |
870 | INIT_CALLS_LEVEL(2) \ | |
871 | INIT_CALLS_LEVEL(3) \ | |
872 | INIT_CALLS_LEVEL(4) \ | |
873 | INIT_CALLS_LEVEL(5) \ | |
874 | INIT_CALLS_LEVEL(rootfs) \ | |
875 | INIT_CALLS_LEVEL(6) \ | |
876 | INIT_CALLS_LEVEL(7) \ | |
a6214385 | 877 | __initcall_end = .; |
ef53dae8 SR |
878 | |
879 | #define CON_INITCALL \ | |
a6214385 | 880 | __con_initcall_start = .; \ |
b67067f1 | 881 | KEEP(*(.con_initcall.init)) \ |
a6214385 | 882 | __con_initcall_end = .; |
ef53dae8 | 883 | |
ef53dae8 SR |
884 | #ifdef CONFIG_BLK_DEV_INITRD |
885 | #define INIT_RAM_FS \ | |
d8826262 | 886 | . = ALIGN(4); \ |
a6214385 | 887 | __initramfs_start = .; \ |
b67067f1 | 888 | KEEP(*(.init.ramfs)) \ |
ffe8018c | 889 | . = ALIGN(8); \ |
b67067f1 | 890 | KEEP(*(.init.ramfs.info)) |
ef53dae8 | 891 | #else |
eadfe219 | 892 | #define INIT_RAM_FS |
ef53dae8 SR |
893 | #endif |
894 | ||
ac26963a BS |
895 | /* |
896 | * Memory encryption operates on a page basis. Since we need to clear | |
897 | * the memory encryption mask for this section, it needs to be aligned | |
898 | * on a page boundary and be a page-size multiple in length. | |
899 | * | |
900 | * Note: We use a separate section so that only this section gets | |
901 | * decrypted to avoid exposing more than we wish. | |
902 | */ | |
903 | #ifdef CONFIG_AMD_MEM_ENCRYPT | |
904 | #define PERCPU_DECRYPTED_SECTION \ | |
905 | . = ALIGN(PAGE_SIZE); \ | |
906 | *(.data..percpu..decrypted) \ | |
907 | . = ALIGN(PAGE_SIZE); | |
908 | #else | |
909 | #define PERCPU_DECRYPTED_SECTION | |
910 | #endif | |
911 | ||
912 | ||
023bf6f1 TH |
913 | /* |
914 | * Default discarded sections. | |
915 | * | |
916 | * Some archs want to discard exit text/data at runtime rather than | |
917 | * link time due to cross-section references such as alt instructions, | |
918 | * bug table, eh_frame, etc. DISCARDS must be the last of output | |
919 | * section definitions so that such archs put those in earlier section | |
920 | * definitions. | |
921 | */ | |
84d5f77f L |
922 | #ifdef RUNTIME_DISCARD_EXIT |
923 | #define EXIT_DISCARDS | |
924 | #else | |
925 | #define EXIT_DISCARDS \ | |
926 | EXIT_TEXT \ | |
927 | EXIT_DATA | |
928 | #endif | |
929 | ||
405d967d TH |
930 | #define DISCARDS \ |
931 | /DISCARD/ : { \ | |
84d5f77f | 932 | EXIT_DISCARDS \ |
023bf6f1 | 933 | EXIT_CALL \ |
405d967d | 934 | *(.discard) \ |
c7f52cdc | 935 | *(.discard.*) \ |
898490c0 | 936 | *(.modinfo) \ |
405d967d TH |
937 | } |
938 | ||
6ea0c34d MF |
939 | /** |
940 | * PERCPU_INPUT - the percpu input sections | |
941 | * @cacheline: cacheline size | |
942 | * | |
943 | * The core percpu section names and core symbols which do not rely | |
944 | * directly upon load addresses. | |
945 | * | |
946 | * @cacheline is used to align subsections to avoid false cacheline | |
947 | * sharing between subsections for different purposes. | |
948 | */ | |
949 | #define PERCPU_INPUT(cacheline) \ | |
a6214385 | 950 | __per_cpu_start = .; \ |
6ea0c34d MF |
951 | *(.data..percpu..first) \ |
952 | . = ALIGN(PAGE_SIZE); \ | |
953 | *(.data..percpu..page_aligned) \ | |
954 | . = ALIGN(cacheline); \ | |
330d2822 | 955 | *(.data..percpu..read_mostly) \ |
6ea0c34d MF |
956 | . = ALIGN(cacheline); \ |
957 | *(.data..percpu) \ | |
958 | *(.data..percpu..shared_aligned) \ | |
ac26963a | 959 | PERCPU_DECRYPTED_SECTION \ |
a6214385 | 960 | __per_cpu_end = .; |
6ea0c34d | 961 | |
3e5d8f97 | 962 | /** |
6b7c38d5 | 963 | * PERCPU_VADDR - define output section for percpu area |
19df0c2f | 964 | * @cacheline: cacheline size |
3e5d8f97 TH |
965 | * @vaddr: explicit base address (optional) |
966 | * @phdr: destination PHDR (optional) | |
967 | * | |
19df0c2f TH |
968 | * Macro which expands to output section for percpu area. |
969 | * | |
970 | * @cacheline is used to align subsections to avoid false cacheline | |
971 | * sharing between subsections for different purposes. | |
972 | * | |
973 | * If @vaddr is not blank, it specifies explicit base address and all | |
974 | * percpu symbols will be offset from the given address. If blank, | |
975 | * @vaddr always equals @laddr + LOAD_OFFSET. | |
3e5d8f97 TH |
976 | * |
977 | * @phdr defines the output PHDR to use if not blank. Be warned that | |
978 | * output PHDR is sticky. If @phdr is specified, the next output | |
979 | * section in the linker script will go there too. @phdr should have | |
980 | * a leading colon. | |
981 | * | |
3ac6cffe TH |
982 | * Note that this macros defines __per_cpu_load as an absolute symbol. |
983 | * If there is no need to put the percpu section at a predetermined | |
0415b00d | 984 | * address, use PERCPU_SECTION. |
3e5d8f97 | 985 | */ |
19df0c2f | 986 | #define PERCPU_VADDR(cacheline, vaddr, phdr) \ |
a6214385 MY |
987 | __per_cpu_load = .; \ |
988 | .data..percpu vaddr : AT(__per_cpu_load - LOAD_OFFSET) { \ | |
6ea0c34d | 989 | PERCPU_INPUT(cacheline) \ |
6b7c38d5 | 990 | } phdr \ |
a6214385 | 991 | . = __per_cpu_load + SIZEOF(.data..percpu); |
3e5d8f97 TH |
992 | |
993 | /** | |
0415b00d | 994 | * PERCPU_SECTION - define output section for percpu area, simple version |
19df0c2f | 995 | * @cacheline: cacheline size |
3e5d8f97 | 996 | * |
0415b00d TH |
997 | * Align to PAGE_SIZE and outputs output section for percpu area. This |
998 | * macro doesn't manipulate @vaddr or @phdr and __per_cpu_load and | |
3e5d8f97 | 999 | * __per_cpu_start will be identical. |
3ac6cffe | 1000 | * |
0415b00d | 1001 | * This macro is equivalent to ALIGN(PAGE_SIZE); PERCPU_VADDR(@cacheline,,) |
19df0c2f TH |
1002 | * except that __per_cpu_load is defined as a relative symbol against |
1003 | * .data..percpu which is required for relocatable x86_32 configuration. | |
3e5d8f97 | 1004 | */ |
0415b00d TH |
1005 | #define PERCPU_SECTION(cacheline) \ |
1006 | . = ALIGN(PAGE_SIZE); \ | |
3d9a854c | 1007 | .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \ |
a6214385 | 1008 | __per_cpu_load = .; \ |
6ea0c34d | 1009 | PERCPU_INPUT(cacheline) \ |
3ac6cffe | 1010 | } |
ef53dae8 SR |
1011 | |
1012 | ||
1013 | /* | |
1014 | * Definition of the high level *_SECTION macros | |
1015 | * They will fit only a subset of the architectures | |
1016 | */ | |
1017 | ||
1018 | ||
1019 | /* | |
1020 | * Writeable data. | |
1021 | * All sections are combined in a single .data section. | |
1022 | * The sections following CONSTRUCTORS are arranged so their | |
1023 | * typical alignment matches. | |
1024 | * A cacheline is typical/always less than a PAGE_SIZE so | |
1025 | * the sections that has this restriction (or similar) | |
1026 | * is located before the ones requiring PAGE_SIZE alignment. | |
1027 | * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which | |
25985edc | 1028 | * matches the requirement of PAGE_ALIGNED_DATA. |
ef53dae8 | 1029 | * |
7923f90f | 1030 | * use 0 as page_align if page_aligned data is not used */ |
c9174047 | 1031 | #define RW_DATA(cacheline, pagealigned, inittask) \ |
ef53dae8 SR |
1032 | . = ALIGN(PAGE_SIZE); \ |
1033 | .data : AT(ADDR(.data) - LOAD_OFFSET) { \ | |
39a449d9 | 1034 | INIT_TASK_DATA(inittask) \ |
1b208622 TA |
1035 | NOSAVE_DATA \ |
1036 | PAGE_ALIGNED_DATA(pagealigned) \ | |
ef53dae8 SR |
1037 | CACHELINE_ALIGNED_DATA(cacheline) \ |
1038 | READ_MOSTLY_DATA(cacheline) \ | |
1039 | DATA_DATA \ | |
1040 | CONSTRUCTORS \ | |
19d43626 | 1041 | } \ |
ee9f8fce | 1042 | BUG_TABLE \ |
ef53dae8 SR |
1043 | |
1044 | #define INIT_TEXT_SECTION(inittext_align) \ | |
1045 | . = ALIGN(inittext_align); \ | |
1046 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \ | |
a6214385 | 1047 | _sinittext = .; \ |
ef53dae8 | 1048 | INIT_TEXT \ |
a6214385 | 1049 | _einittext = .; \ |
ef53dae8 SR |
1050 | } |
1051 | ||
1052 | #define INIT_DATA_SECTION(initsetup_align) \ | |
1053 | .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \ | |
1054 | INIT_DATA \ | |
1055 | INIT_SETUP(initsetup_align) \ | |
1056 | INIT_CALLS \ | |
1057 | CON_INITCALL \ | |
ef53dae8 SR |
1058 | INIT_RAM_FS \ |
1059 | } | |
1060 | ||
04e448d9 TA |
1061 | #define BSS_SECTION(sbss_align, bss_align, stop_align) \ |
1062 | . = ALIGN(sbss_align); \ | |
a6214385 | 1063 | __bss_start = .; \ |
04e448d9 | 1064 | SBSS(sbss_align) \ |
ef53dae8 | 1065 | BSS(bss_align) \ |
04e448d9 | 1066 | . = ALIGN(stop_align); \ |
a6214385 | 1067 | __bss_stop = .; |