forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/powerpc/kernel/vmlinux.lds.S
....@@ -4,36 +4,23 @@
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
+
712 #include <asm/page.h>
813 #include <asm-generic/vmlinux.lds.h>
914 #include <asm/cache.h>
1015 #include <asm/thread_info.h>
1116
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)
1718
1819 ENTRY(_stext)
1920
2021 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);
3724 }
3825
3926 #ifdef CONFIG_PPC64
....@@ -77,17 +64,17 @@
7764 #else /* !CONFIG_PPC64 */
7865 HEAD_TEXT
7966 #endif
80
- } :kernel
67
+ } :text
8168
8269 __head_end = .;
8370
8471 #ifdef CONFIG_PPC64
8572 /*
86
- * BLOCK(0) overrides the default output section alignment because
73
+ * ALIGN(0) overrides the default output section alignment because
8774 * this needs to start right after .head.text in order for fixed
8875 * section placement to work.
8976 */
90
- .text BLOCK(0) : AT(ADDR(.text) - LOAD_OFFSET) {
77
+ .text ALIGN(0) : AT(ADDR(.text) - LOAD_OFFSET) {
9178 #ifdef CONFIG_LD_HEAD_STUB_CATCH
9279 KEEP(*(.linker_stub_catch));
9380 . = . ;
....@@ -98,7 +85,10 @@
9885 ALIGN_FUNCTION();
9986 #endif
10087 /* 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
10292 NOINSTR_TEXT
10393 SCHED_TEXT
10494 CPUIDLE_TEXT
....@@ -124,7 +114,7 @@
124114 __got2_end = .;
125115 #endif /* CONFIG_PPC32 */
126116
127
- } :kernel
117
+ } :text
128118
129119 . = ALIGN(PAGE_SIZE);
130120 _etext = .;
....@@ -153,6 +143,13 @@
153143 __start___entry_flush_fixup = .;
154144 *(__entry_flush_fixup)
155145 __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 = .;
156153 }
157154
158155 . = ALIGN(8);
....@@ -187,24 +184,27 @@
187184 __stop__btb_flush_fixup = .;
188185 }
189186 #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
201187
202188 /*
203189 * Init sections discarded at runtime
204190 */
205191 . = ALIGN(STRICT_ALIGN_SIZE);
206192 __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
208208
209209 /* .exit.text is discarded at runtime, not link time,
210210 * to deal with references from __bug_table
....@@ -213,29 +213,9 @@
213213 EXIT_TEXT
214214 }
215215
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);
225217
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)
239219
240220 . = ALIGN(8);
241221 __ftr_fixup : AT(ADDR(__ftr_fixup) - LOAD_OFFSET) {
....@@ -263,9 +243,6 @@
263243 __stop___fw_ftr_fixup = .;
264244 }
265245 #endif
266
- .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
267
- INIT_RAM_FS
268
- }
269246
270247 PERCPU_SECTION(L1_CACHE_BYTES)
271248
....@@ -291,6 +268,7 @@
291268 *(.dynamic)
292269 }
293270 .hash : AT(ADDR(.hash) - LOAD_OFFSET) { *(.hash) }
271
+ .gnu.hash : AT(ADDR(.gnu.hash) - LOAD_OFFSET) { *(.gnu.hash) }
294272 .interp : AT(ADDR(.interp) - LOAD_OFFSET) { *(.interp) }
295273 .rela.dyn : AT(ADDR(.rela.dyn) - LOAD_OFFSET)
296274 {
....@@ -328,20 +306,19 @@
328306 *(.sdata2)
329307 *(.got.plt) *(.got)
330308 *(.plt)
309
+ *(.branch_lt)
331310 }
332311 #else
333312 .data : AT(ADDR(.data) - LOAD_OFFSET) {
334313 DATA_DATA
314
+#ifdef CONFIG_UBSAN
315
+ *(.data..Lubsan_data*)
316
+ *(.data..Lubsan_type*)
317
+#endif
335318 *(.data.rel*)
336319 *(.toc1)
337320 *(.branch_lt)
338321 }
339
-
340
-#ifdef CONFIG_DEBUG_INFO_BTF
341
- .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) {
342
- *(.BTF)
343
- }
344
-#endif
345322
346323 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
347324 __start_opd = .;
....@@ -363,7 +340,7 @@
363340 #endif
364341
365342 /* The initial task and kernel stack */
366
- INIT_TASK_DATA_SECTION(THREAD_SIZE)
343
+ INIT_TASK_DATA_SECTION(THREAD_ALIGN)
367344
368345 .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) {
369346 PAGE_ALIGNED_DATA(PAGE_SIZE)
....@@ -399,8 +376,8 @@
399376 PROVIDE32 (end = .);
400377
401378 STABS_DEBUG
402
-
403379 DWARF_DEBUG
380
+ ELF_DETAILS
404381
405382 DISCARDS
406383 /DISCARD/ : {