hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/riscv/kernel/vmlinux.lds.S
....@@ -1,15 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2012 Regents of the University of California
34 * Copyright (C) 2017 SiFive
4
- *
5
- * This program is free software; you can redistribute it and/or
6
- * modify it under the terms of the GNU General Public License
7
- * as published by the Free Software Foundation, version 2.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 */
146
157 #define LOAD_OFFSET PAGE_OFFSET
....@@ -17,21 +9,39 @@
179 #include <asm/page.h>
1810 #include <asm/cache.h>
1911 #include <asm/thread_info.h>
12
+#include <asm/set_memory.h>
13
+#include "image-vars.h"
2014
15
+#include <linux/sizes.h>
2116 OUTPUT_ARCH(riscv)
2217 ENTRY(_start)
2318
2419 jiffies = jiffies_64;
20
+
21
+PECOFF_SECTION_ALIGNMENT = 0x1000;
22
+PECOFF_FILE_ALIGNMENT = 0x200;
2523
2624 SECTIONS
2725 {
2826 /* Beginning of code and text segment */
2927 . = LOAD_OFFSET;
3028 _start = .;
31
- __init_begin = .;
3229 HEAD_TEXT_SECTION
30
+ . = ALIGN(PAGE_SIZE);
31
+
32
+ __init_begin = .;
3333 INIT_TEXT_SECTION(PAGE_SIZE)
34
- INIT_DATA_SECTION(16)
34
+ . = ALIGN(8);
35
+ __soc_early_init_table : {
36
+ __soc_early_init_table_start = .;
37
+ KEEP(*(__soc_early_init_table))
38
+ __soc_early_init_table_end = .;
39
+ }
40
+ __soc_builtin_dtb_table : {
41
+ __soc_builtin_dtb_table_start = .;
42
+ KEEP(*(__soc_builtin_dtb_table))
43
+ __soc_builtin_dtb_table_end = .;
44
+ }
3545 /* we have to discard exit text and such at runtime, not link time */
3646 .exit.text :
3747 {
....@@ -44,6 +54,7 @@
4454 PERCPU_SECTION(L1_CACHE_BYTES)
4555 __init_end = .;
4656
57
+ . = ALIGN(SECTION_ALIGN);
4758 .text : {
4859 _text = .;
4960 _stext = .;
....@@ -54,39 +65,59 @@
5465 KPROBES_TEXT
5566 ENTRY_TEXT
5667 IRQENTRY_TEXT
68
+ SOFTIRQENTRY_TEXT
5769 *(.fixup)
5870 _etext = .;
5971 }
6072
73
+#ifdef CONFIG_EFI
74
+ . = ALIGN(PECOFF_SECTION_ALIGNMENT);
75
+ __pecoff_text_end = .;
76
+#endif
77
+
78
+ INIT_DATA_SECTION(16)
79
+
6180 /* Start of data section */
6281 _sdata = .;
63
- RO_DATA_SECTION(L1_CACHE_BYTES)
82
+ RO_DATA(SECTION_ALIGN)
6483 .srodata : {
6584 *(.srodata*)
6685 }
6786
68
- RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
87
+ EXCEPTION_TABLE(0x10)
88
+
89
+ . = ALIGN(SECTION_ALIGN);
90
+ _data = .;
91
+
92
+ RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
6993 .sdata : {
7094 __global_pointer$ = . + 0x800;
7195 *(.sdata*)
72
- /* End of data section */
73
- _edata = .;
74
- *(.sbss*)
7596 }
7697
77
- BSS_SECTION(0, 0, 0)
98
+#ifdef CONFIG_EFI
99
+ .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
100
+ __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
101
+#endif
78102
79
- EXCEPTION_TABLE(0x10)
80
- NOTES
103
+ /* End of data section */
104
+ _edata = .;
105
+
106
+ BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
81107
82108 .rel.dyn : {
83109 *(.rel.dyn*)
84110 }
85111
112
+#ifdef CONFIG_EFI
113
+ . = ALIGN(PECOFF_SECTION_ALIGNMENT);
114
+ __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
115
+#endif
86116 _end = .;
87117
88118 STABS_DEBUG
89119 DWARF_DEBUG
120
+ ELF_DETAILS
90121
91122 DISCARDS
92123 }