[llvmlinux] build and link .bc kernel

Behan Webster behanw at converseincode.com
Tue Nov 26 01:07:16 UTC 2013


On 11/25/13 16:54, Cristian Zamfir wrote:
>
>> You can tweak the llvmlinux makefile and replace the mainstream Linux
>> repo with that one. There are also some more additional challenges
>> along the way with modifying the kernel scripts to acknowledge .bc
>> files instead of ELF.
> I do not really understand why these are necessary. Aren't .bc files
> produced with --emit-llvm a byproduct and nothing should theoretically
> change? The final outcome should be  an x86* image + a vmlinux.bc +
> .bc files for the modules.
We currently just generate a .bc file for every .o which is built by the
compiler (though not for built-in.o). We do not go any further than that.

>> It also depends whether you want to have the
>> vmlinux in .bc format or just individual modules. For the latter you
>> should be able to do so by also replacing ld with the gold linker. I
>> am still looking into how to get a vmlinux.bc file (that will also
>> boot :) )
> How do you want to boot the .bc file, in an LLVM interpreter?

Yeah. You can't run a .bc file on bare hardware. Not unless there is a
CPU which understands bitcode somewhere out there I haven't heard of.

The idea here is to generate native executable object code with clang.

Someone clever in the future might figure a way out how to add a JIT to
the C based kernel such that some higher level loadable kernel modules
(not drivers) could be made into native code from bc code at the last
minute (like renderscript does for GPUs). But that isn't what the
LLVMLinux project is working on.

A vmlinux.bc file seems of dubious utility to me. But what do I know?

Behan

-- 
Behan Webster
behanw at converseincode.com



More information about the LLVMLinux mailing list