[Gllug] pimping my elf

Christian Smith csmith at thewrongchristian.org.uk
Wed Jun 14 15:29:01 UTC 2006


Alex Sayle uttered:

>
> Hello fellow Gllugers,
>
> I have a rather obscure question that my google-fu has yet to yield
> and answer to and was hoping that someone could shed some light on it.
>
> Firstly I must explain how our environment works, we use a lot of FOSS
> libraries and for the sake of backwards compatibility we keep them in
> their own little sub namespace and link or install them into a central
> location for the ease of our use.
>
> it looks a bit like <somepath>/bar/<version>/{lib,include,share} so
> we can have multiple libbar's co-existing.
>
> For simplicity we then take bar/<version>/lib/libbar.so.<version> and
> install into a central LIB directory. For some historic reason when
> we do this the libraries are renamed to libbar-<version>.so.
>
> this name change can be an issue and rather than going against the grain
> I'd like to get it working as is. So, here's the question, does anyone
> know a non hexedit or binary sed hackery way to change link targets in a an 
> elf binary.


I'd "go against the grain."


>
> In essence I want to change
>
> $readelf -d foo.so  | head -n 3
> Dynamic segment at offset 0x36c0 contains 37 entries:
> Tag        Type                         Name/Value
> 0x00000001 (NEEDED)                     Shared library: [libbar.so.4.2]
>
> to
>
> 0x00000001 (NEEDED)                     Shared library: [libbar-4.2.so]
>
> with out re-linking the whole thing.
>
> any marvellous ideas ?


Don't bother. There lies pain.

If you get pain for not doing this, ask your colleagues to justify why 
libraries names should be changed. If they do anything more than scratch 
their heads, or say "we've always done it this way" then they really can't 
come up with a reasonable excuse for this behaviour.

It's just an insane scheme.

Christian

--
     /"\
     \ /    ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
      X                           - AGAINST MS ATTACHMENTS
     / \
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list