diff options
author | Ayke van Laethem <[email protected]> | 2018-10-07 21:29:45 +0200 |
---|---|---|
committer | Ayke van Laethem <[email protected]> | 2018-10-07 21:29:45 +0200 |
commit | 1bbdab41d2e87a47aafd11471a74a6e02df67099 (patch) | |
tree | 13fd869baeeb921cb20646d1c903759ea79ac478 | |
parent | 73709922b29fdd35fba58a67a2d85111f9cb9225 (diff) | |
download | tinygo-1bbdab41d2e87a47aafd11471a74a6e02df67099.tar.gz tinygo-1bbdab41d2e87a47aafd11471a74a6e02df67099.zip |
all: improve compiler-rt compilation
A few changes to make sure compiler-rt is correctly compiled (and
doesn't include host headers, for example).
This improves support for AVR, but it still doesn't work. Compiler-rt
itself doesn't really work for AVR either.
-rw-r--r-- | builtins.go | 2 | ||||
-rw-r--r-- | src/runtime/runtime_arm.go | 8 | ||||
-rw-r--r-- | targets/microbit.json | 1 |
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", |