From what I understand, the ELF
format doesn't specify which symbols come from which file - Every ELF
that uses import has a list of symbols to import and list of file names, and the loader is trying to locate those symbols in the file names.
But what happens if there is a collision - the same symbol appears twice, in different files? Is it possible to somehow force by the ELF
format the destination file to look for a specific symbol?
dlopen
. But, in this case, the first loaded symbol will stay and anything with the same name will be rejected. – perror Feb 05 '20 at 15:57LD_PRELOAD
and friends. macOS has a similar facility (DYLD_INSERT_LIBRARIES
). – 0xC0000022L Feb 06 '20 at 20:14