x86: Add _CET_ENDBR to functions in crti.S
[glibc.git] / include / ifunc-impl-list.h
blobb437611ccc51d224b19534801eca31caa106d6e5
1 /* Internal header file for __libc_supported_implementations.
2 Copyright (C) 2012-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
19 #ifndef _IFUNC_IMPL_LIST_H
20 #define _IFUNC_IMPL_LIST_H 1
22 #include <stdbool.h>
23 #include <stddef.h>
25 struct libc_ifunc_impl
27 /* The name of function to be tested. */
28 const char *name;
29 /* The address of function to be tested. */
30 void (*fn) (void);
31 /* True if this implementation is usable on this machine. */
32 bool usable;
35 /* Add an IFUNC implementation, IMPL, for function FUNC, to ARRAY with
36 USABLE at index I and advance I by one. */
37 #define IFUNC_IMPL_ADD(array, i, func, usable, impl) \
38 extern __typeof (func) impl attribute_hidden; \
39 (array)[i++] = (struct libc_ifunc_impl) { #impl, (void (*) (void)) impl, (usable) };
41 /* Return the number of IFUNC implementations, N, for function FUNC if
42 string NAME matches FUNC. */
43 #define IFUNC_IMPL(n, name, func, ...) \
44 if (strcmp (name, #func) == 0) \
45 { \
46 __VA_ARGS__; \
47 return n; \
50 /* Fill ARRAY of MAX elements with IFUNC implementations for function
51 NAME and return the number of valid entries. */
52 extern size_t __libc_ifunc_impl_list (const char *name,
53 struct libc_ifunc_impl *array,
54 size_t max);
56 #endif /* ifunc-impl-list.h */