1/* Excerpts written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> */ 2/* Modified for i386/x86-64 Xen by Keir Fraser */ 3/* Modified for ARM Xen by Ian Campbell */ 4 5#include <xen/cache.h> 6#include <asm/page.h> 7#undef ENTRY 8#undef ALIGN 9 10ENTRY(start) 11 12#if defined(__arm__) 13#define FORMAT arm 14#elif defined(__aarch64__) 15#define FORMAT aarch64 16#endif 17 18OUTPUT_ARCH(FORMAT) 19 20PHDRS 21{ 22 text PT_LOAD ; 23#if defined(BUILD_ID) 24 note PT_NOTE ; 25#endif 26} 27SECTIONS 28{ 29 . = XEN_VIRT_START; 30 _start = .; 31 .text : { 32 _stext = .; /* Text section */ 33 *(.text) 34 *(.text.cold) 35 *(.text.unlikely) 36 *(.fixup) 37 *(.gnu.warning) 38 _etext = .; /* End of text section */ 39 } :text = 0x9090 40 41 . = ALIGN(PAGE_SIZE); 42 .rodata : { 43 _srodata = .; /* Read-only data */ 44 /* Bug frames table */ 45 __start_bug_frames = .; 46 *(.bug_frames.0) 47 __stop_bug_frames_0 = .; 48 *(.bug_frames.1) 49 __stop_bug_frames_1 = .; 50 *(.bug_frames.2) 51 __stop_bug_frames_2 = .; 52 *(.rodata) 53 *(.rodata.*) 54 *(.data.rel.ro) 55 *(.data.rel.ro.*) 56 57 __proc_info_start = .; 58 *(.proc.info) 59 __proc_info_end = .; 60 61#if defined(CONFIG_HAS_VPCI) && defined(CONFIG_LATE_HWDOM) 62 . = ALIGN(POINTER_ALIGN); 63 __start_vpci_array = .; 64 *(SORT(.data.vpci.*)) 65 __end_vpci_array = .; 66#endif 67 } :text 68 69#if defined(BUILD_ID) 70 . = ALIGN(4); 71 .note.gnu.build-id : { 72 __note_gnu_build_id_start = .; 73 *(.note.gnu.build-id) 74 __note_gnu_build_id_end = .; 75 } :note :text 76#endif 77 _erodata = .; /* End of read-only data */ 78 79 .data : { /* Data */ 80 . = ALIGN(PAGE_SIZE); 81 *(.data.page_aligned) 82 *(.data) 83 . = ALIGN(8); 84 __start_schedulers_array = .; 85 *(.data.schedulers) 86 __end_schedulers_array = .; 87 88#ifdef CONFIG_HYPFS 89 . = ALIGN(8); 90 __paramhypfs_start = .; 91 *(.data.paramhypfs) 92 __paramhypfs_end = .; 93#endif 94 95 *(.data.rel) 96 *(.data.rel.*) 97 CONSTRUCTORS 98 } :text 99 100 . = ALIGN(SMP_CACHE_BYTES); 101 .data.read_mostly : { 102 /* Exception table */ 103 __start___ex_table = .; 104 *(.ex_table) 105 __stop___ex_table = .; 106 107 /* Pre-exception table */ 108 __start___pre_ex_table = .; 109 *(.ex_table.pre) 110 __stop___pre_ex_table = .; 111 112 *(.data.read_mostly) 113 } :text 114 115 . = ALIGN(8); 116 .arch.info : { 117 _splatform = .; 118 *(.arch.info) 119 _eplatform = .; 120 } :text 121 122 . = ALIGN(8); 123 .dev.info : { 124 _sdevice = .; 125 *(.dev.info) 126 _edevice = .; 127 } :text 128 129 . = ALIGN(8); 130 .adev.info : { 131 _asdevice = .; 132 *(.adev.info) 133 _aedevice = .; 134 } :text 135 136 . = ALIGN(8); 137 .teemediator.info : { 138 _steemediator = .; 139 *(.teemediator.info) 140 _eteemediator = .; 141 } :text 142 143 . = ALIGN(PAGE_SIZE); /* Init code and data */ 144 __init_begin = .; 145 .init.text : { 146 _sinittext = .; 147 *(.init.text) 148 _einittext = .; 149 } :text 150 . = ALIGN(PAGE_SIZE); 151 .init.data : { 152 *(.init.rodata) 153 *(.init.rodata.*) 154 155 . = ALIGN(POINTER_ALIGN); 156 __setup_start = .; 157 *(.init.setup) 158 __setup_end = .; 159 160 __initcall_start = .; 161 *(.initcallpresmp.init) 162 __presmp_initcall_end = .; 163 *(.initcall1.init) 164 __initcall_end = .; 165 166 . = ALIGN(4); 167 __alt_instructions = .; 168 *(.altinstructions) 169 __alt_instructions_end = .; 170 . = ALIGN(4); 171 *(.altinstr_replacement) 172 173#ifdef CONFIG_DEBUG_LOCK_PROFILE 174 . = ALIGN(POINTER_ALIGN); 175 __lock_profile_start = .; 176 *(.lockprofile.data) 177 __lock_profile_end = .; 178#endif 179 180 *(.init.data) 181 *(.init.data.rel) 182 *(.init.data.rel.*) 183 184 . = ALIGN(8); 185 __ctors_start = .; 186 *(.ctors) 187 *(.init_array) 188 *(SORT(.init_array.*)) 189 __ctors_end = .; 190 191#if defined(CONFIG_HAS_VPCI) && !defined(CONFIG_LATE_HWDOM) 192 . = ALIGN(POINTER_ALIGN); 193 __start_vpci_array = .; 194 *(SORT(.data.vpci.*)) 195 __end_vpci_array = .; 196#endif 197 } :text 198 __init_end_efi = .; 199 . = ALIGN(STACK_SIZE); 200 __init_end = .; 201 202 .bss : { /* BSS */ 203 __bss_start = .; 204 *(.bss.stack_aligned) 205 . = ALIGN(PAGE_SIZE); 206 *(.bss.page_aligned) 207 . = ALIGN(PAGE_SIZE); 208 __per_cpu_start = .; 209 *(.bss.percpu.page_aligned) 210 *(.bss.percpu) 211 . = ALIGN(SMP_CACHE_BYTES); 212 *(.bss.percpu.read_mostly) 213 . = ALIGN(SMP_CACHE_BYTES); 214 __per_cpu_data_end = .; 215 *(.bss) 216 . = ALIGN(POINTER_ALIGN); 217 __bss_end = .; 218 } :text 219 _end = . ; 220 221#ifdef CONFIG_DTB_FILE 222 /* Section for the device tree blob (if any). */ 223 _sdtb = .; 224 .dtb : { *(.dtb) } :text 225#endif 226 227 /* Sections to be discarded */ 228 /DISCARD/ : { 229 *(.exit.text) 230 *(.exit.data) 231 *(.exitcall.exit) 232 *(.eh_frame) 233 } 234 235 /* Stabs debugging sections. */ 236 .stab 0 : { *(.stab) } 237 .stabstr 0 : { *(.stabstr) } 238 .stab.excl 0 : { *(.stab.excl) } 239 .stab.exclstr 0 : { *(.stab.exclstr) } 240 .stab.index 0 : { *(.stab.index) } 241 .stab.indexstr 0 : { *(.stab.indexstr) } 242 .comment 0 : { *(.comment) } 243} 244 245/* 246 * We require that Xen is loaded at a 4K boundary, so this ensures that any 247 * code running on the boot time identity map cannot cross a section boundary. 248 */ 249ASSERT( _end_boot - start <= PAGE_SIZE, "Boot code is larger than 4K") 250/* 251 * __init_[begin|end] MUST be at word size boundary otherwise we cannot 252 * write fault instructions in the space properly. 253 */ 254ASSERT(IS_ALIGNED(__init_begin, 4), "__init_begin is misaligned") 255ASSERT(IS_ALIGNED(__init_end, 4), "__init_end is misaligned") 256