[LLVMdev] [LLVM] What has happened to LLVM bitcode archive support?

Daniel Liew daniel.liew at imperial.ac.uk
Fri Dec 20 13:10:21 PST 2013


>> Therefore LLVM is still supporting runtime libraries that consist of llvm
>> bitcode files (even if the format is now different)
>
> runtime? It is still possible to build .a files if that is what you men.

Sorry I haven't explained very clearly. The tool that I work on is an
interpreter of LLVM IR and when the tool runs, it links in an archive
of bitcode modules into the bitcode module that we are interpreting.
The modules we link in provide the implementation of some functions
(for example in our case one of the things we link in is a small C
library). Because the modules we link in provide functions for the
program we are running (i.e. interpreting) we refer to them as runtime
libraries. I'm not sure this is standard terminology so sorry if I
confused you.

Yes I did mean it's still possible to build (and read) .a files
containing LLVM bitcode files.


> No, we still have to implement support for bitcode files in lld.

Okay thanks for clarifying.

So I guess if I want mimic linking in archives built by llvm-ar that
contain bitcode files, using code in LLVM trunk, my only choice at the
moment is to...

1. Collect a set of undefined symbols from the destination module.
2. Load **all** the `llvm::Module`s in the archive into memory
3. Iterate over each module's GlobalValues (does the list starting
with llvm::Module::global_begin() include the module's functions
too??) and if a GlobalValue in a module is not a declaration and is in
the set of undefined symbols then link that module into the
destination module using Linker::LinkModules()
4. Update the set of undefined symbols
5. repeat 1 and 2 until a fixed point (the set of undefined symbols
does not change) is reached.

??

Thanks,
Dan Liew.



More information about the llvm-dev mailing list