Loading dynamic libraries on Linux in ups 3.33

From: Chris Siebenmann (cks_at_hawkwind.utcs.toronto.edu)
Date: Wed Feb 03 1999 - 09:20:47 GMT


 I am trying to make ups 3.33 go on my Linux machines (based on RedHat
5.1, so they have glibc 2.0.7 and kernel 2.0.36). I've applied the patch
for Debian 2 that's on the web site and the result compiles and mostly
runs, except for a problem or three with shared libraries.

 The most visible problem is that trying to debug a dynamically linked
executable will produce the message
	Can't open shared library /usr/lib/ld-linux.so.2: No such file or directory
(and pause the program, which one can continue from). This is somewhat
natural, given that ld-linux.so.2 is in /lib. No doubt related to this,
it didn't manage to get any names for shared library routines, listing
them all as 'bad text address <HEX>' (and periodically pausing the
program being debugged when it called one).

 Has anyone seen this? Has anyone managed to come up with a patch for
this?[*]

 Now we get technical:

 The immediate cure is to zap get_ld_path() in ups/ao_elflib.c to
explicitly search /lib (and any other directories one cares to add)
as well as everything else. However, I got curious as to why it was
asking to load the bare name 'ld-linux.so.2'. It turns out this is from
get_elf_shlib_info() calling it on DT_NEEDED dependencies of other
shared libraries; perhaps sensibly, those are listed under just the bare
name of the library, not the full path. But ... at this point in the
execution of the program, these libraries are already loaded (or going
to be loaded) under the full name. Would it be more correct for ups to
notice these duplicates and skip over them?

 If it is more correct to skip over them, what is the best approach?
I took a quick look at the Elfinfo structure and so on, but couldn't
figure out easily how the Libdep and Solib and Elfinfo structures are
all knitted together so one could search around them for libraries that
have soname's that duplicate the DT_NEEDED dependency we've just asked
for.

	- cks, who hopes this all makes sense
[*: in perhaps closely-related news, attempting to call out to shared
    library routines like strcmp() in interpreted code inside ups didn't
    work.]


This archive was generated by hypermail 2.1.4 : Wed Feb 13 2002 - 21:51:32 GMT