mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-21 12:30:06 +00:00
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.
This commit is contained in:
parent
2f54c82dac
commit
2cb8cefbd4
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
7
elf/nodelmod3.c
Normal file
7
elf/nodelmod3.c
Normal file
@ -0,0 +1,7 @@
|
||||
extern int var_in_mod4;
|
||||
|
||||
int *
|
||||
addr (void)
|
||||
{
|
||||
return &var_in_mod4;
|
||||
}
|
1
elf/nodelmod4.c
Normal file
1
elf/nodelmod4.c
Normal file
@ -0,0 +1 @@
|
||||
int var_in_mod4 = 99;
|
15
elf/nodlopen.c
Normal file
15
elf/nodlopen.c
Normal file
@ -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;
|
||||
}
|
1
elf/nodlopenmod.c
Normal file
1
elf/nodlopenmod.c
Normal file
@ -0,0 +1 @@
|
||||
int a = 42;
|
Loading…
Reference in New Issue
Block a user