about summary refs log tree commit diff
path: root/elf
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-03-17 02:17:59 +0000
committerUlrich Drepper <drepper@redhat.com>2000-03-17 02:17:59 +0000
commit19cf43bed69d9952c39391f42f22114afb3a0d3f (patch)
tree15725e3712fc919ec7d670c42ba0e66d5d41e53d /elf
parent13a836048c08f552187f2172cb362fb98f42c965 (diff)
downloadglibc-19cf43bed69d9952c39391f42f22114afb3a0d3f.tar.gz
glibc-19cf43bed69d9952c39391f42f22114afb3a0d3f.tar.xz
glibc-19cf43bed69d9952c39391f42f22114afb3a0d3f.zip
Update.
2000-03-16  Ulrich Drepper  <drepper@redhat.com>

	* elf/Makefile: Add rules to compile and rune constload1 test.
	* elf/constload1.c: New file.
	* elf/constload2.c: New file.
	* elf/constload3.c: New file.
Diffstat (limited to 'elf')
-rw-r--r--elf/Makefile10
-rw-r--r--elf/constload1.c20
-rw-r--r--elf/constload2.c24
-rw-r--r--elf/constload3.c7
4 files changed, 58 insertions, 3 deletions
diff --git a/elf/Makefile b/elf/Makefile
index b262418d19..1244e239b6 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1995-1999, 2000 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
@@ -79,10 +79,11 @@ vpath %.c ../locale/programs
 endif
 
 ifeq (yes,$(build-shared))
-tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail
+tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
+	constload1
 endif
 modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
-		testobj1_1 failobj
+		testobj1_1 failobj constload2 constload3
 extra-objs += $(modules-names:=.os)
 
 include ../Rules
@@ -251,3 +252,6 @@ $(objpfx)resolvfail: $(libdl) $(shared-thread-library)
 else
 $(objpfx)resolvfail: $(libdl)
 endif
+
+$(objpfx)constload1: $(libdl)
+$(objpfx)constload1.out: $(objpfx)constload2.so $(objpfx)constload3.so
diff --git a/elf/constload1.c b/elf/constload1.c
new file mode 100644
index 0000000000..1435284c62
--- /dev/null
+++ b/elf/constload1.c
@@ -0,0 +1,20 @@
+#include <dlfcn.h>
+#include <errno.h>
+#include <error.h>
+#include <stdlib.h>
+
+int
+main (void)
+{
+  int (*foo) (void);
+  void *h;
+  int ret;
+
+  h = dlopen ("constload2.so", RTLD_LAZY | RTLD_GLOBAL);
+  if (h == NULL)
+    error (EXIT_FAILURE, errno, "cannot load module \"constload2.so\"");
+  foo = dlsym (h, "foo");
+  ret = foo ();
+  dlclose (h);
+  return ret;
+}
diff --git a/elf/constload2.c b/elf/constload2.c
new file mode 100644
index 0000000000..f109838cb8
--- /dev/null
+++ b/elf/constload2.c
@@ -0,0 +1,24 @@
+#include <dlfcn.h>
+
+extern int bar (void);
+
+void *h;
+
+int
+foo (void)
+{
+  return 42 + bar ();
+}
+
+int
+baz (void)
+{
+  return -21;
+}
+
+void
+__attribute__ ((__constructor__))
+init (void)
+{
+  h = dlopen ("constload3.so", RTLD_GLOBAL | RTLD_LAZY);
+}
diff --git a/elf/constload3.c b/elf/constload3.c
new file mode 100644
index 0000000000..c9f94b86ee
--- /dev/null
+++ b/elf/constload3.c
@@ -0,0 +1,7 @@
+extern int baz (void);
+
+int
+bar (void)
+{
+  return -21 + baz ();
+}