This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: How to tell compiler to use my_malloc inplace of normal 'malloc'
- To: "Mynampati, Venkata S." <MynamVS at nsc-msg01 dot network dot com>
- Subject: Re: How to tell compiler to use my_malloc inplace of normal 'malloc'
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 24 Aug 2001 02:56:19 -0300
- Cc: "'gcc-help at gcc dot gnu dot org'" <gcc-help at gcc dot gnu dot org>
- Organization: GCC Team, Red Hat
- References: <A7E1C26945C8D211ADBF0008C709661A035F2B2A@nsc-msg02.network.com>
On Aug 22, 2001, "Mynampati, Venkata S." <MynamVS@nsc-msg01.network.com> wrote:
> I read that while compiling i can tell the compiler to replace all mallocs
> with my wrapper function called 'my_malloc', in which, i do something
> and call malloc.
You can do this if you're using the GNU linker: it accepts
-wrap=malloc, so you define _wrap_malloc and call _real_malloc() in it
whenever you mean to call the actual malloc. Of course, you only use
this at link time.
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me