Merge tag 'locking-urgent-2020-10-25' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / arch / arm64 / include / asm / linkage.h
1 #ifndef __ASM_LINKAGE_H
2 #define __ASM_LINKAGE_H
3
4 #define __ALIGN         .align 2
5 #define __ALIGN_STR     ".align 2"
6
7 #if defined(CONFIG_ARM64_BTI_KERNEL) && defined(__aarch64__)
8
9 /*
10  * Since current versions of gas reject the BTI instruction unless we
11  * set the architecture version to v8.5 we use the hint instruction
12  * instead.
13  */
14 #define BTI_C hint 34 ;
15
16 /*
17  * When using in-kernel BTI we need to ensure that PCS-conformant assembly
18  * functions have suitable annotations.  Override SYM_FUNC_START to insert
19  * a BTI landing pad at the start of everything.
20  */
21 #define SYM_FUNC_START(name)                            \
22         SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)      \
23         BTI_C
24
25 #define SYM_FUNC_START_NOALIGN(name)                    \
26         SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)       \
27         BTI_C
28
29 #define SYM_FUNC_START_LOCAL(name)                      \
30         SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)       \
31         BTI_C
32
33 #define SYM_FUNC_START_LOCAL_NOALIGN(name)              \
34         SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)        \
35         BTI_C
36
37 #define SYM_FUNC_START_WEAK(name)                       \
38         SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN)        \
39         BTI_C
40
41 #define SYM_FUNC_START_WEAK_NOALIGN(name)               \
42         SYM_START(name, SYM_L_WEAK, SYM_A_NONE)         \
43         BTI_C
44
45 #endif
46
47 /*
48  * Annotate a function as position independent, i.e., safe to be called before
49  * the kernel virtual mapping is activated.
50  */
51 #define SYM_FUNC_START_PI(x)                    \
52                 SYM_FUNC_START_ALIAS(__pi_##x); \
53                 SYM_FUNC_START(x)
54
55 #define SYM_FUNC_START_WEAK_PI(x)               \
56                 SYM_FUNC_START_ALIAS(__pi_##x); \
57                 SYM_FUNC_START_WEAK(x)
58
59 #define SYM_FUNC_END_PI(x)                      \
60                 SYM_FUNC_END(x);                \
61                 SYM_FUNC_END_ALIAS(__pi_##x)
62
63 #endif