aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--builtins.go2
-rw-r--r--src/runtime/runtime_arm.go8
-rw-r--r--targets/microbit.json1
3 files changed, 9 insertions, 2 deletions
diff --git a/builtins.go b/builtins.go
index 8c1817edc..58589de72 100644
--- a/builtins.go
+++ b/builtins.go
@@ -161,7 +161,7 @@ func loadBuiltins(target string) (path string, err error) {
objpath := filepath.Join(dir, name+".o")
objs = append(objs, objpath)
srcpath := filepath.Join(builtinsDir, name+".c")
- cmd := exec.Command(commands["clang"], "-c", "-Oz", "-g", "-Werror", "-Wall", "-std=c11", "--target="+target, "-o", objpath, srcpath)
+ cmd := exec.Command(commands["clang"], "-c", "-Oz", "-g", "-Werror", "-Wall", "-std=c11", "-fshort-enums", "-nostdlibinc", "--target="+target, "-o", objpath, srcpath)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmd.Dir = dir
diff --git a/src/runtime/runtime_arm.go b/src/runtime/runtime_arm.go
index 1bc1a0563..d47d40b8b 100644
--- a/src/runtime/runtime_arm.go
+++ b/src/runtime/runtime_arm.go
@@ -53,3 +53,11 @@ func abort() {
func align(ptr uintptr) uintptr {
return (ptr + 3) &^ 3
}
+
+// Implement memset for compiler-rt.
+//go:export memset
+func memset(ptr unsafe.Pointer, c byte, size uintptr) {
+ for i := uintptr(0); i < size; i++ {
+ *(*byte)(unsafe.Pointer(uintptr(ptr) + i)) = c
+ }
+}
diff --git a/targets/microbit.json b/targets/microbit.json
index 03bbe7210..de932934a 100644
--- a/targets/microbit.json
+++ b/targets/microbit.json
@@ -12,7 +12,6 @@
"-Wl,--gc-sections",
"-fno-exceptions", "-fno-unwind-tables",
"-ffunction-sections", "-fdata-sections",
- "-fno-short-enums",
"-Os",
"-DNRF51",
"-Ilib/CMSIS/CMSIS/Include",