From 2cb8cefbd42def9331fde5d8101b3f208440b60c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 21 Jul 2000 04:42:21 +0000 Subject: Update. * elf/Makefile: Add no modules for nodelete test. * elf/nodelmod3.c: New file. * elf/nodelmod4.c: New file. * elf/nodelete.c: Also test case where dependency of dlopen() object is marked nodelete. * elf/nodlopen.c: New file. * elf/nodlopenmod.c: New file. --- elf/nodelete.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'elf/nodelete.c') diff --git a/elf/nodelete.c b/elf/nodelete.c index 317a2a03e1..0a87e02480 100644 --- a/elf/nodelete.c +++ b/elf/nodelete.c @@ -41,7 +41,7 @@ do_test (void) p = dlopen ("nodelmod1.so", RTLD_LAZY); if (p == NULL) { - puts ("failed to load \"nodelmod1.so\""); + printf ("failed to load \"nodelmod1.so\": %s\n", dlerror ()); result = 1; } else @@ -89,7 +89,7 @@ do_test (void) p = dlopen ("nodelmod2.so", RTLD_LAZY | RTLD_NODELETE); if (p == NULL) { - puts ("failed to load \"nodelmod2.so\""); + printf ("failed to load \"nodelmod2.so\": %s\n", dlerror ()); result = 1; } else @@ -134,6 +134,56 @@ do_test (void) } } + p = dlopen ("nodelmod3.so", RTLD_LAZY); + if (p == NULL) + { + printf ("failed to load \"nodelmod3.so\": %s\n", dlerror ()); + result = 1; + } + else + { + int *(*fctp) (void); + + puts ("succeeded loading \"nodelmod3.so\""); + + fctp = dlsym (p, "addr"); + if (fctp == NULL) + { + puts ("failed to get address of \"addr\" in \"nodelmod3.so\""); + result = 1; + } + else + { + int *varp = fctp (); + + *varp = -1; + + /* Now close the object. */ + if (dlclose (p) != 0) + { + puts ("failed to close \"nodelmod3.so\""); + result = 1; + } + else if (! sigsetjmp (jmpbuf, 1)) + { + /* Access the variable again. */ + if (*varp != -1) + { + puts ("\"var_in_mod4\" value not correct"); + result = 1; + } + else + puts ("-z nodelete in dependency succeeded"); + } + else + { + /* We caught an segmentation fault. */ + puts ("\"nodelmod4.so\" got deleted"); + result = 1; + } + } + } + return result; } -- cgit v1.2.1