xref: /openbmc/linux/arch/riscv/kernel/image-vars.h (revision 11a163f2)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2020 Western Digital Corporation or its affiliates.
4  * Linker script variables to be set after section resolution, as
5  * ld.lld does not like variables assigned before SECTIONS is processed.
6  * Based on arch/arm64/kerne/image-vars.h
7  */
8 #ifndef __RISCV_KERNEL_IMAGE_VARS_H
9 #define __RISCV_KERNEL_IMAGE_VARS_H
10 
11 #ifndef LINKER_SCRIPT
12 #error This file should only be included in vmlinux.lds.S
13 #endif
14 
15 #ifdef CONFIG_EFI
16 
17 /*
18  * The EFI stub has its own symbol namespace prefixed by __efistub_, to
19  * isolate it from the kernel proper. The following symbols are legally
20  * accessed by the stub, so provide some aliases to make them accessible.
21  * Only include data symbols here, or text symbols of functions that are
22  * guaranteed to be safe when executed at another offset than they were
23  * linked at. The routines below are all implemented in assembler in a
24  * position independent manner
25  */
26 __efistub_memcmp		= memcmp;
27 __efistub_memchr		= memchr;
28 __efistub_memcpy		= memcpy;
29 __efistub_memmove		= memmove;
30 __efistub_memset		= memset;
31 __efistub_strlen		= strlen;
32 __efistub_strnlen		= strnlen;
33 __efistub_strcmp		= strcmp;
34 __efistub_strncmp		= strncmp;
35 __efistub_strrchr		= strrchr;
36 
37 #ifdef CONFIG_KASAN
38 __efistub___memcpy		= memcpy;
39 __efistub___memmove		= memmove;
40 __efistub___memset		= memset;
41 #endif
42 
43 __efistub__start		= _start;
44 __efistub__start_kernel		= _start_kernel;
45 __efistub__end			= _end;
46 __efistub__edata		= _edata;
47 __efistub_screen_info		= screen_info;
48 
49 #endif
50 
51 #endif /* __RISCV_KERNEL_IMAGE_VARS_H */
52