Dynamic linking with LD_PRELOAD - get it compiled
- From: Johannes Bauer <dfnsonfsduifb@xxxxxx>
- Date: Sun, 09 Mar 2008 02:44:52 +0100
Hello group,
I'm currently working on a tool which generates code that can be compiled with gcc to form a shared object. This shared object then can be preloaded with the LD_PRELOAD variable and shadows other library functions (read, write, printf and such).
The intercepted functions do a dlsym with the RTLD_NEXT parameter on the name of the actual function - then they are called. This gives me the possibilty to hook code in before and after library calls and maybe change the return value of those.
Anyways, it's working nicely with open(), close(), read(), write() and such, but then I tried select() - suddenly the compiler complains:
$ gcc -O2 -Wall -fPIC -shared -ldl -o libtrapper.so libtrapper.c Custom.o
libtrapper.c:155: error: conflicting types for ‘select’
/usr/include/gentoo-multilib/amd64/sys/select.h:112: error: previous declaration of ‘select’ was here
make: *** [libtrapper.so] Error 1
Well, of course I redefine it - however with different parameters. I always use void* in my declaration. I know it is not 100% correct, but it works (at least on x86_64) - but how do I convince gcc to compile the code anyways?
Regards,
Johannes
--
"PS: Ein Realname wäre nett. Ich selbst nutze nur keinen, weil mich die
meisten hier bereits mit Namen kennen." -- Markus Gronotte aka Makus /
Kosst Amojan / maqqusz / Mr. G / Ferdinand Simpson / Quartillia
Rosenberg in dse <45608268$0$5719$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
.
- Follow-Ups:
- Re: Dynamic linking with LD_PRELOAD - get it compiled
- From: David Schwartz
- Re: Dynamic linking with LD_PRELOAD - get it compiled
- From: Dildo Bogumil di Boscopelo
- Re: Dynamic linking with LD_PRELOAD - get it compiled
- Prev by Date: Linux DSL
- Next by Date: Re: Linux DSL
- Previous by thread: Linux DSL
- Next by thread: Re: Dynamic linking with LD_PRELOAD - get it compiled
- Index(es):
Relevant Pages
|