Update.
2000-09-16 Ulrich Drepper <drepper@redhat.com> * dlfcn/Makefile (distribute): Add defaultmod1.c and defaultmod2.c. (test): Add default. (modules-names): Add defaultmod1 and defaultmod2. Add rules to build test objects.
This commit is contained in:
parent
fe4901403f
commit
3fe4001526
@ -1,3 +1,10 @@
|
||||
2000-09-16 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* dlfcn/Makefile (distribute): Add defaultmod1.c and defaultmod2.c.
|
||||
(test): Add default.
|
||||
(modules-names): Add defaultmod1 and defaultmod2.
|
||||
Add rules to build test objects.
|
||||
|
||||
2000-09-15 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* wctype/wctype.h: Always include <bits/types.h>.
|
||||
|
@ -20,7 +20,8 @@ subdir := dlfcn
|
||||
headers := bits/dlfcn.h dlfcn.h
|
||||
extra-libs := libdl
|
||||
libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr eval
|
||||
distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c eval.c
|
||||
distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c eval.c \
|
||||
defaultmod1.c defaultmod2.c
|
||||
|
||||
extra-libs-others := libdl
|
||||
|
||||
@ -33,9 +34,9 @@ endif
|
||||
libdl-shared-only-routines += eval
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
tests = glrefmain failtest tst-dladdr
|
||||
tests = glrefmain failtest tst-dladdr default
|
||||
endif
|
||||
modules-names = glreflib1 glreflib2 failtestmod
|
||||
modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2
|
||||
extra-objs += $(modules-names:=.os) eval.os
|
||||
generated := $(modules-names:=.so)
|
||||
|
||||
@ -56,3 +57,9 @@ $(objpfx)failtest.out: $(objpfx)failtestmod.so
|
||||
|
||||
$(objpfx)tst-dladdr: $(libdl)
|
||||
$(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so
|
||||
|
||||
LDFLAGS-default = -rdynamic
|
||||
$(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so
|
||||
$(objpfx)defaultmod1.so: $(libdl)
|
||||
LDFLAGS-defaultmod2.so = -Bsymbolic
|
||||
$(objpfx)defaultmod2.so: $(libdl)
|
||||
|
64
dlfcn/default.c
Normal file
64
dlfcn/default.c
Normal file
@ -0,0 +1,64 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
extern int test_in_mod1 (void *);
|
||||
extern int test_in_mod2 (void *);
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
int (*ifp) (void);
|
||||
void *p;
|
||||
int result = 0;
|
||||
|
||||
/* Find function `main'. */
|
||||
p = dlsym (RTLD_DEFAULT, "main");
|
||||
if (p == NULL)
|
||||
{
|
||||
printf ("%s: main not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (p != (void *) &main)
|
||||
{
|
||||
printf ("%s: wrong address returned for main\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: main correctly found\n", __FILE__);
|
||||
|
||||
ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
|
||||
if ((void *) ifp == NULL)
|
||||
{
|
||||
printf ("%s: found_in_mod1 not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (ifp () != 1)
|
||||
{
|
||||
printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: found_in_mod1 correctly found\n", __FILE__);
|
||||
|
||||
ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
|
||||
if ((void *) ifp == NULL)
|
||||
{
|
||||
printf ("%s: found_in_mod2 not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (ifp () != 2)
|
||||
{
|
||||
printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: found_in_mod2 correctly found\n", __FILE__);
|
||||
|
||||
result |= test_in_mod1 ((void *) &main);
|
||||
|
||||
result |= test_in_mod2 ((void *) &main);
|
||||
|
||||
return result;
|
||||
}
|
62
dlfcn/defaultmod1.c
Normal file
62
dlfcn/defaultmod1.c
Normal file
@ -0,0 +1,62 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
found_in_mod1 (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
test_in_mod1 (void *mainp)
|
||||
{
|
||||
int (*ifp) (void);
|
||||
void *p;
|
||||
int result = 0;
|
||||
|
||||
/* Find function `main'. */
|
||||
p = dlsym (RTLD_DEFAULT, "main");
|
||||
if (p == NULL)
|
||||
{
|
||||
printf ("%s: main not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (p != mainp)
|
||||
{
|
||||
printf ("%s: wrong address returned for main\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: main correctly found\n", __FILE__);
|
||||
|
||||
ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
|
||||
if ((void *) ifp == NULL)
|
||||
{
|
||||
printf ("%s: found_in_mod1 not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (ifp () != 1)
|
||||
{
|
||||
printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: found_in_mod1 correctly found\n", __FILE__);
|
||||
|
||||
ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
|
||||
if ((void *) ifp == NULL)
|
||||
{
|
||||
printf ("%s: found_in_mod2 not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (ifp () != 2)
|
||||
{
|
||||
printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: found_in_mod2 correctly found\n", __FILE__);
|
||||
|
||||
return result;
|
||||
}
|
68
dlfcn/defaultmod2.c
Normal file
68
dlfcn/defaultmod2.c
Normal file
@ -0,0 +1,68 @@
|
||||
#include <dlfcn.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int
|
||||
found_in_mod1 (void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
found_in_mod2 (void)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
test_in_mod2 (void *mainp)
|
||||
{
|
||||
int (*ifp) (void);
|
||||
void *p;
|
||||
int result = 0;
|
||||
|
||||
/* Find function `main'. */
|
||||
p = dlsym (RTLD_DEFAULT, "main");
|
||||
if (p == NULL)
|
||||
{
|
||||
printf ("%s: main not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (p != mainp)
|
||||
{
|
||||
printf ("%s: wrong address returned for main\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: main correctly found\n", __FILE__);
|
||||
|
||||
ifp = dlsym (RTLD_DEFAULT, "found_in_mod1");
|
||||
if ((void *) ifp == NULL)
|
||||
{
|
||||
printf ("%s: found_in_mod1 not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (ifp () != 1)
|
||||
{
|
||||
printf ("%s: wrong address returned for found_in_mod1\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: found_in_mod1 correctly found\n", __FILE__);
|
||||
|
||||
ifp = dlsym (RTLD_DEFAULT, "found_in_mod2");
|
||||
if ((void *) ifp == NULL)
|
||||
{
|
||||
printf ("%s: found_in_mod2 not found\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else if (ifp () != 2)
|
||||
{
|
||||
printf ("%s: wrong address returned for found_in_mod2\n", __FILE__);
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
printf ("%s: found_in_mod2 correctly found\n", __FILE__);
|
||||
|
||||
return result;
|
||||
}
|
Loading…
Reference in New Issue
Block a user