standard as(1) will a generate a .o file but not a Plan 9 object file, while you
can use .syso trick to link that file in, you can't call external functions from Go,
you must add an extra layer of assembly or C function to call the external
function in .syso files.
Maybe we can make a small utility that take a GNU as(1) input, assemble it
and generate a Plan 9 assembly file like this:
TEXT func(SB), 7, $0 // 0 is certainly wrong, but external asm function will
// surely manage its own stack frame
BYTE $0x??; BYTE $0x??; // some inst
// ...
JMP A
// ...
A:
BYTE $0x??;
I've been thinking about this utility for some time, and I think it will ease the
task of porting GNU as(1) assembly files to Go.
After this is working, maybe we can get a fully fledged assembler translator
working (it can just use BYTE/WORD pseudo-instruction to replace any
instruction that it doesn't understand).