Fix unwind info in x86 memcmp-ssse3.
[glibc.git] / elf / ifuncmain7.c
blob617a596d5e8c92c28a5e3fcc82a99eebf5bd4d58
1 /* Test local STT_GNU_IFUNC symbols:
3 1. Direct function call.
4 2. Function pointer.
5 */
7 #include <stdlib.h>
8 #include "ifunc-sel.h"
10 extern int foo (void);
12 static int
13 one (void)
15 return -30;
18 static void * foo_ifunc (void) __asm__ ("foo");
19 __asm__(".type foo, %gnu_indirect_function");
21 static void *
22 __attribute__ ((used))
23 foo_ifunc (void)
25 return ifunc_one (one);
28 typedef int (*foo_p) (void);
30 foo_p foo_ptr = foo;
32 foo_p
33 __attribute__ ((noinline))
34 get_foo_p (void)
36 return foo_ptr;
39 foo_p
40 __attribute__ ((noinline))
41 get_foo (void)
43 return foo;
46 int
47 main (void)
49 foo_p p;
51 p = get_foo ();
52 if (p != foo)
53 abort ();
54 if ((*p) () != -30)
55 abort ();
57 p = get_foo_p ();
58 if (p != foo)
59 abort ();
60 if ((*p) () != -30)
61 abort ();
63 if (foo_ptr != foo)
64 abort ();
65 if ((*foo_ptr) () != -30)
66 abort ();
67 if (foo () != -30)
68 abort ();
70 return 0;