about summary refs log tree commit diff
path: root/elf
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
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')
-rw-r--r--elf/Makefile10
-rw-r--r--elf/firstobj.c8
-rw-r--r--elf/initfirst.c22
3 files changed, 37 insertions, 3 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 459d986e53..9d4bcdfe0e 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
+# Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -101,7 +101,7 @@ tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
 	constload1 order $(tests-vis-$(have-protected)) noload filter unload \
 	reldep reldep2 reldep3 next $(tests-nodelete-$(have-z-nodelete)) \
 	$(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \
-	neededtest3 neededtest4 unload2 lateglobal
+	neededtest3 neededtest4 unload2 lateglobal initfirst
 test-srcs = tst-pathopt
 tests-vis-yes = vismain
 tests-nodelete-yes = nodelete
@@ -114,7 +114,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		$(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \
 		reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2 \
 		neededobj1 neededobj2 neededobj3 neededobj4 \
-		neededobj5 neededobj6 \
+		neededobj5 neededobj6 firstobj \
 		unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj
 modules-vis-yes = vismod1 vismod2 vismod3
 modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4
@@ -268,6 +268,7 @@ $(objpfx)neededobj4.so: $(objpfx)neededobj1.so $(objpfx)neededobj2.so \
 $(objpfx)neededobj6.so: $(objpfx)neededobj5.so
 $(objpfx)unload2mod.so: $(objpfx)unload2dep.so
 $(objpfx)ltglobmod2.so: $(libdl)
+$(objpfx)firstobj.so: $(shared-thread-library)
 
 # filtmod1.so has a special rule
 $(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os
@@ -388,3 +389,6 @@ $(objpfx)tst-pathopt: $(libdl)
 $(objpfx)tst-pathopt.out: tst-pathopt.sh $(objpfx)tst-pathopt \
 			  $(objpfx)pathoptobj.so
 	$(SHELL) -e $< $(common-objpfx)
+
+$(objpfx)initfirst: $(libdl)
+$(objpfx)initfirst.out: $(objpfx)firstobj.so
diff --git a/elf/firstobj.c b/elf/firstobj.c
new file mode 100644
index 0000000000..1e7cb50fd2
--- /dev/null
+++ b/elf/firstobj.c
@@ -0,0 +1,8 @@
+#include <errno.h>
+
+int
+foo (void)
+{
+  errno = 0;
+  return 0;
+}
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;
+}