From b64fc5484a448f09643de94e1d6cc758fc672ece Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 1 Apr 2019 13:33:40 +0200 Subject: [PATCH] runtime: implement memmove intrinsic This should fix the following issue: https://github.com/tinygo-org/tinygo/issues/252 --- src/runtime/runtime_cortexm.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/runtime/runtime_cortexm.go b/src/runtime/runtime_cortexm.go index 11922951..4a7c1244 100644 --- a/src/runtime/runtime_cortexm.go +++ b/src/runtime/runtime_cortexm.go @@ -46,10 +46,16 @@ func abort() { } } -// Implement memset for compiler-rt. +// Implement memset for LLVM and compiler-rt. //go:export memset -func memset(ptr unsafe.Pointer, c byte, size uintptr) { +func libc_memset(ptr unsafe.Pointer, c byte, size uintptr) { for i := uintptr(0); i < size; i++ { *(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = c } } + +// Implement memmove for LLVM and compiler-rt. +//go:export memmove +func libc_memmove(dst, src unsafe.Pointer, size uintptr) { + memmove(dst, src, size) +}