Implement SSE4.2 optimized strchr and strrchr.
[glibc.git] / elf / ifuncmain1.c
blobde7ffe87793a5dc2b4966ab96012e386e3656e8d
1 /* Test STT_GNU_IFUNC symbols:
3 1. Direct function call.
4 2. Function pointer.
5 3. Visibility without override.
6 */
8 #include <stdlib.h>
10 int global = -1;
12 int ret_foo;
13 int ret_foo_hidden;
14 int ret_foo_protected;
16 extern int foo (void);
17 extern int foo_protected (void);
19 #ifndef FOO_P
20 typedef int (*foo_p) (void);
21 #endif
23 foo_p foo_ptr = foo;
24 foo_p foo_procted_ptr = foo_protected;
26 extern foo_p get_foo_p (void);
27 extern foo_p get_foo_hidden_p (void);
28 extern foo_p get_foo_protected_p (void);
30 int
31 main (void)
33 foo_p p;
35 if (foo_ptr != foo)
36 abort ();
37 if (foo () != -1)
38 abort ();
39 if ((*foo_ptr) () != -1)
40 abort ();
42 if (foo_procted_ptr != foo_protected)
43 abort ();
44 if (foo_protected () != 0)
45 abort ();
46 if ((*foo_procted_ptr) () != 0)
47 abort ();
49 p = get_foo_p ();
50 if (p != foo)
51 abort ();
52 if (ret_foo != -1 || (*p) () != ret_foo)
53 abort ();
55 p = get_foo_hidden_p ();
56 if (ret_foo_hidden != 1 || (*p) () != ret_foo_hidden)
57 abort ();
59 p = get_foo_protected_p ();
60 if (p != foo_protected)
61 abort ();
62 if (ret_foo_protected != 0 || (*p) () != ret_foo_protected)
63 abort ();
65 return 0;