about summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-07-29 15:22:28 -0700
committerUlrich Drepper <drepper@redhat.com>2009-07-29 15:22:28 -0700
commit9a1d2d455540ff99a586da5b550cc768f4f6fd5c (patch)
tree5a9409c3d0227294ddb39952a051de737839a959 /include
parent586fa886ad1473759cddf897691fd3c63a6d2360 (diff)
downloadglibc-9a1d2d455540ff99a586da5b550cc768f4f6fd5c.tar.gz
glibc-9a1d2d455540ff99a586da5b550cc768f4f6fd5c.tar.xz
glibc-9a1d2d455540ff99a586da5b550cc768f4f6fd5c.zip
Prepare use if IFUNC functions outside libc.so.
We use a callback function into libc.so to get access to the data
structure with the information and have special versions of the test
macros which automatically use this function.
Diffstat (limited to 'include')
-rw-r--r--include/libc-symbols.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 68da77c58e..252141eb01 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -1,6 +1,6 @@
 /* Support macros for making weak and strong aliases for symbols,
    and for using symbol sets and linker warnings with GNU ld.
-   Copyright (C) 1995-1998, 2000-2006, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998,2000-2006,2008,2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -845,6 +845,17 @@ for linking")
   }									\
   __asm__ (".type " #name ", %gnu_indirect_function");
 
+/* The body of the function is supposed to use __get_cpu_features
+   which will, if necessary, initialize the data first.  */
+#define libm_ifunc(name, expr)						\
+  extern void *name##_ifunc (void) __asm__ (#name);			\
+  void *name##_ifunc (void)						\
+  {									\
+    __typeof (name) *res = expr;					\
+    return res;								\
+  }									\
+  __asm__ (".type " #name ", %gnu_indirect_function");
+
 #ifdef HAVE_ASM_SET_DIRECTIVE
 # define libc_ifunc_hidden_def1(local, name)				\
     __asm__ (declare_symbol_alias_1_stringify (ASM_GLOBAL_DIRECTIVE)	\