[gdb] Fix tsan warning: signal handler spoils errno
[binutils-gdb.git] / ld / testsuite / ld-ifunc / lib.c
blob4b24c23f9fafcad3eb19286f09bc36fbde31104b
1 int
2 library_func1 (void)
4 return 2;
7 int global = 1;
9 #ifdef WITH_IFUNC
11 static int minus_one (void) { return -1; }
12 static int zero (void) { return 0; }
14 void * library_func2_ifunc (void) __asm__ ("library_func2");
15 void * library_func2_ifunc (void) { return global ? minus_one : zero ; }
16 __asm__(".type library_func2, %gnu_indirect_function");
18 extern int library_func2 (int);
19 extern __typeof (library_func2) library_func2 __asm__ ("__GI_library_func2");
21 __asm__(".global __GI_library_func2");
22 __asm__(".hidden __GI_library_func2");
23 __asm__("__GI_library_func2 = library_func2");
25 int
26 library_func (int x)
28 return library_func2 (x);
31 #else /* WITHOUT_IFUNC */
33 int
34 library_func2 (void)
36 return 3;
39 #endif