LD_PRELOAD is handled entirely by ld.so and includeed inside your ELF by the linker. It not only handles that but also all dynamic linking inside your program.
By writing a custom linker you can easily incercept all dynamic linking done at runtime and provide whatever you want to the program.
By writing a custom linker you can easily incercept all dynamic linking done at runtime and provide whatever you want to the program.
gcc -Wl,-dynamic-linker,/path/to/my/linker myprogram.c -o myprogram