2002-02-17  Andreas Schwab  <schwab@suse.de>

	* reldep7.c: New file.
	* reldep7mod1.c: New file.
	* reldep7mod2.c: New file.
	* Makefile: Add rules to build and run reldep7.
This commit is contained in:
Ulrich Drepper 2002-04-15 17:10:22 +00:00
parent 78575a842b
commit a41d8a74ee
5 changed files with 96 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2002-02-17 Andreas Schwab <schwab@suse.de>
* reldep7.c: New file.
* reldep7mod1.c: New file.
* reldep7mod2.c: New file.
* Makefile: Add rules to build and run reldep7.
2002-04-14 Jakub Jelinek <jakub@redhat.com>
* elf/dl-lookup.c (_dl_lookup_symbol): Move add_dependency call to

View File

@ -65,7 +65,7 @@ distribute := $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
testobj.h vismod.h globalmod1.c \
dblloadmod1.c dblloadmod2.c dblloadmod3.c \
reldep6mod4.c reldep6mod3.c reldep6mod2.c reldep6mod1.c \
reldep6mod0.c \
reldep6mod0.c reldep7mod1.c reldep7mod2.c \
unwind-dw2.c unwind-dw2-fde.c unwind.h unwind-pe.h \
unwind-dw2-fde.h dwarf2.h dl-procinfo.c tls.h dl-tls.h \
tls-macros.h
@ -118,8 +118,8 @@ tests = loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
reldep reldep2 reldep3 reldep4 $(tests-nodelete-$(have-z-nodelete)) \
$(tests-nodlopen-$(have-z-nodlopen)) neededtest neededtest2 \
neededtest3 neededtest4 unload2 lateglobal initfirst global \
restest2 next dblload dblunload reldep5 reldep6 tst-tls1 tst-tls2 \
tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8
restest2 next dblload dblunload reldep5 reldep6 reldep7 tst-tls1 \
tst-tls2 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8
test-srcs = tst-pathopt
tests-vis-yes = vismain
tests-nodelete-yes = nodelete
@ -137,6 +137,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
unload2mod unload2dep ltglobmod1 ltglobmod2 pathoptobj \
dblloadmod1 dblloadmod2 dblloadmod3 reldepmod5 reldepmod6 \
reldep6mod0 reldep6mod1 reldep6mod2 reldep6mod3 reldep6mod4 \
reldep7mod1 reldep7mod2 \
tst-tlsmod1 tst-tlsmod2 tst-tlsmod3 tst-tlsmod4
modules-vis-yes = vismod1 vismod2 vismod3
modules-nodelete-yes = nodelmod1 nodelmod2 nodelmod3 nodelmod4
@ -444,6 +445,9 @@ $(objpfx)reldep5.out: $(objpfx)reldepmod5.so $(objpfx)reldepmod5.so
$(objpfx)reldep6: $(libdl)
$(objpfx)reldep6.out: $(objpfx)reldep6mod3.so $(objpfx)reldep6mod4.so
$(objpfx)reldep7: $(libdl)
$(objpfx)reldep7.out: $(objpfx)reldep7mod1.so $(objpfx)reldep7mod2.so
$(objpfx)tst-tls3: $(objpfx)tst-tlsmod1.so
$(objpfx)tst-tls4: $(libdl)

58
elf/reldep7.c Normal file
View File

@ -0,0 +1,58 @@
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
int
main (void)
{
void *h1;
void *h2;
void *mod1_bar, *mod2_bar;
h1 = dlopen ("reldep7mod1.so", RTLD_GLOBAL | RTLD_LAZY);
if (h1 == NULL)
{
printf ("cannot open reldep7mod1.so: %s\n", dlerror ());
exit (1);
}
h2 = dlopen ("reldep7mod2.so", RTLD_GLOBAL | RTLD_LAZY);
if (h2 == NULL)
{
printf ("cannot open reldep7mod1.so: %s\n", dlerror ());
exit (1);
}
mod1_bar = dlsym (h1, "mod1_bar");
if (mod1_bar == NULL)
{
printf ("cannot get address of \"mod1_bar\": %s\n", dlerror ());
exit (1);
}
mod2_bar = dlsym (h2, "mod2_bar");
if (mod2_bar == NULL)
{
printf ("cannot get address of \"mod2_bar\": %s\n", dlerror ());
exit (1);
}
printf ("%d\n", ((int (*) (void)) mod1_bar) ());
printf ("%d\n", ((int (*) (void)) mod2_bar) ());
if (dlclose (h1) != 0)
{
printf ("closing h1 failed: %s\n", dlerror ());
exit (1);
}
printf ("%d\n", ((int (*) (void)) mod2_bar) ());
if (dlclose (h2) != 0)
{
printf ("closing h2 failed: %s\n", dlerror ());
exit (1);
}
return 0;
}

12
elf/reldep7mod1.c Normal file
View File

@ -0,0 +1,12 @@
int foo (void) __attribute__ ((weak));
int
foo (void)
{
return 1;
}
int
mod1_bar (void)
{
return foo ();
}

12
elf/reldep7mod2.c Normal file
View File

@ -0,0 +1,12 @@
int foo (void) __attribute__ ((weak));
int
foo (void)
{
return 2;
}
int
mod2_bar (void)
{
return foo ();
}