I spent a good few hours figuring out under which conditions storing Go pointers in assembly is safe. Here's a little explainer: https://mazzo.li/posts/go-asm-pointers.html

#go #assembly

How to store Go pointers from assembly

The standard Go toolchain comes with an assembler out of the box. Said assembler is highly idiosyncratic, using syntax inherited from Plan 9 and choosing its own names for platform-specific instructions and registers. But it's great to have it readily available. More mundanely, Go comes with a garbage collector. This post explains how to make these two components play nice, if we want to manipulate Go pointers from our assembly.