I am modifying the malloc.c and hooks.c file in glibc library and my modification uses shm_open().
Now to build glibc, the Man page of shm_open() says that I need to link with -lrt.
The problem that I am facing is, as far as I know, librt is produced during the build process of glibc. How can I modify the makefile(s) to build glibc and also link librt?
Or is there any other way to achieve this?
Please check if you have to recompile glibc at all. Usually, this is not necessary for replacing
malloc. You can interposed glibc'smallocimplementation from a DSO if you implement a certain set of functions:mallocThis mechanism relies on ELF symbol interposition (perhaps via
LD_PRELOAD).