From ab7dc45288481c5312f3eadcab6076ab908620b4 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 30 Dec 2019 18:39:46 +0100 Subject: [PATCH] wasm: implement memcpy and memset This was reported in issue #805. --- src/runtime/runtime_wasm.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/runtime/runtime_wasm.go b/src/runtime/runtime_wasm.go index bab786cb..4264ea19 100644 --- a/src/runtime/runtime_wasm.go +++ b/src/runtime/runtime_wasm.go @@ -76,3 +76,17 @@ func memset(ptr unsafe.Pointer, c byte, size uintptr) unsafe.Pointer { } return ptr } + +// Implement memmove for LLVM and compiler-rt. +//go:export memmove +func libc_memmove(dst, src unsafe.Pointer, size uintptr) unsafe.Pointer { + memmove(dst, src, size) + return dst +} + +// Implement memcpy for LLVM and compiler-rt. +//go:export memcpy +func libc_memcpy(dst, src unsafe.Pointer, size uintptr) unsafe.Pointer { + memcpy(dst, src, size) + return dst +}