about summary refs log tree commit diff
path: root/dlfcn/default.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-11-16 02:17:26 +0000
committerUlrich Drepper <drepper@redhat.com>2000-11-16 02:17:26 +0000
commit85857f932b10330e5c96bedf15e81bcfc0207737 (patch)
tree24cb6d5dd63007daf1fd3d87171dc1c3ec838b8f /dlfcn/default.c
parent821dcbccd172d8f35644cd6da81337cc739dde94 (diff)
downloadglibc-85857f932b10330e5c96bedf15e81bcfc0207737.tar.gz
glibc-85857f932b10330e5c96bedf15e81bcfc0207737.tar.xz
glibc-85857f932b10330e5c96bedf15e81bcfc0207737.zip
Update.
2000-11-15  Jakub Jelinek  <jakub@redhat.com>

	* dlfcn/default.c (main): Add test for dladdr of main returning
	argv[0] in dli_fname field.

2000-11-15  Jakub Jelinek  <jakub@redhat.com>

	* 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 <dervishd@linuxfreak.com>.
Diffstat (limited to 'dlfcn/default.c')
-rw-r--r--dlfcn/default.c18
1 files changed, 17 insertions, 1 deletions
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 <dlfcn.h>
 #include <stdio.h>
+#include <string.h>
 
 
 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)