Hi,
I have a Fedora 11 x86_64 bit.
And I'm trying to run a
bind_hack with wine through LD_PRELOAD and it's giving me:
Quote:
|
ERROR: ld.so: object '/tmp/bind_hack.so' from LD_PRELOAD cannot be preloaded: ignored.
|
This is the hack:
Code:
/* This file is ditributed under the GPLv2 */
#define _GNU_SOURCE
#include </usr/include/sys/socket.h>
#include </usr/include/sys/types.h>
#include </usr/include/netinet/in.h>
#include </usr/include/dlfcn.h>
#include </usr/include/string.h>
int (*real_bind)(int fd, const struct sockaddr* add, socklen_t len);
void _init(void) {
real_bind = dlsym(RTLD_NEXT, "bind");
}
int bind(int fd, const struct sockaddr* addr, socklen_t len) {
struct sockaddr_in* sa;
if(addr->sa_family==AF_INET) {
sa = (struct sockaddr_in*) addr;
memset(&sa->sin_addr, 0, sizeof(sa->sin_addr));
}
return real_bind(fd, addr, len);
}
And this is how I'm compiling:
Code:
$ cc bind_hack.c -o bind_hack.so -O2 -fPIC -Wall -shared -lc -nostdlib -m32
For this error to happen, I believe it's trying to load the 64 bits libs somehow? when it should be loading the 32 bit.
Is there any problem with the code? Perhaps if I compile in a 32bit machine it will work?
Any suggestions?