Index: src/runtime/asm_riscv64.s
--- src/runtime/asm_riscv64.s.orig
+++ src/runtime/asm_riscv64.s
@@ -313,6 +313,15 @@ TEXT gosave_systemstack_switch<>(SB),NOSPLIT|NOFRAME,$
 	CALL	runtime·abort(SB)
 	RET
 
+// func asmcgocall_no_g(fn, arg unsafe.Pointer)
+// Call fn(arg) aligned appropriately for the gcc ABI.
+// Called on a system stack, and there may be no g yet (during needm).
+TEXT ·asmcgocall_no_g(SB),NOSPLIT,$0-16
+	MOV	fn+0(FP), X5
+	MOV	arg+8(FP), X10
+	JALR	RA, (X5)
+	RET
+
 // func asmcgocall(fn, arg unsafe.Pointer) int32
 // Call fn(arg) on the scheduler stack,
 // aligned appropriately for the gcc ABI.
