This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
ldd output for sysinfo DSO
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Tue, 30 Sep 2003 11:16:27 -0400
- Subject: ldd output for sysinfo DSO
Right now, I get output from ldd that looks like this:
drow@nevyn:/big/fsf/glibc% /lib/ld-2.3.2.so --library-path . --list /bin/cat
libc.so.6 => ./libc.so.6 (0x40001000)
/lib/ld-linux.so.2 => /lib/ld-2.3.2.so (0x80000000)
The leading tab is because of the sysinfo DSO. Its address is in kernel
space, so writev() stops when it sees the pointer, and nothing gets written.
Here's a patch which changes the output to:
drow@nevyn:/big/fsf/glibc% ./elf/ld.so --library-path . --list /bin/cat
linux-gate.so.1 => linux-gate.so.1 (0x00000000)
libc.so.6 => ./libc.so.6 (0x40001000)
/lib/ld-linux.so.2 => ./elf/ld.so (0x80000000)
The other sensible alternative is to skip it entirely.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-09-30 Daniel Jacobowitz <drow@mvista.com>
* rtld.c (dl_main): Set l_libname and l_name for the sysinfo DSO.
Index: rtld.c
===================================================================
RCS file: /big/fsf/rsync/glibc-cvs/libc/elf/rtld.c,v
retrieving revision 1.293
diff -u -p -r1.293 rtld.c
--- rtld.c 24 Sep 2003 01:55:51 -0000 1.293
+++ rtld.c 30 Sep 2003 15:09:42 -0000
@@ -1177,8 +1177,14 @@ of this helper program; chances are you
/* Now that we have the info handy, use the DSO image's soname
so this object can be looked up by name. */
if (l->l_info[DT_SONAME] != NULL)
- l->l_libname->name = ((char *) D_PTR (l, l_info[DT_STRTAB])
+ {
+ char *dso_soname = ((char *) D_PTR (l, l_info[DT_STRTAB])
+ l->l_info[DT_SONAME]->d_un.d_val);
+ int len = strlen (dso_soname) + 1;
+ l->l_libname->name = malloc (strlen (dso_soname) + 1);
+ memcpy ((char *) l->l_libname->name, dso_soname, len);
+ l->l_name = l->l_libname->name;
+ }
}
}
#endif