about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-15 17:35:04 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-15 17:35:04 +0000
commit917fd0616395f800489f223140967cb61a5a5765 (patch)
tree506087329db9e9601202f9d039ddebe2bbdceb2f /elf
parentea4d748699466c16acff05b7bc75fdda7ff3d8c2 (diff)
downloadglibc-917fd0616395f800489f223140967cb61a5a5765.tar.gz
glibc-917fd0616395f800489f223140967cb61a5a5765.tar.xz
glibc-917fd0616395f800489f223140967cb61a5a5765.zip
Update.
2000-09-15  Ulrich Drepper  <drepper@redhat.com>

	* elf/Makefile (distribute): Add nextmod1.c and nextmod2.c.
	(tests): Add next.
	(modules-names): Add nextmod1 and nextmod2.
	Add rules to build and run next.
	* elf/next.c: New file.
	* elf/nextmod1.c: New file.
	* elf/nextmod2.c: New file.

2000-09-14  Jakub Jelinek  <jakub@redhat.com>

	* elf/dl-lookup.c (_dl_lookup_symbol_skip): Fix a typo.
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile10
-rw-r--r--elf/next.c44
-rw-r--r--elf/nextmod1.c20
-rw-r--r--elf/nextmod2.c6
4 files changed, 77 insertions, 3 deletions
diff --git a/elf/Makefile b/elf/Makefile
index 2932183028..0fc81e021f 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -51,7 +51,8 @@ distribute	:= $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
 		   constload2.c constload3.c filtmod1.c filtmod2.c \
 		   nodlopenmod.c nodelete.c nodelmod1.c nodelmod2.c \
 		   nodelmod3.c nodelmod4.c nodlopen.c dl-osinfo.h \
-		   reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c
+		   reldepmod1.c reldepmod2.c reldepmod3.c reldepmod4.c \
+		   nextmod1.c nextmod2.c
 
 include ../Makeconfig
 
@@ -92,7 +93,7 @@ endif
 ifeq (yes,$(build-shared))
 tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
 	constload1 order $(tests-vis-$(have-protected)) noload filter unload \
-	reldep reldep2 reldep3 $(tests-nodelete-$(have-z-nodelete)) \
+	reldep reldep2 reldep3 next $(tests-nodelete-$(have-z-nodelete)) \
 	$(tests-nodlopen-$(have-z-nodlopen))
 tests-vis-yes = vismain
 tests-nodelete-yes = nodelete
@@ -103,7 +104,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
 		dep1 dep2 dep3 dep4 $(modules-vis-$(have-protected)) \
 		$(modules-nodelete-$(have-z-nodelete)) \
 		$(modules-nodlopen-$(have-z-nodlopen)) filtmod1 filtmod2 \
-		reldepmod1 reldepmod2 reldepmod3 reldepmod4
+		reldepmod1 reldepmod2 reldepmod3 reldepmod4 nextmod1 nextmod2
 modules-vis-yes = vismod1 vismod2 vismod3
 modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4
 modules-nodlopen-yes = nodlopenmod
@@ -245,6 +246,7 @@ $(objpfx)dep1.so: $(objpfx)dep2.so $(objpfx)dep4.so
 $(objpfx)dep2.so: $(objpfx)dep3.so $(objpfx)dep4.so
 $(objpfx)dep4.so: $(objpfx)dep3.so
 $(objpfx)nodelmod3.so: $(objpfx)nodelmod4.so
+$(objpfx)nextmod1.so: $(libdl)
 
 # filtmod1.so has a special rule
 $(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os
@@ -336,3 +338,5 @@ $(objpfx)reldep2.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod3.so
 
 $(objpfx)reldep3: $(libdl)
 $(objpfx)reldep3.out: $(objpfx)reldepmod1.so $(objpfx)reldepmod4.so
+
+$(objpfx)next: $(objpfx)nextmod1.so $(objpfx)nextmod2.so $(libdl)
diff --git a/elf/next.c b/elf/next.c
new file mode 100644
index 0000000000..a7ca2bdbc2
--- /dev/null
+++ b/elf/next.c
@@ -0,0 +1,44 @@
+#include <stdio.h>
+
+
+extern int successful_rtld_next_test (void);
+extern void *failing_rtld_next_use (void);
+
+
+int
+do_test (void)
+{
+  int result;
+  void *addr;
+
+  /* First try call a function which uses RTLD_NEXT and calls that
+     function.  */
+  result = successful_rtld_next_test ();
+  if (result == 42)
+    {
+      puts ("RTLD_NEXT seems to work for existing functions");
+      result = 0;
+    }
+  else
+    {
+      printf ("Heh?  `successful_rtld_next_test' returned %d\n", result);
+      result = 1;
+    }
+
+  /* Next try a function which tries to get a function with RTLD_NEXT
+     but that fails.  This dlsym() call should return a NULL pointer
+     and do nothing else.  */
+  addr = failing_rtld_next_use ();
+  if (addr == NULL)
+    puts ("dlsym returned NULL for non-existing function.  Good");
+  else
+    {
+      puts ("dlsym found something !?");
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/elf/nextmod1.c b/elf/nextmod1.c
new file mode 100644
index 0000000000..3549c75174
--- /dev/null
+++ b/elf/nextmod1.c
@@ -0,0 +1,20 @@
+#include <dlfcn.h>
+
+int
+successful_rtld_next_test (void)
+{
+  int (*fp) (void);
+
+  /* Get the next function... */
+  fp = (int (*) (void)) dlsym (RTLD_NEXT, __FUNCTION__);
+
+  /* ...and simply call it.  */
+  return fp ();
+}
+
+
+void *
+failing_rtld_next_use (void)
+{
+  return dlsym (RTLD_NEXT, __FUNCTION__);
+}
diff --git a/elf/nextmod2.c b/elf/nextmod2.c
new file mode 100644
index 0000000000..790e0ce9fe
--- /dev/null
+++ b/elf/nextmod2.c
@@ -0,0 +1,6 @@
+/* Very elaborated function.  */
+int
+successful_rtld_next_test (void)
+{
+  return 42;
+}