summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dlopen/Makefile.in4
-rw-r--r--test/dlopen/nodelete1.c59
2 files changed, 62 insertions, 1 deletions
diff --git a/test/dlopen/Makefile.in b/test/dlopen/Makefile.in
index 0bed0f749..740453a19 100644
--- a/test/dlopen/Makefile.in
+++ b/test/dlopen/Makefile.in
@@ -5,7 +5,7 @@
export UCLIBC_ONLY := 1
TESTS := dltest dltest2 dlstatic test1 test2 test3 dlundef dlafk dladdr \
- testscope nodelete tst-origin
+ testscope nodelete nodelete1 tst-origin
ifneq ($(HAVE_SHARED),y)
TESTS_DISABLED := test3
@@ -80,3 +80,5 @@ LDFLAGS_nodelete := -rdynamic -ldl
LDFLAGS_nodelmod1.so := -Wl,-z,nodelete
LDFLAGS_nodelmod3.so := ./nodelmod4.so
LDFLAGS_nodelmod4.so := -Wl,-z,nodelete
+nodelete1: nodelmod1.so nodelmod2.so
+LDFLAGS_nodelete1 := -rdynamic -ldl
diff --git a/test/dlopen/nodelete1.c b/test/dlopen/nodelete1.c
new file mode 100644
index 000000000..720e37fd1
--- /dev/null
+++ b/test/dlopen/nodelete1.c
@@ -0,0 +1,59 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
+int fini_ran;
+
+#define LIBNAME1 "nodelmod1.so"
+
+static int
+do_test (void)
+{
+ /* Verify ability to reload RTLD_NODELETE libraries.
+ */
+ void *p;
+
+ p = dlopen (LIBNAME1, RTLD_NOW);
+ if (p == NULL)
+ {
+ printf ("failed to load "LIBNAME1": %s\n", dlerror ());
+ exit (1);
+ }
+
+ if (dlclose (p) != 0)
+ {
+ puts ("failed to close "LIBNAME1"");
+ exit (1);
+ }
+
+ p = dlopen (LIBNAME1, RTLD_LAZY);
+ if (p == NULL)
+ {
+ printf ("failed to load "LIBNAME1": %s\n", dlerror ());
+ exit (1);
+ }
+
+ if (dlclose (p) != 0)
+ {
+ puts ("failed to close "LIBNAME1"");
+ exit (1);
+ }
+
+ p = dlopen ("nodelmod2.so", RTLD_LAZY);
+ if (p == NULL)
+ {
+ printf ("failed to load \"nodelmod2.so\": %s\n", dlerror ());
+ exit (1);
+ }
+ if (dlclose (p) != 0)
+ {
+ puts ("failed to close \"nodelmod2.so\"");
+ exit (1);
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"