Existing tools such as wllvm gllvm don't seem to work without errors for the linux kernel.
This is not an alternative to those tools. They work with not just the kernel but any program. This is a tool specifically for the linux kernel. And hasn't been tested on other programs.
- Compiles the kernel with llvm/clang.
- Using the
compile_commands.json
generated by clang, it compiles each source file into a bitcode file. - Using the
.buit-in.a.cmd
files generated by the kernel build system, it hirarchically links the bitcode files into a single bitcode file.
Ceveats:
Certain source files in the kernel are assembly files. These files are not linked into the final bitcode file.
This has been tested on
- linux - 5.10.0
- defconfig
- llvm 10.0.1