If I run the command foo specifying a a different libc to use as follows:
LD_LIBRARY_PATH=$PATH_TO_MY_CUSTOM_LIBC foo
Is the globally defined libc used to run any of the command given above?
For the sake of context: consider the situation where your libc is physically present and accessible on your machine, but cannot be used for some reason. Given a logged in shell, in order to execute a specific command, you would need to provide a different libc.
Specifying the LD_LIBRARY_PATH
inline, would set it to the location of a working libc without apparent need to call the globally defined one.
Would the globally defined libc be called all the same in order to define locally the new environment variable?
LD_LIBRARY_PATH=$PATH_TO_MY_CUSTOM_LIBC foo
doesn't work for you? – yaegashi Sep 2 '15 at 18:49LD_PRELOAD
is to load a library before every other library, so you can write an own function which is normally provided by libc, for example; You can hook them. – chaos Sep 2 '15 at 18:55