1b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */ 28c2c3df3SCatalin Marinas/* 38c2c3df3SCatalin Marinas * ld script to make ARM Linux kernel 48c2c3df3SCatalin Marinas * taken from the i386 version by Russell King 58c2c3df3SCatalin Marinas * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz> 68c2c3df3SCatalin Marinas */ 78c2c3df3SCatalin Marinas 8ce492a16SDavid Brazdil#include <asm/hyp_image.h> 93471ee06SDavid Brazdil#ifdef CONFIG_KVM 10e9ee186bSJames Morse#define HYPERVISOR_EXTABLE \ 11e9ee186bSJames Morse . = ALIGN(SZ_8); \ 12e9ee186bSJames Morse __start___kvm_ex_table = .; \ 13e9ee186bSJames Morse *(__kvm_ex_table) \ 14e9ee186bSJames Morse __stop___kvm_ex_table = .; 1530c95391SDavid Brazdil 162d7bf218SDavid Brazdil#define HYPERVISOR_DATA_SECTIONS \ 1716174eeaSDavid Brazdil HYP_SECTION_NAME(.rodata) : { \ 18b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 1916174eeaSDavid Brazdil __hyp_rodata_start = .; \ 202d7bf218SDavid Brazdil *(HYP_SECTION_NAME(.data..ro_after_init)) \ 2116174eeaSDavid Brazdil *(HYP_SECTION_NAME(.rodata)) \ 22b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 2316174eeaSDavid Brazdil __hyp_rodata_end = .; \ 242d7bf218SDavid Brazdil } 252d7bf218SDavid Brazdil 2630c95391SDavid Brazdil#define HYPERVISOR_PERCPU_SECTION \ 2730c95391SDavid Brazdil . = ALIGN(PAGE_SIZE); \ 2830c95391SDavid Brazdil HYP_SECTION_NAME(.data..percpu) : { \ 2930c95391SDavid Brazdil *(HYP_SECTION_NAME(.data..percpu)) \ 3030c95391SDavid Brazdil } 318c49b5d4SDavid Brazdil 328c49b5d4SDavid Brazdil#define HYPERVISOR_RELOC_SECTION \ 338c49b5d4SDavid Brazdil .hyp.reloc : ALIGN(4) { \ 348c49b5d4SDavid Brazdil __hyp_reloc_begin = .; \ 358c49b5d4SDavid Brazdil *(.hyp.reloc) \ 368c49b5d4SDavid Brazdil __hyp_reloc_end = .; \ 378c49b5d4SDavid Brazdil } 388c49b5d4SDavid Brazdil 39380e18adSQuentin Perret#define BSS_FIRST_SECTIONS \ 40380e18adSQuentin Perret __hyp_bss_start = .; \ 41380e18adSQuentin Perret *(HYP_SECTION_NAME(.bss)) \ 42380e18adSQuentin Perret . = ALIGN(PAGE_SIZE); \ 43380e18adSQuentin Perret __hyp_bss_end = .; 44380e18adSQuentin Perret 45380e18adSQuentin Perret/* 46380e18adSQuentin Perret * We require that __hyp_bss_start and __bss_start are aligned, and enforce it 47380e18adSQuentin Perret * with an assertion. But the BSS_SECTION macro places an empty .sbss section 48380e18adSQuentin Perret * between them, which can in some cases cause the linker to misalign them. To 49380e18adSQuentin Perret * work around the issue, force a page alignment for __bss_start. 50380e18adSQuentin Perret */ 51380e18adSQuentin Perret#define SBSS_ALIGN PAGE_SIZE 523471ee06SDavid Brazdil#else /* CONFIG_KVM */ 533471ee06SDavid Brazdil#define HYPERVISOR_EXTABLE 542d7bf218SDavid Brazdil#define HYPERVISOR_DATA_SECTIONS 5530c95391SDavid Brazdil#define HYPERVISOR_PERCPU_SECTION 568c49b5d4SDavid Brazdil#define HYPERVISOR_RELOC_SECTION 57380e18adSQuentin Perret#define SBSS_ALIGN 0 583471ee06SDavid Brazdil#endif 59e9ee186bSJames Morse 60d6e2cc56SMark Rutland#define RO_EXCEPTION_TABLE_ALIGN 4 61380e18adSQuentin Perret#define RUNTIME_DISCARD_EXIT 62380e18adSQuentin Perret 63380e18adSQuentin Perret#include <asm-generic/vmlinux.lds.h> 64380e18adSQuentin Perret#include <asm/cache.h> 65380e18adSQuentin Perret#include <asm/kernel-pgtable.h> 6619a046f0SPasha Tatashin#include <asm/kexec.h> 67380e18adSQuentin Perret#include <asm/memory.h> 68380e18adSQuentin Perret#include <asm/page.h> 69380e18adSQuentin Perret 70380e18adSQuentin Perret#include "image.h" 71380e18adSQuentin Perret 72380e18adSQuentin PerretOUTPUT_ARCH(aarch64) 73380e18adSQuentin PerretENTRY(_text) 74380e18adSQuentin Perret 75380e18adSQuentin Perretjiffies = jiffies_64; 76380e18adSQuentin Perret 772240bbb6SMarc Zyngier#define HYPERVISOR_TEXT \ 78b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 795c636aa0SMasahiro Yamada __hyp_idmap_text_start = .; \ 802240bbb6SMarc Zyngier *(.hyp.idmap.text) \ 815c636aa0SMasahiro Yamada __hyp_idmap_text_end = .; \ 825c636aa0SMasahiro Yamada __hyp_text_start = .; \ 832240bbb6SMarc Zyngier *(.hyp.text) \ 84e9ee186bSJames Morse HYPERVISOR_EXTABLE \ 85b83042f0SQuentin Perret . = ALIGN(PAGE_SIZE); \ 865c636aa0SMasahiro Yamada __hyp_text_end = .; 872240bbb6SMarc Zyngier 885dfe9d7dSArd Biesheuvel#define IDMAP_TEXT \ 895dfe9d7dSArd Biesheuvel . = ALIGN(SZ_4K); \ 905c636aa0SMasahiro Yamada __idmap_text_start = .; \ 915dfe9d7dSArd Biesheuvel *(.idmap.text) \ 925c636aa0SMasahiro Yamada __idmap_text_end = .; 935dfe9d7dSArd Biesheuvel 9482869ac5SJames Morse#ifdef CONFIG_HIBERNATION 9582869ac5SJames Morse#define HIBERNATE_TEXT \ 96dc4824faSMark Rutland ALIGN_FUNCTION(); \ 975c636aa0SMasahiro Yamada __hibernate_exit_text_start = .; \ 9882869ac5SJames Morse *(.hibernate_exit.text) \ 995c636aa0SMasahiro Yamada __hibernate_exit_text_end = .; 10082869ac5SJames Morse#else 10182869ac5SJames Morse#define HIBERNATE_TEXT 10282869ac5SJames Morse#endif 10382869ac5SJames Morse 10419a046f0SPasha Tatashin#ifdef CONFIG_KEXEC_CORE 10519a046f0SPasha Tatashin#define KEXEC_TEXT \ 106dc4824faSMark Rutland ALIGN_FUNCTION(); \ 10719a046f0SPasha Tatashin __relocate_new_kernel_start = .; \ 10819a046f0SPasha Tatashin *(.kexec_relocate.text) \ 10919a046f0SPasha Tatashin __relocate_new_kernel_end = .; 11019a046f0SPasha Tatashin#else 11119a046f0SPasha Tatashin#define KEXEC_TEXT 11219a046f0SPasha Tatashin#endif 11319a046f0SPasha Tatashin 114c7b9adafSWill Deacon#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 115c7b9adafSWill Deacon#define TRAMP_TEXT \ 116c7b9adafSWill Deacon . = ALIGN(PAGE_SIZE); \ 1175c636aa0SMasahiro Yamada __entry_tramp_text_start = .; \ 118c7b9adafSWill Deacon *(.entry.tramp.text) \ 119c7b9adafSWill Deacon . = ALIGN(PAGE_SIZE); \ 1201c9a8e87SArd Biesheuvel __entry_tramp_text_end = .; \ 1211c9a8e87SArd Biesheuvel *(.entry.tramp.rodata) 122c7b9adafSWill Deacon#else 123c7b9adafSWill Deacon#define TRAMP_TEXT 124c7b9adafSWill Deacon#endif 125c7b9adafSWill Deacon 12668c76ad4SArd Biesheuvel#ifdef CONFIG_UNWIND_TABLES 12768c76ad4SArd Biesheuvel#define UNWIND_DATA_SECTIONS \ 12868c76ad4SArd Biesheuvel .eh_frame : { \ 12968c76ad4SArd Biesheuvel __eh_frame_start = .; \ 13068c76ad4SArd Biesheuvel *(.eh_frame) \ 13168c76ad4SArd Biesheuvel __eh_frame_end = .; \ 13268c76ad4SArd Biesheuvel } 13368c76ad4SArd Biesheuvel#else 13468c76ad4SArd Biesheuvel#define UNWIND_DATA_SECTIONS 13568c76ad4SArd Biesheuvel#endif 13668c76ad4SArd Biesheuvel 137a352ea3eSArd Biesheuvel/* 138a352ea3eSArd Biesheuvel * The size of the PE/COFF section that covers the kernel image, which 139348a625dSArd Biesheuvel * runs from _stext to _edata, must be a round multiple of the PE/COFF 140348a625dSArd Biesheuvel * FileAlignment, which we set to its minimum value of 0x200. '_stext' 141a352ea3eSArd Biesheuvel * itself is 4 KB aligned, so padding out _edata to a 0x200 aligned 142a352ea3eSArd Biesheuvel * boundary should be sufficient. 143a352ea3eSArd Biesheuvel */ 144a352ea3eSArd BiesheuvelPECOFF_FILE_ALIGNMENT = 0x200; 145a352ea3eSArd Biesheuvel 146a352ea3eSArd Biesheuvel#ifdef CONFIG_EFI 147a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING \ 148a352ea3eSArd Biesheuvel .pecoff_edata_padding : { BYTE(0); . = ALIGN(PECOFF_FILE_ALIGNMENT); } 149a352ea3eSArd Biesheuvel#else 150a352ea3eSArd Biesheuvel#define PECOFF_EDATA_PADDING 151a352ea3eSArd Biesheuvel#endif 152a352ea3eSArd Biesheuvel 1538c2c3df3SCatalin MarinasSECTIONS 1548c2c3df3SCatalin Marinas{ 1558c2c3df3SCatalin Marinas /* 1568c2c3df3SCatalin Marinas * XXX: The linker does not define how output sections are 1578c2c3df3SCatalin Marinas * assigned to input sections when there are multiple statements 1588c2c3df3SCatalin Marinas * matching the same input section name. There is no documented 1598c2c3df3SCatalin Marinas * order of matching. 1608c2c3df3SCatalin Marinas */ 1612883352bSKees Cook DISCARDS 1628c2c3df3SCatalin Marinas /DISCARD/ : { 1631e48ef7fSArd Biesheuvel *(.interp .dynamic) 1643bbd3db8SArd Biesheuvel *(.dynsym .dynstr .hash .gnu.hash) 1658c2c3df3SCatalin Marinas } 1668c2c3df3SCatalin Marinas 167120dc60dSArd Biesheuvel . = KIMAGE_VADDR; 1688c2c3df3SCatalin Marinas 1698c2c3df3SCatalin Marinas .head.text : { 1708c2c3df3SCatalin Marinas _text = .; 1718c2c3df3SCatalin Marinas HEAD_TEXT 1728c2c3df3SCatalin Marinas } 173e2a073ddSArd Biesheuvel .text : ALIGN(SEGMENT_ALIGN) { /* Real text segment */ 1748c2c3df3SCatalin Marinas _stext = .; /* Text and read-only data */ 1758c2c3df3SCatalin Marinas IRQENTRY_TEXT 176be7635e7SAlexander Potapenko SOFTIRQENTRY_TEXT 177888b3c87SPratyush Anand ENTRY_TEXT 1788c2c3df3SCatalin Marinas TEXT_TEXT 1798c2c3df3SCatalin Marinas SCHED_TEXT 1808c2c3df3SCatalin Marinas LOCK_TEXT 1812dd0e8d2SSandeepa Prabhu KPROBES_TEXT 1822240bbb6SMarc Zyngier HYPERVISOR_TEXT 1838c2c3df3SCatalin Marinas *(.gnu.warning) 1848c2c3df3SCatalin Marinas } 1858c2c3df3SCatalin Marinas 18697740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 1879fdc14c5SArd Biesheuvel _etext = .; /* End of text section */ 1889fdc14c5SArd Biesheuvel 18919f6bc32SKees Cook /* everything from this point to __init_begin will be marked RO NX */ 19019f6bc32SKees Cook RO_DATA(PAGE_SIZE) 1918c2c3df3SCatalin Marinas 192eb48d154SMarc Zyngier HYPERVISOR_DATA_SECTIONS 193eb48d154SMarc Zyngier 1940fddb79bSFangrui Song .got : { *(.got) } 1950fddb79bSFangrui Song /* 1960fddb79bSFangrui Song * Make sure that the .got.plt is either completely empty or it 1970fddb79bSFangrui Song * contains only the lazy dispatch entries. 1980fddb79bSFangrui Song */ 1990fddb79bSFangrui Song .got.plt : { *(.got.plt) } 2000fddb79bSFangrui Song ASSERT(SIZEOF(.got.plt) == 0 || SIZEOF(.got.plt) == 0x18, 2010fddb79bSFangrui Song "Unexpected GOT/PLT entries detected!") 2020fddb79bSFangrui Song 2036ee3cf6aSArd Biesheuvel /* code sections that are never executed via the kernel mapping */ 2046ee3cf6aSArd Biesheuvel .rodata.text : { 2056ee3cf6aSArd Biesheuvel TRAMP_TEXT 2066ee3cf6aSArd Biesheuvel HIBERNATE_TEXT 2076ee3cf6aSArd Biesheuvel KEXEC_TEXT 208af7249b3SArd Biesheuvel IDMAP_TEXT 2096ee3cf6aSArd Biesheuvel . = ALIGN(PAGE_SIZE); 2106ee3cf6aSArd Biesheuvel } 2116ee3cf6aSArd Biesheuvel 2128eb7e28dSJun Yao idmap_pg_dir = .; 213c3cee924SArd Biesheuvel . += PAGE_SIZE; 2148eb7e28dSJun Yao 2158eb7e28dSJun Yao#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 2168eb7e28dSJun Yao tramp_pg_dir = .; 2178eb7e28dSJun Yao . += PAGE_SIZE; 2188eb7e28dSJun Yao#endif 2198eb7e28dSJun Yao 220833be850SMark Rutland reserved_pg_dir = .; 221833be850SMark Rutland . += PAGE_SIZE; 222833be850SMark Rutland 2238eb7e28dSJun Yao swapper_pg_dir = .; 2248eb7e28dSJun Yao . += PAGE_SIZE; 2258eb7e28dSJun Yao 22697740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2278c2c3df3SCatalin Marinas __init_begin = .; 2282ebe088bSArd Biesheuvel __inittext_begin = .; 2298c2c3df3SCatalin Marinas 2308c2c3df3SCatalin Marinas INIT_TEXT_SECTION(8) 231ca2ef4ffSMark Rutland 232ca2ef4ffSMark Rutland __exittext_begin = .; 2338c2c3df3SCatalin Marinas .exit.text : { 2341eae811dSArd Biesheuvel EXIT_TEXT 2358c2c3df3SCatalin Marinas } 236ca2ef4ffSMark Rutland __exittext_end = .; 237da141706SLaura Abbott 2382ebe088bSArd Biesheuvel . = ALIGN(4); 2392ebe088bSArd Biesheuvel .altinstructions : { 2402ebe088bSArd Biesheuvel __alt_instructions = .; 2412ebe088bSArd Biesheuvel *(.altinstructions) 2422ebe088bSArd Biesheuvel __alt_instructions_end = .; 2432ebe088bSArd Biesheuvel } 2442ebe088bSArd Biesheuvel 24568c76ad4SArd Biesheuvel UNWIND_DATA_SECTIONS 24668c76ad4SArd Biesheuvel 24776085affSArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2482ebe088bSArd Biesheuvel __inittext_end = .; 2492ebe088bSArd Biesheuvel __initdata_begin = .; 2502ebe088bSArd Biesheuvel 251c3cee924SArd Biesheuvel init_idmap_pg_dir = .; 252c3cee924SArd Biesheuvel . += INIT_IDMAP_DIR_SIZE; 253c3cee924SArd Biesheuvel init_idmap_pg_end = .; 254c3cee924SArd Biesheuvel 2558c2c3df3SCatalin Marinas .init.data : { 2568c2c3df3SCatalin Marinas INIT_DATA 2578c2c3df3SCatalin Marinas INIT_SETUP(16) 2588c2c3df3SCatalin Marinas INIT_CALLS 2598c2c3df3SCatalin Marinas CON_INITCALL 2608c2c3df3SCatalin Marinas INIT_RAM_FS 261ba4259a6SCatalin Marinas *(.init.altinstructions .init.bss) /* from the EFI stub */ 2628c2c3df3SCatalin Marinas } 2638c2c3df3SCatalin Marinas .exit.data : { 2641eae811dSArd Biesheuvel EXIT_DATA 2658c2c3df3SCatalin Marinas } 2668c2c3df3SCatalin Marinas 26798fb7548SArd Biesheuvel PERCPU_SECTION(L1_CACHE_BYTES) 26830c95391SDavid Brazdil HYPERVISOR_PERCPU_SECTION 2698c2c3df3SCatalin Marinas 2708c49b5d4SDavid Brazdil HYPERVISOR_RELOC_SECTION 2718c49b5d4SDavid Brazdil 2723bbd3db8SArd Biesheuvel .rela.dyn : ALIGN(8) { 273d7bea550SArd Biesheuvel __rela_start = .; 2741e48ef7fSArd Biesheuvel *(.rela .rela*) 275d7bea550SArd Biesheuvel __rela_end = .; 2761e48ef7fSArd Biesheuvel } 277e039ee4eSAndre Przywara 2785cf896fbSPeter Collingbourne .relr.dyn : ALIGN(8) { 279d7bea550SArd Biesheuvel __relr_start = .; 2805cf896fbSPeter Collingbourne *(.relr.dyn) 281d7bea550SArd Biesheuvel __relr_end = .; 2825cf896fbSPeter Collingbourne } 2835cf896fbSPeter Collingbourne 28497740051SArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 2852ebe088bSArd Biesheuvel __initdata_end = .; 2869aa4ec15SMark Rutland __init_end = .; 2879aa4ec15SMark Rutland 288*b46bc5b0SMasahiro Yamada .data.rel.ro : { *(.data.rel.ro) } 289*b46bc5b0SMasahiro Yamada ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!") 290*b46bc5b0SMasahiro Yamada 2913c620626SMark Salter _data = .; 2928c2c3df3SCatalin Marinas _sdata = .; 293c9174047SKees Cook RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN) 294b6113038SJames Morse 295b6113038SJames Morse /* 296b6113038SJames Morse * Data written with the MMU off but read with the MMU on requires 297b6113038SJames Morse * cache lines to be invalidated, discarding up to a Cache Writeback 298b6113038SJames Morse * Granule (CWG) of data from the cache. Keep the section that 299b6113038SJames Morse * requires this type of maintenance to be in its own Cache Writeback 300b6113038SJames Morse * Granule (CWG) area so the cache maintenance operations don't 301b6113038SJames Morse * interfere with adjacent data. 302b6113038SJames Morse */ 303b6113038SJames Morse .mmuoff.data.write : ALIGN(SZ_2K) { 304b6113038SJames Morse __mmuoff_data_start = .; 305b6113038SJames Morse *(.mmuoff.data.write) 306b6113038SJames Morse } 307b6113038SJames Morse . = ALIGN(SZ_2K); 308b6113038SJames Morse .mmuoff.data.read : { 309b6113038SJames Morse *(.mmuoff.data.read) 310b6113038SJames Morse __mmuoff_data_end = .; 311b6113038SJames Morse } 312b6113038SJames Morse 313a352ea3eSArd Biesheuvel PECOFF_EDATA_PADDING 314cad27ef2SArd Biesheuvel __pecoff_data_rawsize = ABSOLUTE(. - __initdata_begin); 3158c2c3df3SCatalin Marinas _edata = .; 3168c2c3df3SCatalin Marinas 317380e18adSQuentin Perret BSS_SECTION(SBSS_ALIGN, 0, 0) 318bd00cd5fSMark Rutland 319bd00cd5fSMark Rutland . = ALIGN(PAGE_SIZE); 3202b5548b6SJun Yao init_pg_dir = .; 3212b5548b6SJun Yao . += INIT_DIR_SIZE; 3222b5548b6SJun Yao init_pg_end = .; 3232b5548b6SJun Yao 32476085affSArd Biesheuvel . = ALIGN(SEGMENT_ALIGN); 325cad27ef2SArd Biesheuvel __pecoff_data_size = ABSOLUTE(. - __initdata_begin); 3268c2c3df3SCatalin Marinas _end = .; 3278c2c3df3SCatalin Marinas 3288c2c3df3SCatalin Marinas STABS_DEBUG 329578d7f0fSKees Cook DWARF_DEBUG 330c604abc3SKees Cook ELF_DETAILS 331a2c1d73bSMark Rutland 332a2c1d73bSMark Rutland HEAD_SYMBOLS 333be288182SKees Cook 334be288182SKees Cook /* 335be288182SKees Cook * Sections that should stay zero sized, which is safer to 336be288182SKees Cook * explicitly check instead of blindly discarding. 337be288182SKees Cook */ 338be288182SKees Cook .plt : { 3395f692a81SArd Biesheuvel *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt) 340be288182SKees Cook } 341be288182SKees Cook ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!") 3428c2c3df3SCatalin Marinas} 3432240bbb6SMarc Zyngier 34490776dd1SKees Cook#include "image-vars.h" 34590776dd1SKees Cook 3462240bbb6SMarc Zyngier/* 347b83042f0SQuentin Perret * The HYP init code and ID map text can't be longer than a page each. The 348b83042f0SQuentin Perret * former is page-aligned, but the latter may not be with 16K or 64K pages, so 349b83042f0SQuentin Perret * it should also not cross a page boundary. 3502240bbb6SMarc Zyngier */ 351b83042f0SQuentin PerretASSERT(__hyp_idmap_text_end - __hyp_idmap_text_start <= PAGE_SIZE, 352b83042f0SQuentin Perret "HYP init code too big") 3535dfe9d7dSArd BiesheuvelASSERT(__idmap_text_end - (__idmap_text_start & ~(SZ_4K - 1)) <= SZ_4K, 3545dfe9d7dSArd Biesheuvel "ID map text too big or misaligned") 35582869ac5SJames Morse#ifdef CONFIG_HIBERNATION 3566ee3cf6aSArd BiesheuvelASSERT(__hibernate_exit_text_end - __hibernate_exit_text_start <= SZ_4K, 3576ee3cf6aSArd Biesheuvel "Hibernate exit text is bigger than 4 KiB") 358dc4824faSMark RutlandASSERT(__hibernate_exit_text_start == swsusp_arch_suspend_exit, 359dc4824faSMark Rutland "Hibernate exit text does not start with swsusp_arch_suspend_exit") 36082869ac5SJames Morse#endif 3616c27c408SWill Deacon#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 362a9c406e6SJames MorseASSERT((__entry_tramp_text_end - __entry_tramp_text_start) <= 3*PAGE_SIZE, 3636c27c408SWill Deacon "Entry trampoline text too big") 3646c27c408SWill Deacon#endif 365380e18adSQuentin Perret#ifdef CONFIG_KVM 366380e18adSQuentin PerretASSERT(__hyp_bss_start == __bss_start, "HYP and Host BSS are misaligned") 367380e18adSQuentin Perret#endif 368da57a369SMark Rutland/* 369da57a369SMark Rutland * If padding is applied before .head.text, virt<->phys conversions will fail. 370da57a369SMark Rutland */ 371120dc60dSArd BiesheuvelASSERT(_text == KIMAGE_VADDR, "HEAD is misaligned") 37200ef5434SJoey Gouly 37300ef5434SJoey GoulyASSERT(swapper_pg_dir - reserved_pg_dir == RESERVED_SWAPPER_OFFSET, 37400ef5434SJoey Gouly "RESERVED_SWAPPER_OFFSET is wrong!") 3750188a894SJoey Gouly 3760188a894SJoey Gouly#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 3770188a894SJoey GoulyASSERT(swapper_pg_dir - tramp_pg_dir == TRAMP_SWAPPER_OFFSET, 3780188a894SJoey Gouly "TRAMP_SWAPPER_OFFSET is wrong!") 3790188a894SJoey Gouly#endif 38019a046f0SPasha Tatashin 38119a046f0SPasha Tatashin#ifdef CONFIG_KEXEC_CORE 38219a046f0SPasha Tatashin/* kexec relocation code should fit into one KEXEC_CONTROL_PAGE_SIZE */ 3836ee3cf6aSArd BiesheuvelASSERT(__relocate_new_kernel_end - __relocate_new_kernel_start <= SZ_4K, 3846ee3cf6aSArd Biesheuvel "kexec relocation code is bigger than 4 KiB") 38519a046f0SPasha TatashinASSERT(KEXEC_CONTROL_PAGE_SIZE >= SZ_4K, "KEXEC_CONTROL_PAGE_SIZE is broken") 386dc4824faSMark RutlandASSERT(__relocate_new_kernel_start == arm64_relocate_new_kernel, 387dc4824faSMark Rutland "kexec control page does not start with arm64_relocate_new_kernel") 38819a046f0SPasha Tatashin#endif 389