From 85857f932b10330e5c96bedf15e81bcfc0207737 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 16 Nov 2000 02:17:26 +0000 Subject: Update. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2000-11-15 Jakub Jelinek * dlfcn/default.c (main): Add test for dladdr of main returning argv[0] in dli_fname field. 2000-11-15 Jakub Jelinek * Makeconfig (run-program-prefix): Move test-static test into the variable. * sysdeps/alpha/dl-machine.h (RTLD_START): Update _dl_argv. * sysdeps/sparc/sparc32/dl-machine.h (RTLD_START): Likewise, schedule instructions. * sysdeps/sparc/sparc64/dl-machine.h (RTLD_START): Likewise, schedule instructions, fix a bug in copying auxiliary data. * manual/startup.texi (Program Arguments): Fix type of main's envp parameter. Reported by Raúl Núñez de Arenas Coronado . --- dlfcn/default.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'dlfcn/default.c') diff --git a/dlfcn/default.c b/dlfcn/default.c index 98c0b2a9b6..e5d5275ff5 100644 --- a/dlfcn/default.c +++ b/dlfcn/default.c @@ -1,5 +1,6 @@ #include #include +#include extern int test_in_mod1 (void *); @@ -12,7 +13,22 @@ main (int argc, char *argv[]) int (*ifp) (void); void *p; int result = 0; - + Dl_info info; + + dladdr(main, &info); + if (info.dli_fname == NULL) + { + printf ("%s: dladdr returns NULL dli_fname\n", __FILE__); + result = 1; + } + else if (strcmp (info.dli_fname, argv[0])) + { + printf ("%s: dladdr returned '%s' as dli_fname\n", __FILE__, info.dli_fname); + result = 1; + } + else + printf ("%s: dladdr returned correct dli_fname\n", __FILE__); + /* Find function `main'. */ p = dlsym (RTLD_DEFAULT, "main"); if (p == NULL) -- cgit v1.2.1