1). print function address directly:
printf("strerror=%p, strerror_r=%p\n", strerror, strerror_r);
strerror=0x8049ec0, strerror_r=0x8049e20
2). dlsym version:
rtldDefault= dlopen(0, RTLD_NOW | RTLD_GLOBAL);
dlsym(rtldDefault, "strerror_r"); ==> strerror_r=0xb76544e0
but
dlsym(rtldDefault, "strerror"); ==> strerror=0x8049ec0
3). others:
dlsym((void*)0, "strerror_r") ==> strerror_r=0xb76544e0
dlsym((void*)-1, "strerror_r") ==> strerror_r=0xb76544e0
How can I get strerror_r=0x8049e20
using dlsym()
?
I have already print the address of strerror_r first, then call dlsym().
strerror_r=0xb76544e0 is wrong address, my call strerror_r with this address just do nothing.