Mention branches and keyring.
[releases.git] / riscv / kernel / vmlinux.lds.S
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2012 Regents of the University of California
4  * Copyright (C) 2017 SiFive
5  */
6
7 #define RO_EXCEPTION_TABLE_ALIGN        4
8
9 #ifdef CONFIG_XIP_KERNEL
10 #include "vmlinux-xip.lds.S"
11 #else
12
13 #include <asm/pgtable.h>
14 #define LOAD_OFFSET KERNEL_LINK_ADDR
15
16 #include <asm/vmlinux.lds.h>
17 #include <asm/page.h>
18 #include <asm/cache.h>
19 #include <asm/thread_info.h>
20 #include <asm/set_memory.h>
21 #include "image-vars.h"
22
23 #include <linux/sizes.h>
24 OUTPUT_ARCH(riscv)
25 ENTRY(_start)
26
27 jiffies = jiffies_64;
28
29 PECOFF_SECTION_ALIGNMENT = 0x1000;
30 PECOFF_FILE_ALIGNMENT = 0x200;
31
32 SECTIONS
33 {
34         /* Beginning of code and text segment */
35         . = LOAD_OFFSET;
36         _start = .;
37         HEAD_TEXT_SECTION
38         . = ALIGN(PAGE_SIZE);
39
40         .text : {
41                 _text = .;
42                 _stext = .;
43                 TEXT_TEXT
44                 SCHED_TEXT
45                 CPUIDLE_TEXT
46                 LOCK_TEXT
47                 KPROBES_TEXT
48                 ENTRY_TEXT
49                 IRQENTRY_TEXT
50                 SOFTIRQENTRY_TEXT
51                 _etext = .;
52         }
53
54         . = ALIGN(SECTION_ALIGN);
55         __init_begin = .;
56         __init_text_begin = .;
57         .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) ALIGN(SECTION_ALIGN) { \
58                 _sinittext = .;                                         \
59                 INIT_TEXT                                               \
60                 _einittext = .;                                         \
61         }
62
63         . = ALIGN(8);
64         __soc_early_init_table : {
65                 __soc_early_init_table_start = .;
66                 KEEP(*(__soc_early_init_table))
67                 __soc_early_init_table_end = .;
68         }
69         __soc_builtin_dtb_table : {
70                 __soc_builtin_dtb_table_start = .;
71                 KEEP(*(__soc_builtin_dtb_table))
72                 __soc_builtin_dtb_table_end = .;
73         }
74         /* we have to discard exit text and such at runtime, not link time */
75         __exittext_begin = .;
76         .exit.text :
77         {
78                 EXIT_TEXT
79         }
80         __exittext_end = .;
81
82         __init_text_end = .;
83         . = ALIGN(SECTION_ALIGN);
84 #ifdef CONFIG_EFI
85         . = ALIGN(PECOFF_SECTION_ALIGNMENT);
86         __pecoff_text_end = .;
87 #endif
88         /* Start of init data section */
89         __init_data_begin = .;
90         INIT_DATA_SECTION(16)
91         .exit.data :
92         {
93                 EXIT_DATA
94         }
95         PERCPU_SECTION(L1_CACHE_BYTES)
96
97         .rel.dyn : {
98                 *(.rel.dyn*)
99         }
100
101         __init_data_end = .;
102
103         . = ALIGN(8);
104         .alternative : {
105                 __alt_start = .;
106                 *(.alternative)
107                 __alt_end = .;
108         }
109         __init_end = .;
110
111         /* Start of data section */
112         _sdata = .;
113         RO_DATA(SECTION_ALIGN)
114         .srodata : {
115                 *(.srodata*)
116         }
117
118         . = ALIGN(SECTION_ALIGN);
119         _data = .;
120
121         RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
122         .sdata : {
123                 __global_pointer$ = . + 0x800;
124                 *(.sdata*)
125         }
126
127 #ifdef CONFIG_EFI
128         .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
129         __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
130 #endif
131
132         /* End of data section */
133         _edata = .;
134
135         BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
136
137 #ifdef CONFIG_EFI
138         . = ALIGN(PECOFF_SECTION_ALIGNMENT);
139         __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
140 #endif
141         _end = .;
142
143         STABS_DEBUG
144         DWARF_DEBUG
145         ELF_DETAILS
146
147         DISCARDS
148 }
149 #endif /* CONFIG_XIP_KERNEL */