Merge branch 'dmi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
[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 LOAD_OFFSET PAGE_OFFSET
8 #include <asm/vmlinux.lds.h>
9 #include <asm/page.h>
10 #include <asm/cache.h>
11 #include <asm/thread_info.h>
12 #include <asm/set_memory.h>
13 #include "image-vars.h"
14
15 #include <linux/sizes.h>
16 OUTPUT_ARCH(riscv)
17 ENTRY(_start)
18
19 jiffies = jiffies_64;
20
21 PECOFF_SECTION_ALIGNMENT = 0x1000;
22 PECOFF_FILE_ALIGNMENT = 0x200;
23
24 SECTIONS
25 {
26         /* Beginning of code and text segment */
27         . = LOAD_OFFSET;
28         _start = .;
29         HEAD_TEXT_SECTION
30         . = ALIGN(PAGE_SIZE);
31
32         .text : {
33                 _text = .;
34                 _stext = .;
35                 TEXT_TEXT
36                 SCHED_TEXT
37                 CPUIDLE_TEXT
38                 LOCK_TEXT
39                 KPROBES_TEXT
40                 ENTRY_TEXT
41                 IRQENTRY_TEXT
42                 SOFTIRQENTRY_TEXT
43                 *(.fixup)
44                 _etext = .;
45         }
46
47         . = ALIGN(SECTION_ALIGN);
48         __init_begin = .;
49         __init_text_begin = .;
50         .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) ALIGN(SECTION_ALIGN) { \
51                 _sinittext = .;                                         \
52                 INIT_TEXT                                               \
53                 _einittext = .;                                         \
54         }
55
56         . = ALIGN(8);
57         __soc_early_init_table : {
58                 __soc_early_init_table_start = .;
59                 KEEP(*(__soc_early_init_table))
60                 __soc_early_init_table_end = .;
61         }
62         __soc_builtin_dtb_table : {
63                 __soc_builtin_dtb_table_start = .;
64                 KEEP(*(__soc_builtin_dtb_table))
65                 __soc_builtin_dtb_table_end = .;
66         }
67         /* we have to discard exit text and such at runtime, not link time */
68         .exit.text :
69         {
70                 EXIT_TEXT
71         }
72
73         __init_text_end = .;
74         . = ALIGN(SECTION_ALIGN);
75 #ifdef CONFIG_EFI
76         . = ALIGN(PECOFF_SECTION_ALIGNMENT);
77         __pecoff_text_end = .;
78 #endif
79         /* Start of init data section */
80         __init_data_begin = .;
81         INIT_DATA_SECTION(16)
82         .exit.data :
83         {
84                 EXIT_DATA
85         }
86         PERCPU_SECTION(L1_CACHE_BYTES)
87
88         .rel.dyn : {
89                 *(.rel.dyn*)
90         }
91
92         __init_data_end = .;
93         __init_end = .;
94
95         /* Start of data section */
96         _sdata = .;
97         RO_DATA(SECTION_ALIGN)
98         .srodata : {
99                 *(.srodata*)
100         }
101
102         EXCEPTION_TABLE(0x10)
103
104         . = ALIGN(SECTION_ALIGN);
105         _data = .;
106
107         RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
108         .sdata : {
109                 __global_pointer$ = . + 0x800;
110                 *(.sdata*)
111         }
112
113 #ifdef CONFIG_EFI
114         .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); }
115         __pecoff_data_raw_size = ABSOLUTE(. - __pecoff_text_end);
116 #endif
117
118         /* End of data section */
119         _edata = .;
120
121         BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
122
123 #ifdef CONFIG_EFI
124         . = ALIGN(PECOFF_SECTION_ALIGNMENT);
125         __pecoff_data_virt_size = ABSOLUTE(. - __pecoff_text_end);
126 #endif
127         _end = .;
128
129         STABS_DEBUG
130         DWARF_DEBUG
131         ELF_DETAILS
132
133         DISCARDS
134 }