Daniel Liew
2013-Dec-20 21:10 UTC
[LLVMdev] [LLVM] What has happened to LLVM bitcode archive support?
>> 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.
Pau Garcia i Quiles
2013-Dec-20 21:44 UTC
[LLVMdev] [LLVM] What has happened to LLVM bitcode archive support?
On Fri, Dec 20, 2013 at 10:10 PM, Daniel Liew <daniel.liew at imperial.ac.uk>wrote: 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. >Excuse me for the diversion but, is that interpreter of LLVM IR available somewhere? Details on how it works, performance, etc? I'd be interested -- Pau Garcia i Quiles http://www.elpauer.org (Due to my workload, I may need 10 days to answer) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131220/0aeceb93/attachment.html>
Rafael EspĂndola
2013-Dec-20 21:58 UTC
[LLVMdev] [LLVM] What has happened to LLVM bitcode archive support?
> 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.I would suggest for now building the archive with gnu ar and the plugin, that way you have an index and don't need to read all members. It looks like the algorithm you want is something like while (there are undefined symbols) if we can find a member defining one of the undefined symbols load it else print error about undefined symbol. Cheers, Rafael
Apparently Analagous Threads
- [LLVMdev] [LLVM] What has happened to LLVM bitcode archive support?
- [LLVMdev] [LLVM] What has happened to LLVM bitcode archive support?
- [LLVMdev] How to do bitcode archive linking correctly?
- SwitchTower with public key authentication?
- [LLVMdev] How to do bitcode archive linking correctly?