Hugo Hacker News

LLVM Internals: The Bitcode Format

fulafel 2021-08-19 17:06:37 +0000 UTC [ - ]

Related: LLVM bitcode modified for sandboxed untrusted code execution, recently deprecated in Chromium: http://www.chromium.org/nativeclient/pnacl/introduction-to-p...

woodruffw 2021-08-19 15:12:26 +0000 UTC [ - ]

Author here: happy to answer any questions about the bitcode format, at least as far as I've explored it :-)

This post also has a second part, which I published last week[1]. That part contains even more nitty-gritty details on how the bitstream is actually interpreted, and shows off a proof-of-concept bitstream parser in Rust.

[1]: https://blog.yossarian.net/2021/08/10/LLVM-internals-part-2-...

housel 2021-08-19 16:21:09 +0000 UTC [ - ]

People may also find interesting the Open Dylan project's alternative implementation of an LLVM bitcode writer, https://github.com/dylan-lang/opendylan/blob/master/sources/... and https://github.com/dylan-lang/opendylan/blob/master/sources/...

woodruffw 2021-08-19 16:30:32 +0000 UTC [ - ]

It's actually interesting how many independent implementations of bitcode writers there, given that there are almost no independent bitcode readers (mine is very preliminary, and then there's one from Galois[1]).

I believe Swift also does their own serialization in LLVM's bitstream format[2]. I also saw an implementation of the writer in Swift, but now I've lost it.

[1]: https://github.com/GaloisInc/llvm-pretty-bc-parser

[2]: https://github.com/apple/swift/blob/main/docs/Serialization....