solaris elfedit: Is there something similar for linux ? (a shared library editor)?
Linux: It there a way to edit a compiled shared library ?
specifically I am searching on how to add the DT_SYMBOLIC flag
on an already compiled binary shared library?
Here is why I am asking this:
our application is composed of
- our own libraries (static libXXX.a)
- some 3rd party libs (binary-only shared libraries libYYY.so)
Everything is fine with the application so far.
Now I have replaced our own static* libXXX.a libraries with shared libraries versions (libXXX.so).
Everything compiles and links fine.
But when I run the application now it starts up and does a lot of expected processing - and then it crashes somewhere on half the way. A gdb backtrace shows that the crash occurs in some of the 3rd party shared libraries.
I searched around on SOF and found an interesting article here.
The tip I am refe开发者_开发技巧rring to is
... add the DT_SYMBOLIC flag to the dynamic section ...
Although I doubt that it would really help I think it might be worth a try.
Any ideas how I can add the DT_SYMBOLIC flag
on an already compiled/linked shared library ?
environment: debian lenny 64bit with g++ v4.2.4 and binutils v20.
EDIT: on solaris there is a program called elfedit
. Is there something similar for linux ?
meanwhile l have found a tool called elfsh
. It is an interactive shell for examining and editing ELF objects, binaries and shared libraries.
see here for the project page: http://www.eresi-project.org
Unfortunately it doesn't seem to be very stable. I have experienced a lot of crashes within elfsh
itself.
If it's just a flag the painful approach is to tweak your elf header with a hex editor.
But if the 3rd party lib is crashing I'd personally look at the other end of things: what has changed about the library loading order because of you moving to shared.
ldd
and
export LD_DEBUG=libs
are your friends here.
dlopen()ing your shared libs after the runtime loader loads your 3rd party libs might be enough.
精彩评论