Bjarke Walling
2008-Jan-01 23:30 UTC
[LLVMdev] Building LLVM as bitcode libraries + my projects
Hi all, Is it possible to build the LLVM tools and libraries as bitcode files? I have managed to compile some software to bitcode files by creating a wrapper around llvm-gcc, llvm-g++ and llvm-ld and some hacking. Using binfmt in Linux you can even execute them directly on the command line. The object format becomes transparent. I tried to compile LLVM itself, but things go wrong with the tablegen tool. Missing symbols, segmentation faults, libraries crashing. I have experienced various errors and tried various fixes with no success. How do I correctly link to libstdc++ using the lli tool? I have ideas for two hobby projects I am really interested in. They both require that LLVM can be compiled to bitcode. 1) Play around with Futamura projections, applying aggressive optimizations to the LLVM library itself. The idea is to create a partial evaluation tool that provides some "outer" optimizations combined with the LLVM optimizations. For example you are able to tell that a read-file should be actually executed as an "optimization". The file content becomes static and optimized into the application. Then you basically run the partial evaluation tool on itself and see what happens. The requirement is that the tool including libraries it links to (LLVM) are bitcode files. 2) Install Linux From Scratch with bitcode as the main object format. I know I am a bit crazy. :-) I want to control which object files are native and which are bitcode. My idea is that the most files should be bitcode. The linux kernel, LLVM (the JIT/execution engine) and a minimal set of support libraries are native files. Everything else (if possible) is bitcode. The biggest problems is that some tools does not exists yet. That includes tools in the binutils package, which are used in many makefiles. I have compiled binutils as bitcode, but that doesn't solve the problem that the tools don't recognize bitcode as a valid object file format. Why would I want to do these projects? Most for fun, but I also hope to expand my knowledge. :-) - Bjarke
Maybe Matching Threads
- [LLVMdev] [cfe-dev] Adding new target for hobby OS
- [LLVMdev] One way to support unwind on x86
- [LLVMdev] linking share libraries when building whole-program bitcode file
- [LLVMdev] Can clang generate the same bitcode with the toolchains that have same version of libraries but different targets
- [LLVMdev] Can clang generate the same bitcode with the toolchains that have same version of libraries but different targets