ld, --wrap and dynamic library
Ian Lance Taylor
ian@airs.com
Thu Jul 28 16:31:00 GMT 2005
More information about the Binutils mailing list
Thu Jul 28 16:31:00 GMT 2005
- Previous message (by thread): ld, --wrap and dynamic library
- Next message (by thread): -shared && -static
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Cournapeau David <cournape@atr.jp> writes: > I have some questions concerning the --wrap option of the GNU linker, > and about the possibility to use it on dynamic libraries. > > I would like to be able to do the following: > > - libfoo.so provides the function do_foo(), which uses malloc/free. > - foo is a program using libfoo. > > I want to wrap all malloc calls done in the program foo, including > malloc calls in libfoo. If I am using the --wrap option > of the GNU linker, I managed to wrap all malloc calls done in all > .o linked into foo, but not the ones in libfoo.so. > > Is there a way to use the --wrap even for .so files ? When I look at > the symbols of libfoo.so, I see that the symbol malloc is > replaced by malloc@@GLIBC_2.0, which is why, I guess, the wrap > option of ld doesn't replace the malloc call by __wrap_malloc in the > dynamic library. libfoo.so has already been fully linked and the references to malloc have been resolved, so the --wrap option is ineffective. Ian
- Previous message (by thread): ld, --wrap and dynamic library
- Next message (by thread): -shared && -static
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list