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