Viua VM on OpenBSD 7.8
Published:
OpenBSD 7.8 has recently been released, and includes LLVM updated to version 21. This made a port of Viua VM possible.
Viua VM is my hobby programming toolchain: an emulator for a custom ISA, an
assembler, a disassembler, and a linker.
All of these tools work with ELF files, so I can use the standard versions
of eg, readelf(1) and objdump(1) to see if they
are compatible with the wider ecosystem.
Now that OpenBSD includes LLVM 21 I could port all of that using nothing outside of the base system (like LLVM compiled from upstream to get support for C++23). And so, the list of supported platforms grew a little longer:
- Linux (glibc)
- Linux (musl)
- FreeBSD
- OpenBSD
Build ID
There was some header weirdness and incompatibility, but I only had to patch
the linker parts responsible for emitting the
.note.gnu.build-id section of the ELF.
Seriously, OpenBSD?
No NT_GNU_BUILD_ID defined in your version of
<elf.h>?
Come on, be compatible with the world—build IDs are a useful feature.
This was easy to fix by adding a -D to the
platform-specific set of macro flags.
SHA and UUID APIs
More annoying were the differences in the API for SHA1, SHA256, SHA512, and UUID generation.
The ones around SHA API especially so, since were so tiny, but present nonetheless! Removing or adding underscores from function names just to be different from Linux or FreeBSD does not make much sense to me.
The UUID API is just plain ridiculous on OpenBSD, though.
Next: ROME at Viper Room, Vienna
Previous: GNU Guix and its directories