about summary refs log tree commit diff
path: root/elf/ifuncmod5.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/ifuncmod5.c')
-rw-r--r--elf/ifuncmod5.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/elf/ifuncmod5.c b/elf/ifuncmod5.c
index 2ca1c71541..9a08e8cf53 100644
--- a/elf/ifuncmod5.c
+++ b/elf/ifuncmod5.c
@@ -1,6 +1,7 @@
 /* Test STT_GNU_IFUNC symbols without direct function call.  */
+#include "ifunc-sel.h"
 
-extern int global;
+int global __attribute__ ((visibility ("protected"))) = -1;
 
 static int
 one (void)
@@ -26,15 +27,7 @@ __asm__(".type foo, %gnu_indirect_function");
 void *
 foo_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return minus_one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (one, minus_one, zero);
 }
 
 void * foo_hidden_ifunc (void) __asm__ ("foo_hidden");
@@ -43,15 +36,7 @@ __asm__(".type foo_hidden, %gnu_indirect_function");
 void *
 foo_hidden_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return minus_one;
-    case -1:
-      return one;
-    default:
-      return zero;
-    }
+  return ifunc_sel (minus_one, one, zero);
 }
 
 void * foo_protected_ifunc (void) __asm__ ("foo_protected");
@@ -60,15 +45,7 @@ __asm__(".type foo_protected, %gnu_indirect_function");
 void *
 foo_protected_ifunc (void)
 {
-  switch (global)
-    {
-    case 1:
-      return one;
-    case -1:
-      return zero;
-    default:
-      return minus_one;
-    }
+  return ifunc_sel (one, zero, minus_one);
 }
 
 /* Test hidden indirect function.  */