This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: prelink two step


On Tue, 2003-02-18 at 20:53, Jakub Jelinek wrote:
> On Tue, Feb 18, 2003 at 08:38:21PM +1100, Antony Suter wrote:
> > 
> > If there is a more appropriate place to discuss prelink, please let me
> > know.
> > 
> > I am trying out prelink, however on some binaries it will fall into an
> > infinite recursive loop pattern. It is a two step cycle of prelink_ent()
> > in doit.c at line 58. For eg. the two libraries that keep checking each
> > other are /usr/lib/libgpm.so.1 and /lib/libncurses.so.5
> > 
> > Doesn't prelink normally cater for this type of situation?
> 
> Do you mean that libgpm.so.1 has DT_NEEDED libncurses.so.5 and
> libncurses.so.5 has DT_NEEDED libgpm.so.1?

Yes. These were both built around Sept. 2002 to a 2.2.5 version glibc,
which is standard Mandrake 9.

[root at gestalt root]# readelf -d /lib/libncurses.so.5
 
Dynamic segment at offset 0x42ec4 contains 22 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x00000001 (NEEDED)                     Shared library: [libgpm.so.1]
 0x0000000e (SONAME)                     Library soname:
[libncurses.so.5]
 0x0000000c (INIT)                       0xcee4
 0x0000000d (FINI)                       0x36134
...

[root at gestalt root]# readelf -d /usr/lib/libgpm.so.1
 
Dynamic segment at offset 0x497c contains 22 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library:
[libncurses.so.5]
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000e (SONAME)                     Library soname: [libgpm.so.1]
 0x0000000c (INIT)                       0x1490
 0x0000000d (FINI)                       0x4504
 0x00000004 (HASH)                       0x94
...

> prelink doesn't handle that. I haven't ever seen something like this and
> handling it would complicate the code too much (prelink handles a library
> at a time, dependency loop would mean it would have to work on a bunch of
> libraries at once).
> What I can add is just loop detection and don't prelink the libraries
> which have the loop.

I think it would be a good addition to prelink to make it generally more
robust.

> If two libraries depend on each other, it is fun to build them, isn't it?

Yeah. I suspect they don't need to be dependent on one another. I'll
check the latest Mandrake development versions.

Last night I had another problem with prelink. It left half of the
libraries in /lib and several programs in an invalid state. This
included my libc. I didnt find out until the next reboot. The typical
message from syslog (after restoring libc) was like:-

Feb 19 00:49:29 gestalt linuxconf: grep: error while loading shared
libraries: /lib/libpcre.so.0: invalid ELF header

-- 
- Antony Suter  (sutera internode on net)  "Exner"
- "Your post-apocalyptic caffeine source! :)"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]