aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-ifunc/lib.c
blob: 5bfd2cd485b19ccf0e49cda10d5b5ad0794f6c52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
int
library_func1 (void)
{
  return 2;
}

int global = 1;

#ifdef WITH_IFUNC

static int minus_one (void) { return -1; }
static int zero (void) { return 0; }

void * library_func2_ifunc (void) __asm__ ("library_func2");
void * library_func2_ifunc (void) { return global ? minus_one : zero ; }
__asm__(".type library_func2, %gnu_indirect_function");

#else /* WITHOUT_IFUNC */

int
library_func2 (void)
{
  return 3;
}

#endif