Fix gen-tgmath-tests.py for _Float64, _Float64x testing.
[glibc.git] / elf / ifuncmain7.c
blob1e8f7ea38ef94c0703d5177af30a56966371609d
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 inhibit_stack_protector
24 foo_ifunc (void)
26 return ifunc_one (one);
29 typedef int (*foo_p) (void);
31 foo_p foo_ptr = foo;
33 foo_p
34 __attribute__ ((noinline))
35 get_foo_p (void)
37 return foo_ptr;
40 foo_p
41 __attribute__ ((noinline))
42 get_foo (void)
44 return foo;
47 int
48 main (void)
50 foo_p p;
52 p = get_foo ();
53 if (p != foo)
54 abort ();
55 if ((*p) () != -30)
56 abort ();
58 p = get_foo_p ();
59 if (p != foo)
60 abort ();
61 if ((*p) () != -30)
62 abort ();
64 if (foo_ptr != foo)
65 abort ();
66 if ((*foo_ptr) () != -30)
67 abort ();
68 if (foo () != -30)
69 abort ();
71 return 0;