about summary refs log tree commit diff
path: root/elf/tst-pathopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/tst-pathopt.c')
-rw-r--r--elf/tst-pathopt.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/elf/tst-pathopt.c b/elf/tst-pathopt.c
new file mode 100644
index 0000000000..1f7aac2a41
--- /dev/null
+++ b/elf/tst-pathopt.c
@@ -0,0 +1,39 @@
+#include <dlfcn.h>
+#include <mcheck.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+int
+main (void)
+{
+  void *h;
+  int (*fp) (int);
+  int result;
+
+  mtrace ();
+
+  h = dlopen ("renamed.so", RTLD_LAZY);
+  if (h == NULL)
+    {
+      printf ("failed to load \"%s\": %s\n", "renamed.so", dlerror ());
+      exit (1);
+    }
+
+  fp = dlsym (h, "in_renamed");
+  if (fp == NULL)
+    {
+      printf ("lookup of \"%s\" failed: %s\n", "in_renamed", dlerror ());
+      exit (1);
+    }
+
+  result = fp (10);
+
+  if (dlclose (h) != 0)
+    {
+      printf ("failed to close \"%s\": %s\n", "renamed.so", dlerror ());
+      exit (1);
+    }
+
+  return result;
+}