summary refs log tree commit diff
path: root/dlfcn/default.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-16 09:08:30 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-16 09:08:30 +0000
commit3fe400152688be6f4fea1f9dd07e8d8fe5be4e46 (patch)
treef2c6a8c68eb565146bb255c03de5435151bc98d6 /dlfcn/default.c
parentfe4901403f06f138c89fe428f69b9707fcabcc56 (diff)
downloadglibc-3fe400152688be6f4fea1f9dd07e8d8fe5be4e46.tar.gz
glibc-3fe400152688be6f4fea1f9dd07e8d8fe5be4e46.tar.xz
glibc-3fe400152688be6f4fea1f9dd07e8d8fe5be4e46.zip
Update.
2000-09-16  Ulrich Drepper  <drepper@redhat.com>

	* dlfcn/Makefile (distribute): Add defaultmod1.c and defaultmod2.c.
	(test): Add default.
	(modules-names): Add defaultmod1 and defaultmod2.
	Add rules to build test objects.
Diffstat (limited to 'dlfcn/default.c')
-rw-r--r--dlfcn/default.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/dlfcn/default.c b/dlfcn/default.c
new file mode 100644
index 0000000000..98c0b2a9b6
--- /dev/null
+++ b/dlfcn/default.c
@@ -0,0 +1,64 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+
+extern int test_in_mod1 (void *);
+extern int test_in_mod2 (void *);
+
+
+int
+main (int argc, char *argv[])
+{
+  int (*ifp) (void);
+  void *p;
+  int result = 0;
+
+  /* Find function `main'.  */
+  p = dlsym (RTLD_DEFAULT, "main");
+  if (p == NULL)
+    {
+      printf ("%s: main not found\n", __FILE__);
+      result = 1;
+    }
+  else if (p != (void *) &main)
+    {
+      printf ("%s: wrong address returned for main\n", __FILE__);
+      result = 1;
+    }
+  else
+    printf ("%s: main correctly found\n", __FILE__);
+
+  ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
+  if ((void *) ifp == NULL)
+    {
+      printf ("%s: found_in_mod1 not found\n", __FILE__);
+      result = 1;
+    }
+  else if (ifp () != 1)
+    {
+      printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
+      result = 1;
+    }
+  else
+    printf ("%s: found_in_mod1 correctly found\n", __FILE__);
+
+  ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
+  if ((void *) ifp == NULL)
+    {
+      printf ("%s: found_in_mod2 not found\n", __FILE__);
+      result = 1;
+    }
+  else if (ifp () != 2)
+    {
+      printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
+      result = 1;
+    }
+  else
+    printf ("%s: found_in_mod2 correctly found\n", __FILE__);
+
+  result |= test_in_mod1 ((void *) &main);
+
+  result |= test_in_mod2 ((void *) &main);
+
+  return result;
+}