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 ());
49 f
= dlsym (h
, "get_foo_p");
52 printf ("symbol not found: %s\n", dlerror ());
56 ret
= dlsym (h
, "ret_foo");
59 printf ("symbol not found: %s\n", dlerror ());
68 if (*ret
!= -30 || (*p
) () != *ret
)
71 f
= dlsym (h
, "get_foo_hidden_p");
74 printf ("symbol not found: %s\n", dlerror ());
78 ret
= dlsym (h
, "ret_foo_hidden");
81 printf ("symbol not found: %s\n", dlerror ());
86 if (foo_hidden () != -20)
88 if (*ret
!= 1 || (*p
) () != *ret
)
91 f
= dlsym (h
, "get_foo_protected_p");
94 printf ("symbol not found: %s\n", dlerror ());
98 ret
= dlsym (h
, "ret_foo_protected");
101 printf ("symbol not found: %s\n", dlerror ());
106 if (p
== foo_protected
)
108 if (foo_protected () != -40)
110 if (*ret
!= 0 || (*p
) () != *ret
)
113 if (dlclose (h
) != 0)
115 printf ("cannot close: %s\n", dlerror ());