I am trying to build a modified version of libc/NPTL. My ubuntu version shows that it is version 2.13. I want to create a separate libc/nptl/libpthreads and want to use it for an existing application (like apache) using dynamic loading without replacing existing glibc/libpthreads. I am new to kernel programming and dynamic loading. Can you provide an example of how to use libc/NPTL using dynamic loading capability.
Share
That’s easy:
./configure --prefix=/u && make && make install. Congratulations, you now have a separatelibc/lipthreadsunder/uIt’s not quite clear whether you want to use your new
libcwith existing (prebuilt) binary, or with one you can rebuild.If the latter, simply add
-Wl,--dynamic-linker=/u/lib64/ld-linux-x86-64.so.2(for 64-bit binaries), and you are done.If the former, and the application does not
execveitself, you can invoke it like this:/u/lib64/ld-linux-x86-64.so.2 /path/to/app.If the application does
execitself, or gets invoked by multitude of shell scripts which you don’t want to modify, then you’ll have to binary-patch the application: replace/lib64/ld-linux-x86-64.so.2string in the.dynstrsection of the binary with/u/lib64/ld-2.13.so(new string has to be not longer than the old one).Your question has nothing whatsoever to do with kernel programming.