about summary refs log tree commit diff
path: root/sysdeps/x86/tst-ifunc-cpu1-mod.c
blob: 08ff30f41eae27bc2d1aa53e2720ef951115bcca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;