aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-12-30 18:39:46 +0100
committerRon Evans <[email protected]>2019-12-30 20:51:46 +0100
commitab7dc45288481c5312f3eadcab6076ab908620b4 (patch)
tree4b3473dbfbad134c209ce2525d50d6c933360200
parenteee1b995f60dd97fef1c231ff29de5358af1c713 (diff)
downloadtinygo-ab7dc45288481c5312f3eadcab6076ab908620b4.tar.gz
tinygo-ab7dc45288481c5312f3eadcab6076ab908620b4.zip
wasm: implement memcpy and memset
This was reported in issue #805.
-rw-r--r--src/runtime/runtime_wasm.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/runtime/runtime_wasm.go b/src/runtime/runtime_wasm.go
index bab786cbd..4264ea196 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
+}