summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-ifunc/lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-ifunc/lib.c')
-rw-r--r--ld/testsuite/ld-ifunc/lib.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ld/testsuite/ld-ifunc/lib.c b/ld/testsuite/ld-ifunc/lib.c
new file mode 100644
index 0000000000..5bfd2cd485
--- /dev/null
+++ b/ld/testsuite/ld-ifunc/lib.c
@@ -0,0 +1,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