From 3fac0001581df9237b58c0180bc7f968dfabc3c9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 6 Sep 2001 01:03:05 +0000 Subject: [PATCH] Update. 2001-09-05 Ulrich Drepper * 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. --- ChangeLog | 10 ++++++++++ elf/Makefile | 18 ++++++++++++++---- elf/dblload.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ elf/dblloadmod1.c | 7 +++++++ elf/dblloadmod2.c | 13 +++++++++++++ elf/dblloadmod3.c | 7 +++++++ elf/dblunload.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 157 insertions(+), 4 deletions(-) create mode 100644 elf/dblload.c create mode 100644 elf/dblloadmod1.c create mode 100644 elf/dblloadmod2.c create mode 100644 elf/dblloadmod3.c create mode 100644 elf/dblunload.c diff --git a/ChangeLog b/ChangeLog index b74c1b6..8b8cdd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-09-05 Ulrich Drepper + + * 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 * elf/elf.h (R_ALPHA_OP_*, R_ALPHA_IMMED_*): Remove. diff --git a/elf/Makefile b/elf/Makefile index 1418a8f..0831662 100644 --- a/elf/Makefile +++ b/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 diff --git a/elf/dblload.c b/elf/dblload.c new file mode 100644 index 0000000..52389a6 --- /dev/null +++ b/elf/dblload.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include + + +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; +} diff --git a/elf/dblloadmod1.c b/elf/dblloadmod1.c new file mode 100644 index 0000000..b10f366 --- /dev/null +++ b/elf/dblloadmod1.c @@ -0,0 +1,7 @@ +extern int bar (void); + +int +foo (void) +{ + return 10 + bar (); +} diff --git a/elf/dblloadmod2.c b/elf/dblloadmod2.c new file mode 100644 index 0000000..261af2b --- /dev/null +++ b/elf/dblloadmod2.c @@ -0,0 +1,13 @@ +extern int bar (void); + +int +baz (void) +{ + return -42; +} + +int +xyzzy (void) +{ + return 10 + bar (); +} diff --git a/elf/dblloadmod3.c b/elf/dblloadmod3.c new file mode 100644 index 0000000..22b8a04 --- /dev/null +++ b/elf/dblloadmod3.c @@ -0,0 +1,7 @@ +extern int baz (void); + +int +bar (void) +{ + return 32 + baz (); +} diff --git a/elf/dblunload.c b/elf/dblunload.c new file mode 100644 index 0000000..ab0b2a5 --- /dev/null +++ b/elf/dblunload.c @@ -0,0 +1,53 @@ +#include +#include +#include +#include + + +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; +} -- 2.7.4