1#include <xen/lib.h>
2#include <xen/xen.lds.h>
3
4OUTPUT_ARCH(riscv)
5ENTRY(start)
6
7PHDRS
8{
9    text PT_LOAD ;
10#if defined(BUILD_ID)
11    note PT_NOTE ;
12#endif
13}
14
15SECTIONS
16{
17    . = XEN_VIRT_START;
18    _start = .;
19    .text : {
20        _stext = .;            /* Text section */
21        *(.text.header)
22
23        *(.text.cold)
24        *(.text.unlikely .text.*_unlikely .text.unlikely.*)
25
26        *(.text)
27#ifdef CONFIG_CC_SPLIT_SECTIONS
28        *(.text.*)
29#endif
30
31        . = ALIGN(IDENT_AREA_SIZE);
32        _ident_start = .;
33        *(.text.ident)
34        _ident_end = .;
35
36        *(.gnu.warning)
37        . = ALIGN(POINTER_ALIGN);
38        _etext = .;             /* End of text section */
39    } :text
40
41    . = ALIGN(PAGE_SIZE);
42    .rodata : {
43        _srodata = .;          /* Read-only data */
44
45        BUGFRAMES
46
47        *(.rodata)
48        *(.rodata.*)
49        VPCI_ARRAY
50        *(.data.rel.ro)
51        *(.data.rel.ro.*)
52
53        . = ALIGN(POINTER_ALIGN);
54    } :text
55
56    #if defined(BUILD_ID)
57    . = ALIGN(4);
58    .note.gnu.build-id : {
59        __note_gnu_build_id_start = .;
60        *(.note.gnu.build-id)
61        __note_gnu_build_id_end = .;
62    } :note :text
63    #endif
64    _erodata = .;                /* End of read-only data */
65
66    . = ALIGN(PAGE_SIZE);
67    .data.ro_after_init : {
68        __ro_after_init_start = .;
69        *(.data.ro_after_init)
70        . = ALIGN(PAGE_SIZE);
71        __ro_after_init_end = .;
72    } : text
73
74    .data.read_mostly : {
75        *(.data.read_mostly)
76    } :text
77
78    . = ALIGN(PAGE_SIZE);
79    .data : {                    /* Data */
80        *(.data.page_aligned)
81        . = ALIGN(8);
82        __start_schedulers_array = .;
83        *(.data.schedulers)
84        __end_schedulers_array = .;
85
86        HYPFS_PARAM
87
88        *(.data .data.*)
89        CONSTRUCTORS
90    } :text
91
92    DT_DEV_INFO                       /* Devicetree based device info */
93
94    . = ALIGN(PAGE_SIZE);             /* Init code and data */
95    __init_begin = .;
96    .init.text : {
97        _sinittext = .;
98        *(.init.text)
99        _einittext = .;
100        . = ALIGN(PAGE_SIZE);        /* Avoid mapping alt insns executable */
101    } :text
102    . = ALIGN(PAGE_SIZE);
103    .init.data : {
104        *(.init.rodata)
105        *(.init.rodata.*)
106
107        . = ALIGN(POINTER_ALIGN);
108        __setup_start = .;
109        *(.init.setup)
110        __setup_end = .;
111
112        __initcall_start = .;
113        *(.initcallpresmp.init)
114        __presmp_initcall_end = .;
115        *(.initcall1.init)
116        __initcall_end = .;
117
118        LOCK_PROFILE_DATA
119
120        *(.init.data)
121        *(.init.data.rel)
122        *(.init.data.rel.*)
123
124        . = ALIGN(8);
125        __ctors_start = .;
126        *(.ctors)
127        *(.init_array)
128        *(SORT(.init_array.*))
129        __ctors_end = .;
130    } :text
131
132    .got : {
133        *(.got)
134    } : text
135
136    .got.plt : {
137        *(.got.plt)
138    } : text
139
140    . = ALIGN(POINTER_ALIGN);
141    __init_end = .;
142
143    .bss : {                     /* BSS */
144        . = ALIGN(POINTER_ALIGN);
145        __bss_start = .;
146        *(.bss.stack_aligned)
147        *(.bss.page_aligned)
148        PERCPU_BSS
149        *(.sbss .sbss.* .bss .bss.*)
150        . = ALIGN(POINTER_ALIGN);
151        __bss_end = .;
152    } :text
153    _end = . ;
154
155    /* Section for the device tree blob (if any). */
156    .dtb : { *(.dtb) } :text
157
158    DWARF2_DEBUG_SECTIONS
159
160    DISCARD_SECTIONS
161
162    STABS_DEBUG_SECTIONS
163
164    ELF_DETAILS_SECTIONS
165}
166
167PROVIDE(cpu_present_map = cpu_possible_map);
168
169ASSERT(IS_ALIGNED(__bss_start,      POINTER_ALIGN), "__bss_start is misaligned")
170ASSERT(IS_ALIGNED(__bss_end,        POINTER_ALIGN), "__bss_end is misaligned")
171
172ASSERT(!SIZEOF(.got),      ".got non-empty")
173ASSERT(!SIZEOF(.got.plt),  ".got.plt non-empty")
174
175/*
176 * Changing the size of Xen binary can require an update of
177 * PGTBL_INITIAL_COUNT.
178 */
179ASSERT(_end - _start <= XEN_VIRT_SIZE, "Xen too large for early-boot assumptions")
180
181ASSERT(_ident_end - _ident_start <= IDENT_AREA_SIZE, "identity region is too big");
182