Re: Intercepting calls in PIC mode

2014-07-04 Thread Shawn Webb
You could hijack the GOT entry, but that assumes the symbol has been resolved first (either LD_BIND_NOW or the function has been called at least once). You could also use LD_PRELOAD. On Jul 04, 2014 04:12 PM +0400, Ivan A. Kosarev wrote: > Hello, > > Consider the following: > > --- > #include >

Re: Intercepting calls in PIC mode

2014-07-04 Thread Konstantin Belousov
On Fri, Jul 04, 2014 at 04:12:51PM +0400, Ivan A. Kosarev wrote: > Hello, > > Consider the following: > > --- > #include > #include > > extern "C" void* memset(void *block, int c, size_t size) > __attribute__((weak, alias("__int_memset"), visibility("default"))); > > extern "C" __attribu

Intercepting calls in PIC mode

2014-07-04 Thread Ivan A. Kosarev
Hello, Consider the following: --- #include #include extern "C" void* memset(void *block, int c, size_t size) __attribute__((weak, alias("__int_memset"), visibility("default"))); extern "C" __attribute__((visibility("default"))) void* __int_memset(void *block, int c, size_t size) { p