This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: some question about malloc_hook


hi Vijay:
> There are several ways to wrap or hook up malloc family of functions.
>
> 1) Obviously it is a linker warning and you can choose to ignore it ;).
> 2) RTFM LD's -wrap option. You can wrap real malloc and call the
> original malloc.
> 3) If you want to completely overwrite glibc version of malloc, please
> note that malloc is defined as weak symbol in glibc.
> 4) If your application is dynamic executable using so's, You can use
> dlsym(RTLD_NEXT, "malloc") and use the original glibc malloc as
> __libc_malloc()
> 5) If it is a PIC executable, you can alter the GOT entry for malloc
> routine to jump to your hook.
really appreciate your kind help :)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]