aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBCG <[email protected]>2020-03-30 08:22:42 -0400
committerGitHub <[email protected]>2020-03-30 14:22:42 +0200
commit57320c09222560dd3656d3c4bb05a16c1849e9a5 (patch)
treed8dcb2ef051f4f14dfb0e5380db1f097d6a2df82
parent03fa9dd9b7f8fa150641818bff0cdec3d29df71d (diff)
downloadtinygo-57320c09222560dd3656d3c4bb05a16c1849e9a5.tar.gz
tinygo-57320c09222560dd3656d3c4bb05a16c1849e9a5.zip
runtime: export implementations of malloc/free for use from C
-rw-r--r--src/runtime/baremetal.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/baremetal.go b/src/runtime/baremetal.go
index 892aff923..825672019 100644
--- a/src/runtime/baremetal.go
+++ b/src/runtime/baremetal.go
@@ -28,3 +28,13 @@ var (
globalsEnd = uintptr(unsafe.Pointer(&globalsEndSymbol))
stackTop = uintptr(unsafe.Pointer(&stackTopSymbol))
)
+
+//export malloc
+func libc_malloc(size uintptr) unsafe.Pointer {
+ return alloc(size)
+}
+
+//export free
+func libc_free(ptr unsafe.Pointer) {
+ free(ptr)
+}