diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-07-21 04:42:21 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-07-21 04:42:21 +0000 |
commit | 2cb8cefbd42def9331fde5d8101b3f208440b60c (patch) | |
tree | e385f396a415ad549dc5f425a42b439ef079c71c | |
parent | 2f54c82dacba646139a773ab43fc2cdb47ee1f5b (diff) | |
download | glibc-2cb8cefbd42def9331fde5d8101b3f208440b60c.tar.gz glibc-2cb8cefbd42def9331fde5d8101b3f208440b60c.tar.xz glibc-2cb8cefbd42def9331fde5d8101b3f208440b60c.zip |
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.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | elf/Makefile | 7 | ||||
-rw-r--r-- | elf/nodelete.c | 54 | ||||
-rw-r--r-- | elf/nodelmod3.c | 7 | ||||
-rw-r--r-- | elf/nodelmod4.c | 1 | ||||
-rw-r--r-- | elf/nodlopen.c | 15 | ||||
-rw-r--r-- | elf/nodlopenmod.c | 1 |
7 files changed, 89 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 197b26dde4..7c1398459f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ 2000-07-20 Ulrich Drepper <drepper@redhat.com> + * 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/Makefile (tests): Add nodlopen. Add rules to generate nodlopen. + * elf/nodlopen.c: New file. + * elf/nodlopenmod.c: New file. * include/dlfcn.h: Define __RTLD_DLOPEN. * elf/dl-load.c (_dl_map_object_from_fd): If DF_1_NOOPEN is set and this is a dlopen() call, do not load the binary. diff --git a/elf/Makefile b/elf/Makefile index b18aafe8e7..2da8acaf41 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -98,7 +98,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ $(modules-nodelete-$(have-z-nodelete)) \ $(modules-nodlopen-$(have-z-nodlopen)) modules-vis-yes = vismod1 vismod2 vismod3 -modules-nodelete-yes = nodelmod1 nodelmod2 +modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4 modules-nodlopen-yes = nodlopenmod extra-objs += $(addsuffix .os,$(strip $(modules-names))) @@ -242,6 +242,7 @@ $(objpfx)failobj.so: $(objpfx)testobj6.so $(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 $(test-modules): $(objpfx)%.so: $(objpfx)%.os $(build-module) @@ -304,8 +305,10 @@ LDFLAGS-noload = -rdynamic $(objpfx)noload.out: $(objpfx)testobj5.so LDFLAGS-nodelmod1.so = -Wl,--enable-new-dtags,-z,nodelete +LDFLAGS-nodelmod4.so = -Wl,--enable-new-dtags,-z,nodelete $(objpfx)nodelete: $(libdl) -$(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so +$(objpfx)nodelete.out: $(objpfx)nodelmod1.so $(objpfx)nodelmod2.so \ + $(objpfx)nodelmod3.so LDFLAGS-nodlopenmod.so = -Wl,--enable-new-dtags,-z,nodlopen $(objpfx)nodlopen: $(libdl) 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; } diff --git a/elf/nodelmod3.c b/elf/nodelmod3.c new file mode 100644 index 0000000000..c48a1a696c --- /dev/null +++ b/elf/nodelmod3.c @@ -0,0 +1,7 @@ +extern int var_in_mod4; + +int * +addr (void) +{ + return &var_in_mod4; +} diff --git a/elf/nodelmod4.c b/elf/nodelmod4.c new file mode 100644 index 0000000000..55eb6e6dda --- /dev/null +++ b/elf/nodelmod4.c @@ -0,0 +1 @@ +int var_in_mod4 = 99; diff --git a/elf/nodlopen.c b/elf/nodlopen.c new file mode 100644 index 0000000000..642bdb3011 --- /dev/null +++ b/elf/nodlopen.c @@ -0,0 +1,15 @@ +#include <dlfcn.h> +#include <stdio.h> + +int +main (void) +{ + if (dlopen ("nodlopenmod.so", RTLD_LAZY) != NULL) + { + puts ("opening \"nodlopenmod.so\" succeeded, FAIL"); + return 1; + } + + puts ("opening \"nodlopenmod.so\" failed, OK"); + return 0; +} diff --git a/elf/nodlopenmod.c b/elf/nodlopenmod.c new file mode 100644 index 0000000000..4bcf8c9786 --- /dev/null +++ b/elf/nodlopenmod.c @@ -0,0 +1 @@ +int a = 42; |