2017-10-07 00:16:47 +00:00
|
|
|
int foo (int) __attribute__ ((ifunc ("resolve_foo")));
|
2017-04-10 11:32:00 +00:00
|
|
|
extern void abort (void);
|
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
static int
|
|
|
|
foo_impl (int x)
|
2017-04-10 11:32:00 +00:00
|
|
|
{
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
void
|
|
|
|
bar (void)
|
2017-04-10 11:32:00 +00:00
|
|
|
{
|
|
|
|
int (*f)(int) = foo;
|
|
|
|
|
|
|
|
if (foo (5) != 5)
|
|
|
|
abort ();
|
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
if (f (42) != 42)
|
2017-04-10 11:32:00 +00:00
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
void *
|
|
|
|
resolve_foo (void)
|
2017-04-10 11:32:00 +00:00
|
|
|
{
|
|
|
|
return (void *) foo_impl;
|
|
|
|
}
|