#build-in-public

Context

  • The Linux kernel
  • Building the kernel
  • Intermediate Representation
  • [Whole Program Bitcode]
  • Analysis Tools
  • Static Analysis
  • Program Representation
  • Alias Analysis
    • Data-flow Analysis
    • Type-based Analysis

Various analysis tools use the LLVM bitcode representation of the source. Compiling a single source file into bitcode is straightforward.

  1. clang -S -emit-llvm <file.c> to get the readable bitcode.
  2. clang -c -emit-llvm <file.c> to get the binary bitcode.

However, compiling large projects like the Linux kernel into bitcode is not as straightforward.

At a high level, each *.c source file is compiled into an object file. Object files .o in a sub-system are linked together to into an intermediate built-in.a file. Finally, all the built-in.a files are linked together to get the final kernel image vmlinux.

Continue Reading →