1 /* Test STT_GNU_IFUNC symbols with dlopen:
3 1. Direct function call.
5 3. Visibility with override.
12 typedef int (*foo_p
) (void);
15 __attribute__ ((noinline
))
22 __attribute__ ((noinline
))
29 __attribute__ ((noinline
))
42 void *h
= dlopen ("ifuncmod3.so", RTLD_LAZY
);
45 printf ("cannot load: %s\n", dlerror ());
52 printf ("symbol not found: %s\n", dlerror ());
58 f
= dlsym (h
, "get_foo_p");
61 printf ("symbol not found: %s\n", dlerror ());
65 ret
= dlsym (h
, "ret_foo");
68 printf ("symbol not found: %s\n", dlerror ());
77 if (*ret
!= -30 || (*p
) () != *ret
)
80 f
= dlsym (h
, "get_foo_hidden_p");
83 printf ("symbol not found: %s\n", dlerror ());
87 ret
= dlsym (h
, "ret_foo_hidden");
90 printf ("symbol not found: %s\n", dlerror ());
95 if (foo_hidden () != -20)
97 if (*ret
!= 1 || (*p
) () != *ret
)
100 f
= dlsym (h
, "get_foo_protected_p");
103 printf ("symbol not found: %s\n", dlerror ());
107 ret
= dlsym (h
, "ret_foo_protected");
110 printf ("symbol not found: %s\n", dlerror ());
115 if (p
== foo_protected
)
117 if (foo_protected () != -40)
119 if (*ret
!= 0 || (*p
) () != *ret
)
122 if (dlclose (h
) != 0)
124 printf ("cannot close: %s\n", dlerror ());