xref: /freebsd/sys/arm/include/ifunc.h (revision c4fde87a3236b500246d4fce76dbca2a3d64f73a)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * Copyright (c) 2025, Michal Meloun <mmel@freebsd.org>
5  *
6  */
7 
8 #ifndef __ARM_IFUNC_H
9 #define	__ARM_IFUNC_H
10 
11 #include <sys/types.h>
12 
13 #define	DEFINE_IFUNC(qual, ret_type, name, args)			\
14     static ret_type (*__CONCAT(name, _resolver)(void))args __used;	\
15     qual ret_type name args						\
16 	__attribute__((ifunc(__XSTRING(name) "_resolver")));		\
17     static ret_type (*__CONCAT(name, _resolver)(void))args
18 
19 #ifdef __not_yet__
20 #define	DEFINE_UIFUNC(qual, ret_type, name, args)			\
21     static ret_type (*__CONCAT(name, _resolver)(uint32_t, uint32_t,	\
22 	uint32_t, uint32_t))args __used;				\
23     qual ret_type name args						\
24 	__attribute__((ifunc(__XSTRING(name) "_resolver")));		\
25     static ret_type (*__CONCAT(name, _resolver)(			\
26 	uint32_t elf_hwcap __unused,					\
27 	uint32_t elf_hwcap2 __unused,					\
28 	uint32_t arg3 __unused,						\
29 	uint32_t arg4 __unused))args
30 #endif
31 
32 #endif
33