about summary refs log tree commit diff
path: root/sysdeps/x86/tst-ifunc-cpu1-mod.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/x86/tst-ifunc-cpu1-mod.c')
-rw-r--r--sysdeps/x86/tst-ifunc-cpu1-mod.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/sysdeps/x86/tst-ifunc-cpu1-mod.c b/sysdeps/x86/tst-ifunc-cpu1-mod.c
new file mode 100644
index 0000000000..08ff30f41e
--- /dev/null
+++ b/sysdeps/x86/tst-ifunc-cpu1-mod.c
@@ -0,0 +1,24 @@
+#include <init-arch.h>
+
+static void
+one (void)
+{
+}
+
+static void
+two (void)
+{
+}
+
+void * foo_ifunc (void) __asm__ ("foo") attribute_hidden;
+__asm__(".type foo, %gnu_indirect_function");
+
+void *
+foo_ifunc (void)
+{
+  const struct cpu_features * cpu = __get_cpu_features ();
+  return cpu->max_cpuid > 1 ? two : one;
+}
+
+extern void foo (void) attribute_hidden;
+void (*foo_ptr) (void) = foo;