From 589569fc35ae33f45bcd779d01c4561abe21bf71 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Tue, 22 Jan 2019 21:13:33 +0100 Subject: [PATCH] loader: fix ARM compatibility The magic CGo construct to turn a C array into a slice turned out to be not portable. Note: this is not the only problem, there is also a bug in the Go bindings for LLVM. With that one fixed, it is possible to build TinyGo on a Raspberry Pi (32-bit). --- loader/libclang.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loader/libclang.go b/loader/libclang.go index 29c47265..d6370105 100644 --- a/loader/libclang.go +++ b/loader/libclang.go @@ -39,7 +39,7 @@ func (info *fileInfo) parseFragment(fragment string, cflags []string) error { // convert Go slice of strings to C array of strings. cmdargsC := C.malloc(C.size_t(len(cflags)) * C.size_t(unsafe.Sizeof(uintptr(0)))) defer C.free(cmdargsC) - cmdargs := (*[1<<30 - 1]*C.char)(cmdargsC) + cmdargs := (*[1 << 16]*C.char)(cmdargsC) for i, cflag := range cflags { s := C.CString(cflag) cmdargs[i] = s