162306a36Sopenharmony_ci#ifndef __ASM_LINKAGE_H
262306a36Sopenharmony_ci#define __ASM_LINKAGE_H
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#ifdef __ASSEMBLY__
562306a36Sopenharmony_ci#include <asm/assembler.h>
662306a36Sopenharmony_ci#endif
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#define __ALIGN		.balign CONFIG_FUNCTION_ALIGNMENT
962306a36Sopenharmony_ci#define __ALIGN_STR	".balign " #CONFIG_FUNCTION_ALIGNMENT
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci/*
1262306a36Sopenharmony_ci * When using in-kernel BTI we need to ensure that PCS-conformant
1362306a36Sopenharmony_ci * assembly functions have suitable annotations.  Override
1462306a36Sopenharmony_ci * SYM_FUNC_START to insert a BTI landing pad at the start of
1562306a36Sopenharmony_ci * everything, the override is done unconditionally so we're more
1662306a36Sopenharmony_ci * likely to notice any drift from the overridden definitions.
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci#define SYM_FUNC_START(name)				\
1962306a36Sopenharmony_ci	SYM_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)	\
2062306a36Sopenharmony_ci	bti c ;
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define SYM_FUNC_START_NOALIGN(name)			\
2362306a36Sopenharmony_ci	SYM_START(name, SYM_L_GLOBAL, SYM_A_NONE)	\
2462306a36Sopenharmony_ci	bti c ;
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#define SYM_FUNC_START_LOCAL(name)			\
2762306a36Sopenharmony_ci	SYM_START(name, SYM_L_LOCAL, SYM_A_ALIGN)	\
2862306a36Sopenharmony_ci	bti c ;
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define SYM_FUNC_START_LOCAL_NOALIGN(name)		\
3162306a36Sopenharmony_ci	SYM_START(name, SYM_L_LOCAL, SYM_A_NONE)	\
3262306a36Sopenharmony_ci	bti c ;
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define SYM_FUNC_START_WEAK(name)			\
3562306a36Sopenharmony_ci	SYM_START(name, SYM_L_WEAK, SYM_A_ALIGN)	\
3662306a36Sopenharmony_ci	bti c ;
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define SYM_FUNC_START_WEAK_NOALIGN(name)		\
3962306a36Sopenharmony_ci	SYM_START(name, SYM_L_WEAK, SYM_A_NONE)		\
4062306a36Sopenharmony_ci	bti c ;
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define SYM_TYPED_FUNC_START(name)				\
4362306a36Sopenharmony_ci	SYM_TYPED_START(name, SYM_L_GLOBAL, SYM_A_ALIGN)	\
4462306a36Sopenharmony_ci	bti c ;
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#endif
47