hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/arch/powerpc/kernel/vmlinux.lds.S
....@@ -4,36 +4,24 @@
44 #else
55 #define PROVIDE32(x) PROVIDE(x)
66 #endif
7
+
8
+#define BSS_FIRST_SECTIONS *(.bss.prominit)
9
+#define EMITS_PT_NOTE
10
+#define RO_EXCEPTION_TABLE_ALIGN 0
11
+#define RUNTIME_DISCARD_EXIT
12
+
713 #include <asm/page.h>
814 #include <asm-generic/vmlinux.lds.h>
915 #include <asm/cache.h>
1016 #include <asm/thread_info.h>
1117
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
18
+#define STRICT_ALIGN_SIZE (1 << CONFIG_DATA_SHIFT)
1719
1820 ENTRY(_stext)
1921
2022 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. */
23
+ text PT_LOAD FLAGS(7); /* RWX */
24
+ note PT_NOTE FLAGS(0);
3725 }
3826
3927 #ifdef CONFIG_PPC64
....@@ -77,17 +65,17 @@
7765 #else /* !CONFIG_PPC64 */
7866 HEAD_TEXT
7967 #endif
80
- } :kernel
68
+ } :text
8169
8270 __head_end = .;
8371
8472 #ifdef CONFIG_PPC64
8573 /*
86
- * BLOCK(0) overrides the default output section alignment because
74
+ * ALIGN(0) overrides the default output section alignment because
8775 * this needs to start right after .head.text in order for fixed
8876 * section placement to work.
8977 */
90
- .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
78
+ .text ALIGN(0) : AT(ADDR(.text) - LOAD_OFFSET) {
9179 #ifdef CONFIG_LD_HEAD_STUB_CATCH
9280 KEEP(*(.linker_stub_catch));
9381 . = . ;
....@@ -98,7 +86,10 @@
9886 ALIGN_FUNCTION();
9987 #endif
10088 /* careful! __ftr_alt_* sections need to be close to .text */
101
- *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text);
89
+ *(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely .text.unlikely.* .fixup __ftr_alt_* .ref.text);
90
+#ifdef CONFIG_PPC64
91
+ *(.tramp.ftrace.text);
92
+#endif
10293 NOINSTR_TEXT
10394 SCHED_TEXT
10495 CPUIDLE_TEXT
....@@ -124,7 +115,7 @@
124115 __got2_end = .;
125116 #endif /* CONFIG_PPC32 */
126117
127
- } :kernel
118
+ } :text
128119
129120 . = ALIGN(PAGE_SIZE);
130121 _etext = .;
....@@ -153,6 +144,13 @@
153144 __start___entry_flush_fixup = .;
154145 *(__entry_flush_fixup)
155146 __stop___entry_flush_fixup = .;
147
+ }
148
+
149
+ . = ALIGN(8);
150
+ __scv_entry_flush_fixup : AT(ADDR(__scv_entry_flush_fixup) - LOAD_OFFSET) {
151
+ __start___scv_entry_flush_fixup = .;
152
+ *(__scv_entry_flush_fixup)
153
+ __stop___scv_entry_flush_fixup = .;
156154 }
157155
158156 . = ALIGN(8);
....@@ -187,24 +185,27 @@
187185 __stop__btb_flush_fixup = .;
188186 }
189187 #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
201188
202189 /*
203190 * Init sections discarded at runtime
204191 */
205192 . = ALIGN(STRICT_ALIGN_SIZE);
206193 __init_begin = .;
207
- INIT_TEXT_SECTION(PAGE_SIZE) :kernel
194
+ . = ALIGN(PAGE_SIZE);
195
+ .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
196
+ _sinittext = .;
197
+ INIT_TEXT
198
+
199
+ /*
200
+ *.init.text might be RO so we must ensure this section ends on
201
+ * a page boundary.
202
+ */
203
+ . = ALIGN(PAGE_SIZE);
204
+ _einittext = .;
205
+#ifdef CONFIG_PPC64
206
+ *(.tramp.ftrace.init);
207
+#endif
208
+ } :text
208209
209210 /* .exit.text is discarded at runtime, not link time,
210211 * to deal with references from __bug_table
....@@ -213,29 +214,9 @@
213214 EXIT_TEXT
214215 }
215216
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
- }
217
+ . = ALIGN(PAGE_SIZE);
225218
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
219
+ INIT_DATA_SECTION(16)
239220
240221 . = ALIGN(8);
241222 __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
....@@ -263,9 +244,6 @@
263244 __stop___fw_ftr_fixup = .;
264245 }
265246 #endif
266
- .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
267
- INIT_RAM_FS
268
- }
269247
270248 PERCPU_SECTION(L1_CACHE_BYTES)
271249
....@@ -291,6 +269,7 @@
291269 *(.dynamic)
292270 }
293271 .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
272
+ .gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
294273 .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
295274 .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
296275 {
....@@ -328,20 +307,19 @@
328307 *(.sdata2)
329308 *(.got.plt) *(.got)
330309 *(.plt)
310
+ *(.branch_lt)
331311 }
332312 #else
333313 .data : AT(ADDR(.data) - LOAD_OFFSET) {
334314 DATA_DATA
315
+#ifdef CONFIG_UBSAN
316
+ *(.data..Lubsan_data*)
317
+ *(.data..Lubsan_type*)
318
+#endif
335319 *(.data.rel*)
336320 *(.toc1)
337321 *(.branch_lt)
338322 }
339
-
340
-#ifdef CONFIG_DEBUG_INFO_BTF
341
- .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) {
342
- *(.BTF)
343
- }
344
-#endif
345323
346324 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
347325 __start_opd = .;
....@@ -363,7 +341,7 @@
363341 #endif
364342
365343 /* The initial task and kernel stack */
366
- INIT_TASK_DATA_SECTION(THREAD_SIZE)
344
+ INIT_TASK_DATA_SECTION(THREAD_ALIGN)
367345
368346 .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) {
369347 PAGE_ALIGNED_DATA(PAGE_SIZE)
....@@ -399,15 +377,18 @@
399377 PROVIDE32 (end = .);
400378
401379 STABS_DEBUG
402
-
403380 DWARF_DEBUG
381
+ ELF_DETAILS
404382
405383 DISCARDS
406384 /DISCARD/ : {
407385 *(*.EMB.apuinfo)
408
- *(.glink .iplt .plt .rela* .comment)
386
+ *(.glink .iplt .plt .comment)
409387 *(.gnu.version*)
410388 *(.gnu.attributes)
411389 *(.eh_frame)
390
+#ifndef CONFIG_RELOCATABLE
391
+ *(.rela*)
392
+#endif
412393 }
413394 }