.. | .. |
---|
4 | 4 | #else |
---|
5 | 5 | #define PROVIDE32(x) PROVIDE(x) |
---|
6 | 6 | #endif |
---|
| 7 | + |
---|
| 8 | +#define BSS_FIRST_SECTIONS *(.bss.prominit) |
---|
| 9 | +#define EMITS_PT_NOTE |
---|
| 10 | +#define RO_EXCEPTION_TABLE_ALIGN 0 |
---|
| 11 | + |
---|
7 | 12 | #include <asm/page.h> |
---|
8 | 13 | #include <asm-generic/vmlinux.lds.h> |
---|
9 | 14 | #include <asm/cache.h> |
---|
10 | 15 | #include <asm/thread_info.h> |
---|
11 | 16 | |
---|
12 | | -#if defined(CONFIG_STRICT_KERNEL_RWX) && !defined(CONFIG_PPC32) |
---|
13 | | -#define STRICT_ALIGN_SIZE (1 << 24) |
---|
14 | | -#else |
---|
15 | | -#define STRICT_ALIGN_SIZE PAGE_SIZE |
---|
16 | | -#endif |
---|
| 17 | +#define STRICT_ALIGN_SIZE (1 << CONFIG_DATA_SHIFT) |
---|
17 | 18 | |
---|
18 | 19 | ENTRY(_stext) |
---|
19 | 20 | |
---|
20 | 21 | PHDRS { |
---|
21 | | - kernel PT_LOAD FLAGS(7); /* RWX */ |
---|
22 | | - notes PT_NOTE FLAGS(0); |
---|
23 | | - dummy PT_NOTE FLAGS(0); |
---|
24 | | - |
---|
25 | | - /* binutils < 2.18 has a bug that makes it misbehave when taking an |
---|
26 | | - ELF file with all segments at load address 0 as input. This |
---|
27 | | - happens when running "strip" on vmlinux, because of the AT() magic |
---|
28 | | - in this linker script. People using GCC >= 4.2 won't run into |
---|
29 | | - this problem, because the "build-id" support will put some data |
---|
30 | | - into the "notes" segment (at a non-zero load address). |
---|
31 | | - |
---|
32 | | - To work around this, we force some data into both the "dummy" |
---|
33 | | - segment and the kernel segment, so the dummy segment will get a |
---|
34 | | - non-zero load address. It's not enough to always create the |
---|
35 | | - "notes" segment, since if nothing gets assigned to it, its load |
---|
36 | | - address will be zero. */ |
---|
| 22 | + text PT_LOAD FLAGS(7); /* RWX */ |
---|
| 23 | + note PT_NOTE FLAGS(0); |
---|
37 | 24 | } |
---|
38 | 25 | |
---|
39 | 26 | #ifdef CONFIG_PPC64 |
---|
.. | .. |
---|
77 | 64 | #else /* !CONFIG_PPC64 */ |
---|
78 | 65 | HEAD_TEXT |
---|
79 | 66 | #endif |
---|
80 | | - } :kernel |
---|
| 67 | + } :text |
---|
81 | 68 | |
---|
82 | 69 | __head_end = .; |
---|
83 | 70 | |
---|
84 | 71 | #ifdef CONFIG_PPC64 |
---|
85 | 72 | /* |
---|
86 | | - * BLOCK(0) overrides the default output section alignment because |
---|
| 73 | + * ALIGN(0) overrides the default output section alignment because |
---|
87 | 74 | * this needs to start right after .head.text in order for fixed |
---|
88 | 75 | * section placement to work. |
---|
89 | 76 | */ |
---|
90 | | - .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) { |
---|
| 77 | + .text ALIGN(0) : AT(ADDR(.text) - LOAD_OFFSET) { |
---|
91 | 78 | #ifdef CONFIG_LD_HEAD_STUB_CATCH |
---|
92 | 79 | KEEP(*(.linker_stub_catch)); |
---|
93 | 80 | . = . ; |
---|
.. | .. |
---|
98 | 85 | ALIGN_FUNCTION(); |
---|
99 | 86 | #endif |
---|
100 | 87 | /* careful! __ftr_alt_* sections need to be close to .text */ |
---|
101 | | - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text); |
---|
| 88 | + *(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely .text.unlikely.* .fixup __ftr_alt_* .ref.text); |
---|
| 89 | +#ifdef CONFIG_PPC64 |
---|
| 90 | + *(.tramp.ftrace.text); |
---|
| 91 | +#endif |
---|
102 | 92 | NOINSTR_TEXT |
---|
103 | 93 | SCHED_TEXT |
---|
104 | 94 | CPUIDLE_TEXT |
---|
.. | .. |
---|
124 | 114 | __got2_end = .; |
---|
125 | 115 | #endif /* CONFIG_PPC32 */ |
---|
126 | 116 | |
---|
127 | | - } :kernel |
---|
| 117 | + } :text |
---|
128 | 118 | |
---|
129 | 119 | . = ALIGN(PAGE_SIZE); |
---|
130 | 120 | _etext = .; |
---|
.. | .. |
---|
153 | 143 | __start___entry_flush_fixup = .; |
---|
154 | 144 | *(__entry_flush_fixup) |
---|
155 | 145 | __stop___entry_flush_fixup = .; |
---|
| 146 | + } |
---|
| 147 | + |
---|
| 148 | + . = ALIGN(8); |
---|
| 149 | + __scv_entry_flush_fixup : AT(ADDR(__scv_entry_flush_fixup) - LOAD_OFFSET) { |
---|
| 150 | + __start___scv_entry_flush_fixup = .; |
---|
| 151 | + *(__scv_entry_flush_fixup) |
---|
| 152 | + __stop___scv_entry_flush_fixup = .; |
---|
156 | 153 | } |
---|
157 | 154 | |
---|
158 | 155 | . = ALIGN(8); |
---|
.. | .. |
---|
187 | 184 | __stop__btb_flush_fixup = .; |
---|
188 | 185 | } |
---|
189 | 186 | #endif |
---|
190 | | - EXCEPTION_TABLE(0) |
---|
191 | | - |
---|
192 | | - NOTES :kernel :notes |
---|
193 | | - |
---|
194 | | - /* The dummy segment contents for the bug workaround mentioned above |
---|
195 | | - near PHDRS. */ |
---|
196 | | - .dummy : AT(ADDR(.dummy) - LOAD_OFFSET) { |
---|
197 | | - LONG(0) |
---|
198 | | - LONG(0) |
---|
199 | | - LONG(0) |
---|
200 | | - } :kernel :dummy |
---|
201 | 187 | |
---|
202 | 188 | /* |
---|
203 | 189 | * Init sections discarded at runtime |
---|
204 | 190 | */ |
---|
205 | 191 | . = ALIGN(STRICT_ALIGN_SIZE); |
---|
206 | 192 | __init_begin = .; |
---|
207 | | - INIT_TEXT_SECTION(PAGE_SIZE) :kernel |
---|
| 193 | + . = ALIGN(PAGE_SIZE); |
---|
| 194 | + .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { |
---|
| 195 | + _sinittext = .; |
---|
| 196 | + INIT_TEXT |
---|
| 197 | + |
---|
| 198 | + /* |
---|
| 199 | + *.init.text might be RO so we must ensure this section ends on |
---|
| 200 | + * a page boundary. |
---|
| 201 | + */ |
---|
| 202 | + . = ALIGN(PAGE_SIZE); |
---|
| 203 | + _einittext = .; |
---|
| 204 | +#ifdef CONFIG_PPC64 |
---|
| 205 | + *(.tramp.ftrace.init); |
---|
| 206 | +#endif |
---|
| 207 | + } :text |
---|
208 | 208 | |
---|
209 | 209 | /* .exit.text is discarded at runtime, not link time, |
---|
210 | 210 | * to deal with references from __bug_table |
---|
.. | .. |
---|
213 | 213 | EXIT_TEXT |
---|
214 | 214 | } |
---|
215 | 215 | |
---|
216 | | - .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { |
---|
217 | | - INIT_DATA |
---|
218 | | - __vtop_table_begin = .; |
---|
219 | | - KEEP(*(.vtop_fixup)); |
---|
220 | | - __vtop_table_end = .; |
---|
221 | | - __ptov_table_begin = .; |
---|
222 | | - KEEP(*(.ptov_fixup)); |
---|
223 | | - __ptov_table_end = .; |
---|
224 | | - } |
---|
| 216 | + . = ALIGN(PAGE_SIZE); |
---|
225 | 217 | |
---|
226 | | - .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) { |
---|
227 | | - INIT_SETUP(16) |
---|
228 | | - } |
---|
229 | | - |
---|
230 | | - .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) { |
---|
231 | | - INIT_CALLS |
---|
232 | | - } |
---|
233 | | - |
---|
234 | | - .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) { |
---|
235 | | - CON_INITCALL |
---|
236 | | - } |
---|
237 | | - |
---|
238 | | - SECURITY_INIT |
---|
| 218 | + INIT_DATA_SECTION(16) |
---|
239 | 219 | |
---|
240 | 220 | . = ALIGN(8); |
---|
241 | 221 | __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) { |
---|
.. | .. |
---|
263 | 243 | __stop___fw_ftr_fixup = .; |
---|
264 | 244 | } |
---|
265 | 245 | #endif |
---|
266 | | - .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { |
---|
267 | | - INIT_RAM_FS |
---|
268 | | - } |
---|
269 | 246 | |
---|
270 | 247 | PERCPU_SECTION(L1_CACHE_BYTES) |
---|
271 | 248 | |
---|
.. | .. |
---|
291 | 268 | *(.dynamic) |
---|
292 | 269 | } |
---|
293 | 270 | .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) } |
---|
| 271 | + .gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) } |
---|
294 | 272 | .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) } |
---|
295 | 273 | .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET) |
---|
296 | 274 | { |
---|
.. | .. |
---|
328 | 306 | *(.sdata2) |
---|
329 | 307 | *(.got.plt) *(.got) |
---|
330 | 308 | *(.plt) |
---|
| 309 | + *(.branch_lt) |
---|
331 | 310 | } |
---|
332 | 311 | #else |
---|
333 | 312 | .data : AT(ADDR(.data) - LOAD_OFFSET) { |
---|
334 | 313 | DATA_DATA |
---|
| 314 | +#ifdef CONFIG_UBSAN |
---|
| 315 | + *(.data..Lubsan_data*) |
---|
| 316 | + *(.data..Lubsan_type*) |
---|
| 317 | +#endif |
---|
335 | 318 | *(.data.rel*) |
---|
336 | 319 | *(.toc1) |
---|
337 | 320 | *(.branch_lt) |
---|
338 | 321 | } |
---|
339 | | - |
---|
340 | | -#ifdef CONFIG_DEBUG_INFO_BTF |
---|
341 | | - .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { |
---|
342 | | - *(.BTF) |
---|
343 | | - } |
---|
344 | | -#endif |
---|
345 | 322 | |
---|
346 | 323 | .opd : AT(ADDR(.opd) - LOAD_OFFSET) { |
---|
347 | 324 | __start_opd = .; |
---|
.. | .. |
---|
363 | 340 | #endif |
---|
364 | 341 | |
---|
365 | 342 | /* The initial task and kernel stack */ |
---|
366 | | - INIT_TASK_DATA_SECTION(THREAD_SIZE) |
---|
| 343 | + INIT_TASK_DATA_SECTION(THREAD_ALIGN) |
---|
367 | 344 | |
---|
368 | 345 | .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) { |
---|
369 | 346 | PAGE_ALIGNED_DATA(PAGE_SIZE) |
---|
.. | .. |
---|
399 | 376 | PROVIDE32 (end = .); |
---|
400 | 377 | |
---|
401 | 378 | STABS_DEBUG |
---|
402 | | - |
---|
403 | 379 | DWARF_DEBUG |
---|
| 380 | + ELF_DETAILS |
---|
404 | 381 | |
---|
405 | 382 | DISCARDS |
---|
406 | 383 | /DISCARD/ : { |
---|