Is it possible yet to compile a full PHP stack – say Apache, PHP, Postgres and enough of the more commonly used libraries to cover ninety percent of sites – with Clang into LLVM bitcode? If so, are there any instructions available on how to do it starting with an out-of-the-box Ubuntu setup?
Share
Apache, PHP and Postgres can be compiled by Clang, which means they can also be compiled into LLVM bitcode. I can’t give you particular steps to achieve this, since it depends on build system. Anyway, this involves adding
-femit-llvmflag to compilation line and, probably, usingllvm-linkas linker.Be aware that at least PHP have inline assembly code, on which your analyzer may choke.
UPDATE:
Nice tool to compile code using arbitrary build systems to LLVM IR is gllvm. In short, you just use
gclang/gclang++instead ofgcc/g++and then runningget-bcon the resulting binary.