I came across a reference to it recently on proggit and (as of now) it is not explained.
I suspect this might be it, but I don't know for sure.
LD_PRELOAD allows you to override symbols in any library by specifying your new function in a shared object. When you run LD_PRELOAD=/path/to/my/free.so /bin/mybinary , /path/to/my/free.so is loaded before any other library, including libc. When mybinary is executed, it uses your custom function for free .
LD_PRELOAD is an optional environmental variable containing one or more paths to shared libraries, or shared objects, that the loader will load before any other shared library including the C runtime library (libc.so) This is called preloading a library.
LD_PRELOAD. A list of additional, user-specified, ELF shared libraries to be loaded before all others. The items of the list can be separated by spaces or colons. This can be used to selectively override functions in other shared libraries.
If you set LD_PRELOAD
to the path of a shared object, that file will be loaded before any other library (including the C runtime, libc.so
). So to run ls
with your special malloc()
implementation, do this:
$ LD_PRELOAD=/path/to/my/malloc.so /bin/ls
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With