18c2ecf20Sopenharmony_ci#ifndef __ASM_LINKAGE_H 28c2ecf20Sopenharmony_ci#define __ASM_LINKAGE_H 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#define __ALIGN .align 2 58c2ecf20Sopenharmony_ci#define __ALIGN_STR ".align 2" 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#if defined(CONFIG_ARM64_BTI_KERNEL) && defined(__aarch64__) 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci/* 108c2ecf20Sopenharmony_ci * Since current versions of gas reject the BTI instruction unless we 118c2ecf20Sopenharmony_ci * set the architecture version to v8.5 we use the hint instruction 128c2ecf20Sopenharmony_ci * instead. 138c2ecf20Sopenharmony_ci */ 148c2ecf20Sopenharmony_ci#define BTI_C hint 34 ; 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* 178c2ecf20Sopenharmony_ci * When using in-kernel BTI we need to ensure that PCS-conformant assembly 188c2ecf20Sopenharmony_ci * functions have suitable annotations. Override SYM_FUNC_START to insert 198c2ecf20Sopenharmony_ci * a BTI landing pad at the start of everything. 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_ci#define SYM_FUNC_START(name) \ 228c2ecf20Sopenharmony_ci SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN) \ 238c2ecf20Sopenharmony_ci BTI_C 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define SYM_FUNC_START_NOALIGN(name) \ 268c2ecf20Sopenharmony_ci SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE) \ 278c2ecf20Sopenharmony_ci BTI_C 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci#define SYM_FUNC_START_LOCAL(name) \ 308c2ecf20Sopenharmony_ci SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN) \ 318c2ecf20Sopenharmony_ci BTI_C 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define SYM_FUNC_START_LOCAL_NOALIGN(name) \ 348c2ecf20Sopenharmony_ci SYM_START(name, SYM_L_LOCAL, SYM_A_NONE) \ 358c2ecf20Sopenharmony_ci BTI_C 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define SYM_FUNC_START_WEAK(name) \ 388c2ecf20Sopenharmony_ci SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN) \ 398c2ecf20Sopenharmony_ci BTI_C 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#define SYM_FUNC_START_WEAK_NOALIGN(name) \ 428c2ecf20Sopenharmony_ci SYM_START(name, SYM_L_WEAK, SYM_A_NONE) \ 438c2ecf20Sopenharmony_ci BTI_C 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#endif 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* 488c2ecf20Sopenharmony_ci * Annotate a function as position independent, i.e., safe to be called before 498c2ecf20Sopenharmony_ci * the kernel virtual mapping is activated. 508c2ecf20Sopenharmony_ci */ 518c2ecf20Sopenharmony_ci#define SYM_FUNC_START_PI(x) \ 528c2ecf20Sopenharmony_ci SYM_FUNC_START_ALIAS(__pi_##x); \ 538c2ecf20Sopenharmony_ci SYM_FUNC_START(x) 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define SYM_FUNC_START_WEAK_PI(x) \ 568c2ecf20Sopenharmony_ci SYM_FUNC_START_ALIAS(__pi_##x); \ 578c2ecf20Sopenharmony_ci SYM_FUNC_START_WEAK(x) 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define SYM_FUNC_END_PI(x) \ 608c2ecf20Sopenharmony_ci SYM_FUNC_END(x); \ 618c2ecf20Sopenharmony_ci SYM_FUNC_END_ALIAS(__pi_##x) 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci#endif 64