From a74fc341b922f38161d10a9470b63ad537e13f07 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 27 Aug 2002 19:38:14 +0000 Subject: Semonstrate a problem where weak symbols referenced in shared libs are not being overridden when those same symbols _are_ overridden by other shared libs in the main app. Ick. -Erik --- test/ldso/dlttest.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test/ldso/dlttest.c (limited to 'test/ldso/dlttest.c') diff --git a/test/ldso/dlttest.c b/test/ldso/dlttest.c new file mode 100644 index 000000000..591f5b56f --- /dev/null +++ b/test/ldso/dlttest.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include + +extern void _dlinfo(); +extern int __pthread_return_0 (void); +#undef __UCLIBC__ + +int main(int argc, char **argv) { + void *handle; + int (*myhowdy)(const char *s); + char *error; + +#ifdef __UCLIBC__ + _dlinfo(); /* not supported by ld.so.2 */ +#endif + + handle = dlopen ("./libhowdy.so", RTLD_LAZY); + + if (!handle) { + fputs (dlerror(), stderr); + exit(1); + } + + myhowdy = dlsym(handle, "howdy"); + if ((error = dlerror()) != NULL) { + fputs(error, stderr); + exit(1); + } + +#ifdef FORCE + printf("main: __pthread_return_0 = %p\n", __pthread_return_0); +#endif + myhowdy("hello world!\n"); + +#ifdef __UCLIBC__ + _dlinfo(); /* not supported by ld.so.2 */ +#endif + + dlclose(handle); + + return EXIT_SUCCESS; +} -- cgit v1.2.3