Merge tag 'perf-tools-for-v5.15-2021-09-11' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-microblaze.git] / arch / 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        16
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                 *(.fixup)
52                 _etext = .;
53         }
54
55         . = ALIGN(SECTION_ALIGN);
56         __init_begin = .;
57         __init_text_begin = .;
58         .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) ALIGN(SECTION_ALIGN) { \
59                 _sinittext = .;                                         \
60                 INIT_TEXT                                               \
61                 _einittext = .;                                         \
62         }
63
64         . = ALIGN(8);
65         __soc_early_init_table : {
66                 __soc_early_init_table_start = .;
67                 KEEP(*(__soc_early_init_table))
68                 __soc_early_init_table_end = .;
69         }
70         __soc_builtin_dtb_table : {
71                 __soc_builtin_dtb_table_start = .;
72                 KEEP(*(__soc_builtin_dtb_table))
73                 __soc_builtin_dtb_table_end = .;
74         }
75         /* we have to discard exit text and such at runtime, not link time */
76         .exit.text :
77         {
78                 EXIT_TEXT
79         }
80
81         __init_text_end = .;
82         . = ALIGN(SECTION_ALIGN);
83 #ifdef CONFIG_EFI
84         . = ALIGN(PECOFF_SECTION_ALIGNMENT);
85         __pecoff_text_end = .;
86 #endif
87         /* Start of init data section */
88         __init_data_begin = .;
89         INIT_DATA_SECTION(16)
90         .exit.data :
91         {
92                 EXIT_DATA
93         }
94         PERCPU_SECTION(L1_CACHE_BYTES)
95
96         .rel.dyn : {
97                 *(.rel.dyn*)
98         }
99
100         __init_data_end = .;
101
102         . = ALIGN(8);
103         .alternative : {
104                 __alt_start = .;
105                 *(.alternative)
106                 __alt_end = .;
107         }
108         __init_end = .;
109
110         /* Start of data section */
111         _sdata = .;
112         RO_DATA(SECTION_ALIGN)
113         .srodata : {
114                 *(.srodata*)
115         }
116
117         . = ALIGN(SECTION_ALIGN);
118         _data = .;
119
120         RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
121         .sdata : {
122                 __global_pointer$ = . + 0x800;
123                 *(.sdata*)
124         }
125
126 #ifdef CONFIG_EFI
127         .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
128         __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
129 #endif
130
131         /* End of data section */
132         _edata = .;
133
134         BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
135
136 #ifdef CONFIG_EFI
137         . = ALIGN(PECOFF_SECTION_ALIGNMENT);
138         __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
139 #endif
140         _end = .;
141
142         STABS_DEBUG
143         DWARF_DEBUG
144         ELF_DETAILS
145
146         DISCARDS
147 }
148 #endif /* CONFIG_XIP_KERNEL */