xref: /linux/arch/arm64/kernel/image-vars.h (revision 7621712918ad4f5e6356193d9058debf657a6254)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Linker script variables to be set after section resolution, as
4  * ld.lld does not like variables assigned before SECTIONS is processed.
5  */
6 #ifndef __ARM64_KERNEL_IMAGE_VARS_H
7 #define __ARM64_KERNEL_IMAGE_VARS_H
8 
9 #ifndef LINKER_SCRIPT
10 #error This file should only be included in vmlinux.lds.S
11 #endif
12 
13 #ifdef CONFIG_EFI
14 
15 __efistub_kernel_size		= _edata - _text;
16 __efistub_primary_entry_offset	= primary_entry - _text;
17 
18 
19 /*
20  * The EFI stub has its own symbol namespace prefixed by __efistub_, to
21  * isolate it from the kernel proper. The following symbols are legally
22  * accessed by the stub, so provide some aliases to make them accessible.
23  * Only include data symbols here, or text symbols of functions that are
24  * guaranteed to be safe when executed at another offset than they were
25  * linked at. The routines below are all implemented in assembler in a
26  * position independent manner
27  */
28 __efistub_memcmp		= __pi_memcmp;
29 __efistub_memchr		= __pi_memchr;
30 __efistub_memcpy		= __pi_memcpy;
31 __efistub_memmove		= __pi_memmove;
32 __efistub_memset		= __pi_memset;
33 __efistub_strlen		= __pi_strlen;
34 __efistub_strnlen		= __pi_strnlen;
35 __efistub_strcmp		= __pi_strcmp;
36 __efistub_strncmp		= __pi_strncmp;
37 __efistub_strrchr		= __pi_strrchr;
38 __efistub___clean_dcache_area_poc = __pi___clean_dcache_area_poc;
39 
40 #ifdef CONFIG_KASAN
41 __efistub___memcpy		= __pi_memcpy;
42 __efistub___memmove		= __pi_memmove;
43 __efistub___memset		= __pi_memset;
44 #endif
45 
46 __efistub__text			= _text;
47 __efistub__end			= _end;
48 __efistub__edata		= _edata;
49 __efistub_screen_info		= screen_info;
50 __efistub__ctype		= _ctype;
51 
52 #endif
53 
54 #ifdef CONFIG_KVM
55 
56 /*
57  * KVM nVHE code has its own symbol namespace prefixed with __kvm_nvhe_, to
58  * separate it from the kernel proper. The following symbols are legally
59  * accessed by it, therefore provide aliases to make them linkable.
60  * Do not include symbols which may not be safely accessed under hypervisor
61  * memory mappings.
62  */
63 
64 #define KVM_NVHE_ALIAS(sym) __kvm_nvhe_##sym = sym;
65 
66 #endif /* CONFIG_KVM */
67 
68 #endif /* __ARM64_KERNEL_IMAGE_VARS_H */
69