Blame include/ifunc-impl-list.h

Packit 6c4009
/* Internal header file for __libc_supported_implementations.
Packit 6c4009
   Copyright (C) 2012-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _IFUNC_IMPL_LIST_H
Packit 6c4009
#define _IFUNC_IMPL_LIST_H	1
Packit 6c4009
Packit 6c4009
#include <stdbool.h>
Packit 6c4009
#include <stddef.h>
Packit 6c4009
Packit 6c4009
struct libc_ifunc_impl
Packit 6c4009
{
Packit 6c4009
  /* The name of function to be tested.  */
Packit 6c4009
  const char *name;
Packit 6c4009
  /* The address of function to be tested.  */
Packit 6c4009
  void (*fn) (void);
Packit 6c4009
  /* True if this implementation is usable on this machine.  */
Packit 6c4009
  bool usable;
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Add an IFUNC implementation, IMPL, for function FUNC, to ARRAY with
Packit 6c4009
   USABLE at index I and advance I by one.  */
Packit 6c4009
#define IFUNC_IMPL_ADD(array, i, func, usable, impl) \
Packit 6c4009
  extern __typeof (func) impl attribute_hidden; \
Packit 6c4009
  (array)[i++] = (struct libc_ifunc_impl) { #impl, (void (*) (void)) impl, (usable) };
Packit 6c4009
Packit 6c4009
/* Return the number of IFUNC implementations, N, for function FUNC if
Packit 6c4009
   string NAME matches FUNC.  */
Packit 6c4009
#define IFUNC_IMPL(n, name, func, ...) \
Packit 6c4009
  if (strcmp (name, #func) == 0) \
Packit 6c4009
    { \
Packit 6c4009
      __VA_ARGS__; \
Packit 6c4009
      return n; \
Packit 6c4009
    }
Packit 6c4009
Packit 6c4009
/* Fill ARRAY of MAX elements with IFUNC implementations for function
Packit 6c4009
   NAME and return the number of valid entries.  */
Packit 6c4009
extern size_t __libc_ifunc_impl_list (const char *name,
Packit 6c4009
				      struct libc_ifunc_impl *array,
Packit 6c4009
				      size_t max);
Packit 6c4009
Packit 6c4009
#endif /* ifunc-impl-list.h */