This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ld, --wrap and dynamic library
- From: Cournapeau David <cournape at atr dot jp>
- To: binutils at sources dot redhat dot com
- Date: Thu, 28 Jul 2005 15:30:28 +0900
- Subject: ld, --wrap and dynamic library
Hello,
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.
Thank you for your help,
David