xref: /freebsd/sys/arm/include/ifunc.h (revision d78cbf483fe73c987573967042f57f15bf590629)
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 #define	DEFINE_IFUNC(qual, ret_type, name, args)			\
12     static ret_type (*name##_resolver(void))args __used;		\
13     qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\
14     static ret_type (*name##_resolver(void))args
15 
16 #ifdef __not_yet__
17 #define	DEFINE_UIFUNC(qual, ret_type, name, args)			\
18     static ret_type (*name##_resolver(uint32_t, uint32_t, uint32_t,	\
19 	uint32_t))args __used;						\
20     qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\
21     static ret_type (*name##_resolver(					\
22 	uint32_t elf_hwcap __unused,					\
23 	uint32_t elf_hwcap2 __unused,					\
24 	uint32_t arg3 __unused,						\
25 	uint32_t arg4 __unused))args
26 #endif
27 
28 #endif
29