mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 05:20:06 +00:00
Update.
2001-09-05 Ulrich Drepper <drepper@redhat.com> * elf/Makefile: Add rules to build new tests. Don't run them yet since they both fail. * elf/dblload.c: New file. * elf/dblloadmod1.c: New file. * elf/dblloadmod2.c: New file. * elf/dblloadmod3.c: New file. * elf/dblunload.c: New file.
This commit is contained in:
parent
9cd9ea1068
commit
3fac000158
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2001-09-05 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* elf/Makefile: Add rules to build new tests. Don't run them yet since
|
||||
they both fail.
|
||||
* elf/dblload.c: New file.
|
||||
* elf/dblloadmod1.c: New file.
|
||||
* elf/dblloadmod2.c: New file.
|
||||
* elf/dblloadmod3.c: New file.
|
||||
* elf/dblunload.c: New file.
|
||||
|
||||
2001-09-04 Richard Henderson <rth@redhat.com>
|
||||
|
||||
* elf/elf.h (R_ALPHA_OP_*, R_ALPHA_IMMED_*): Remove.
|
||||
|
18
elf/Makefile
18
elf/Makefile
@ -60,7 +60,8 @@ distribute := $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
|
||||
neededobj1.c neededobj2.c neededobj3.c neededobj4.c \
|
||||
neededobj5.c neededobj6.c firstobj.c \
|
||||
unload2mod.c unload2dep.c ltglobmod1.c ltglobmod2.c \
|
||||
testobj.h vismod.h globalmod1.c
|
||||
testobj.h vismod.h globalmod1.c \
|
||||
dblloadmod1.c dblloadmod2.c dblloadmod3.c
|
||||
|
||||
include ../Makeconfig
|
||||
|
||||
@ -102,10 +103,10 @@ endif
|
||||
ifeq (yes,$(build-shared))
|
||||
tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
|
||||
constload1 order $(tests-vis-$(have-protected)) noload filter unload \
|
||||
reldep reldep2 reldep3 reldep4 next $(tests-nodelete-$(have-z-nodelete)) \
|
||||
reldep reldep2 reldep3 reldep4 $(tests-nodelete-$(have-z-nodelete)) \
|
||||
$(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \
|
||||
neededtest3 neededtest4 unload2 lateglobal initfirst global \
|
||||
restest2
|
||||
restest2 next #dblload dblunload
|
||||
test-srcs = tst-pathopt
|
||||
tests-vis-yes = vismain
|
||||
tests-nodelete-yes = nodelete
|
||||
@ -120,7 +121,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
|
||||
reldep4mod1 reldep4mod2 reldep4mod3 reldep4mod4 \
|
||||
neededobj1 neededobj2 neededobj3 neededobj4 \
|
||||
neededobj5 neededobj6 firstobj globalmod1 \
|
||||
unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj
|
||||
unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
|
||||
dblloadmod1 dblloadmod2 dblloadmod3
|
||||
modules-vis-yes = vismod1 vismod2 vismod3
|
||||
modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4
|
||||
modules-nodlopen-yes = nodlopenmod
|
||||
@ -281,6 +283,8 @@ $(objpfx)firstobj.so: $(shared-thread-library)
|
||||
$(objpfx)globalmod1.so: $(libdl)
|
||||
$(objpfx)reldep4mod1.so: $(objpfx)reldep4mod3.so
|
||||
$(objpfx)reldep4mod2.so: $(objpfx)reldep4mod4.so
|
||||
$(objpfx)dblloadmod1.so: $(objpfx)dblloadmod3.so
|
||||
$(objpfx)dblloadmod2.so: $(objpfx)dblloadmod3.so
|
||||
|
||||
# filtmod1.so has a special rule
|
||||
$(filter-out $(objpfx)filtmod1.so, $(test-modules)): $(objpfx)%.so: $(objpfx)%.os
|
||||
@ -413,3 +417,9 @@ $(objpfx)initfirst.out: $(objpfx)firstobj.so
|
||||
|
||||
$(objpfx)global: $(objpfx)globalmod1.so
|
||||
$(objpfx)global.out: $(objpfx)reldepmod1.so
|
||||
|
||||
$(objpfx)dblload: $(libdl)
|
||||
$(objpfx)dblload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
|
||||
|
||||
$(objpfx)dblunload: $(libdl)
|
||||
$(objpfx)dblunload.out: $(objpfx)dblloadmod1.so $(objpfx)dblloadmod2.so
|
||||
|
53
elf/dblload.c
Normal file
53
elf/dblload.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <dlfcn.h>
|
||||
#include <mcheck.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
void *p1;
|
||||
void *p2;
|
||||
int (*fp) (void);
|
||||
int result;
|
||||
|
||||
mtrace ();
|
||||
|
||||
p1 = dlopen ("dblloadmod1.so", RTLD_LAZY);
|
||||
if (p1 == NULL)
|
||||
{
|
||||
printf ("cannot open dblloadmod1.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
p2 = dlopen ("dblloadmod2.so", RTLD_LAZY);
|
||||
if (p1 == NULL)
|
||||
{
|
||||
printf ("cannot open dblloadmod2.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fp = dlsym (p1, "foo");
|
||||
if (fp == NULL)
|
||||
{
|
||||
printf ("cannot get function \"foo\": %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
result = fp ();
|
||||
|
||||
if (dlclose (p1) != 0)
|
||||
{
|
||||
printf ("error while closing dblloadmod1.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (dlclose (p2) != 0)
|
||||
{
|
||||
printf ("error while closing dblloadmod2.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
7
elf/dblloadmod1.c
Normal file
7
elf/dblloadmod1.c
Normal file
@ -0,0 +1,7 @@
|
||||
extern int bar (void);
|
||||
|
||||
int
|
||||
foo (void)
|
||||
{
|
||||
return 10 + bar ();
|
||||
}
|
13
elf/dblloadmod2.c
Normal file
13
elf/dblloadmod2.c
Normal file
@ -0,0 +1,13 @@
|
||||
extern int bar (void);
|
||||
|
||||
int
|
||||
baz (void)
|
||||
{
|
||||
return -42;
|
||||
}
|
||||
|
||||
int
|
||||
xyzzy (void)
|
||||
{
|
||||
return 10 + bar ();
|
||||
}
|
7
elf/dblloadmod3.c
Normal file
7
elf/dblloadmod3.c
Normal file
@ -0,0 +1,7 @@
|
||||
extern int baz (void);
|
||||
|
||||
int
|
||||
bar (void)
|
||||
{
|
||||
return 32 + baz ();
|
||||
}
|
53
elf/dblunload.c
Normal file
53
elf/dblunload.c
Normal file
@ -0,0 +1,53 @@
|
||||
#include <dlfcn.h>
|
||||
#include <mcheck.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
void *p1;
|
||||
void *p2;
|
||||
int (*fp) (void);
|
||||
int result;
|
||||
|
||||
mtrace ();
|
||||
|
||||
p1 = dlopen ("dblloadmod1.so", RTLD_LAZY);
|
||||
if (p1 == NULL)
|
||||
{
|
||||
printf ("cannot load dblloadmod1.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
p2 = dlopen ("dblloadmod2.so", RTLD_LAZY);
|
||||
if (p2 == NULL)
|
||||
{
|
||||
printf ("cannot load dblloadmod2.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (dlclose (p1) != 0)
|
||||
{
|
||||
printf ("error while closing dblloadmod1.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fp = dlsym (p2, "xyzzy");
|
||||
if (fp == NULL)
|
||||
{
|
||||
printf ("cannot get function \"xyzzy\": %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
result = fp ();
|
||||
|
||||
if (dlclose (p2) != 0)
|
||||
{
|
||||
printf ("error while closing dblloadmod2.so: %s\n", dlerror ());
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
Loading…
Reference in New Issue
Block a user