about summary refs log tree commit diff
path: root/elf/initfirst.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-02-02 06:54:15 +0000
committerUlrich Drepper <drepper@redhat.com>2001-02-02 06:54:15 +0000
commitb71e7ce8641f7331de82cabea384359cf6d8546d (patch)
treee1e43e03961e7daaad13afa0cff3a4da30e7f791 /elf/initfirst.c
parent5d9167133cd1b614e2841eceba5d6c3828059254 (diff)
downloadglibc-b71e7ce8641f7331de82cabea384359cf6d8546d.tar.gz
glibc-b71e7ce8641f7331de82cabea384359cf6d8546d.tar.xz
glibc-b71e7ce8641f7331de82cabea384359cf6d8546d.zip
Update.
	* elf/Makefile: Add rules to build and run initfirst test.
	* elf/initfirst.c: New file.
	* elf/firstobj.c: New file.
Diffstat (limited to 'elf/initfirst.c')
-rw-r--r--elf/initfirst.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/elf/initfirst.c b/elf/initfirst.c
new file mode 100644
index 0000000000..5ca83d21bc
--- /dev/null
+++ b/elf/initfirst.c
@@ -0,0 +1,22 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+int
+main (void)
+{
+  void *h = dlopen ("firstobj.so", RTLD_LAZY);
+  void *f;
+  if (! h)
+    {
+      printf ("cannot find firstobj.so: %s\n", dlerror ());
+      return 1;
+    }
+  f = dlsym (h, "foo");
+  if (! f)
+    {
+      printf ("cannot find symbol foo: %s\n", dlerror ());
+      return 2;
+    }
+  ((void (*) (void)) f) ();
+  return 0;
+}