shared bitcode modules / dynamic linking.


afaics in manuals the llvm-{link,ld} tools only can merge bitcode files
into one bigger piece which looks like a static-linking from the c/c++ world.
i'm wondering is it any possibility to link bitcode elements dynamically
in the same way as e.g. c#/msil assemblies? static linking into one executable
looks horrible - any change in library used in project forces relinking of everything.

i've found a thread[*] in archive but it only describes a new linker tool
without virtual machine support for loading bitcodes in runtime.

so, is there any plans to develop so called dynamic bitcode linking
or there's another solution for this problem?



i’ve changed a little the ‘lli’ to test loading of additional ${bitcode}.config file.

this simple .config contains a list of bitcodes required by current bitcode.

it seems to work in this trivial scenario but it would be great to store such list

directly in bitcode file (creating in llvm-link / using in lli).

is it any simple method to embbed such structure in bitcode file? some metadata?

thanks for any hints.



lli-load_deps.patch (1.97 KB)

Hi Pawel,

Bitcode contains a field for a list of dependent libraries (“deplibs”, see Module::getLibraries()) which contains a list of needed libraries (similar to ELF DT_NEEDED).

The PNaCl team at Google is working on getting bitcode to act like shared objects and dynamic executables. As far as I know, we’re the only ones doing this at the moment.

  • pdox