How To Create My Own ld
For some reasons, I want to add some work to the dynamic-linker. So, I hope to let the system use my own ld( say:myld.so,myld-linux.so{1,2})first, then after doing some thing, call the original dynamic linker(ld.so,ld-linux.so{1,2})again. Now I don't whether it will work. It is not difficult to order the system to use my own ld.so. But what should myld.so and myld-linux.so{1,2}) be like, especially the entry point? A simple way might be to add some codes in _dl_start in rtld.c and RTLD_START in dynamic.h, while I don't hope to change the source code of glibc. In my opinion, it would be better to write some codes in another file and compile it. Is it feasible? And if it's possbile then would you please tell me how?
|