From 33d138a833fa2acf08019cc05573f3d425e53ad1 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Jan 04 2022 01:33:52 +0000 Subject: Update to latest version (#1978517) --- diff --git a/.gitignore b/.gitignore index dcf20a6..453f063 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ /tinygo-0.18.0.tar.gz /tinygo-0.19.0.tar.gz /tinygo-0.20.0.tar.gz +/tinygo-0.21.0.tar.gz +/musl-1.2.2.tar.gz +/musl-1.2.2.tar.gz.asc diff --git a/0001-Skip-WASI-tests.patch b/0001-Skip-WASI-tests.patch index 30f6d29..939dd5a 100644 --- a/0001-Skip-WASI-tests.patch +++ b/0001-Skip-WASI-tests.patch @@ -1,4 +1,4 @@ -From 370c2cd8a92ff431503bfb823b15b30478767ffb Mon Sep 17 00:00:00 2001 +From 9b9f5ddc40d838c0141a81f718bb57e546dbc742 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 15 Dec 2020 05:06:04 -0500 Subject: [PATCH 1/4] Skip WASI tests. @@ -11,19 +11,19 @@ Signed-off-by: Elliott Sales de Andrade 1 file changed, 3 deletions(-) diff --git a/main_test.go b/main_test.go -index 7ebf8eb0..cdba1c3f 100644 +index d1ef1964..d74e0d67 100644 --- a/main_test.go +++ b/main_test.go -@@ -106,9 +106,6 @@ func TestCompiler(t *testing.T) { +@@ -144,9 +144,6 @@ func TestCompiler(t *testing.T) { t.Run("WebAssembly", func(t *testing.T) { - runPlatTests("wasm", tests, t) + runPlatTests(optionsFromTarget("wasm"), tests, t) }) - t.Run("WASI", func(t *testing.T) { -- runPlatTests("wasi", tests, t) +- runPlatTests(optionsFromTarget("wasi"), tests, t) - }) } + } - // Test a few build options. -- 2.31.1 diff --git a/0002-Only-run-native-Linux-tests-on-their-own-GOARCH.patch b/0002-Only-run-native-Linux-tests-on-their-own-GOARCH.patch index 910762a..2cc8ab1 100644 --- a/0002-Only-run-native-Linux-tests-on-their-own-GOARCH.patch +++ b/0002-Only-run-native-Linux-tests-on-their-own-GOARCH.patch @@ -1,4 +1,4 @@ -From 64dc7032e3e942a26a4a3a8f24c6b1fce4f36f04 Mon Sep 17 00:00:00 2001 +From 0fb55aa3fbf96a77ac86651cf9649843e0faa831 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Mon, 21 Dec 2020 04:26:02 -0500 Subject: [PATCH 2/4] Only run native Linux tests on their own GOARCH. @@ -8,46 +8,61 @@ on koji do not work for this because it does not support multilib. Signed-off-by: Elliott Sales de Andrade --- + Makefile | 2 ++ main_test.go | 27 ++++++++++++++++++--------- - 1 file changed, 18 insertions(+), 9 deletions(-) + 2 files changed, 20 insertions(+), 9 deletions(-) +diff --git a/Makefile b/Makefile +index 5de97014..64d68e2b 100644 +--- a/Makefile ++++ b/Makefile +@@ -479,7 +479,9 @@ endif + @$(MD5SUM) test.nro + $(TINYGO) build -size short -o test.hex -target=pca10040 -opt=0 ./testdata/stdlib.go + @$(MD5SUM) test.hex ++ifeq ($(shell uname -p), aarch64) + GOOS=linux GOARCH=arm $(TINYGO) build -size short -o test.elf ./testdata/cgo ++endif + GOOS=windows GOARCH=amd64 $(TINYGO) build -o test.exe ./testdata/cgo + ifneq ($(OS),Windows_NT) + # TODO: this does not yet work on Windows. Somehow, unused functions are diff --git a/main_test.go b/main_test.go -index cdba1c3f..beb65994 100644 +index d74e0d67..1946ee1b 100644 --- a/main_test.go +++ b/main_test.go -@@ -94,15 +94,24 @@ func TestCompiler(t *testing.T) { - } +@@ -132,15 +132,24 @@ func TestCompiler(t *testing.T) { + }) if runtime.GOOS == "linux" { - t.Run("X86Linux", func(t *testing.T) { -- runPlatTests("i386--linux-gnu", tests, t) +- runPlatTests(optionsFromOSARCH("linux/386"), tests, t) - }) - t.Run("ARMLinux", func(t *testing.T) { -- runPlatTests("arm--linux-gnueabihf", tests, t) +- runPlatTests(optionsFromOSARCH("linux/arm/6"), tests, t) - }) - t.Run("ARM64Linux", func(t *testing.T) { -- runPlatTests("aarch64--linux-gnu", tests, t) +- runPlatTests(optionsFromOSARCH("linux/arm64"), tests, t) - }) + switch runtime.GOARCH { + case "386": + t.Run("X86Linux", func(t *testing.T) { -+ runPlatTests("i386--linux-gnu", tests, t) ++ runPlatTests(optionsFromOSARCH("linux/386"), tests, t) + }) + case "amd64": + t.Run("AMD64Linux", func(t *testing.T) { -+ runPlatTests("amd64--linux-gnu", tests, t) ++ runPlatTests(optionsFromOSARCH("linux/amd64"), tests, t) + }) + case "arm": + t.Run("ARMLinux", func(t *testing.T) { -+ runPlatTests("arm--linux-gnueabihf", tests, t) ++ runPlatTests(optionsFromOSARCH("linux/arm/6"), tests, t) + }) + case "arm64": + t.Run("ARM64Linux", func(t *testing.T) { -+ runPlatTests("aarch64--linux-gnu", tests, t) ++ runPlatTests(optionsFromOSARCH("linux/arm64"), tests, t) + }) + } t.Run("WebAssembly", func(t *testing.T) { - runPlatTests("wasm", tests, t) + runPlatTests(optionsFromTarget("wasm"), tests, t) }) -- 2.31.1 diff --git a/0003-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch b/0003-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch new file mode 100644 index 0000000..915cae6 --- /dev/null +++ b/0003-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch @@ -0,0 +1,127 @@ +From c9cdcacd078cec5dc117c1257fa81b7b1f03398a Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Mon, 6 Sep 2021 05:01:19 -0400 +Subject: [PATCH 3/4] Add canThrow argument to llvm.InlineAsm calls + +This is new in LLVM 13, and uses the default `false` which matches the +default in the LLVM-internal `InlineAsm::get`, but I don't know if +that's the right thing here because docs are difficult to find. + +Signed-off-by: Elliott Sales de Andrade +--- + compiler/inlineasm.go | 16 ++++++++-------- + compiler/syscall.go | 8 ++++---- + 2 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/compiler/inlineasm.go b/compiler/inlineasm.go +index e32a4f39..635aed98 100644 +--- a/compiler/inlineasm.go ++++ b/compiler/inlineasm.go +@@ -24,7 +24,7 @@ func (b *builder) createInlineAsm(args []ssa.Value) (llvm.Value, error) { + // Magic function: insert inline assembly instead of calling it. + fnType := llvm.FunctionType(b.ctx.VoidType(), []llvm.Type{}, false) + asm := constant.StringVal(args[0].(*ssa.Const).Value) +- target := llvm.InlineAsm(fnType, asm, "", true, false, 0) ++ target := llvm.InlineAsm(fnType, asm, "", true, false, 0, false) + return b.CreateCall(target, nil, ""), nil + } + +@@ -116,7 +116,7 @@ func (b *builder) createInlineAsmFull(instr *ssa.CallCommon) (llvm.Value, error) + outputType = b.ctx.VoidType() + } + fnType := llvm.FunctionType(outputType, argTypes, false) +- target := llvm.InlineAsm(fnType, asmString, strings.Join(constraints, ","), true, false, 0) ++ target := llvm.InlineAsm(fnType, asmString, strings.Join(constraints, ","), true, false, 0, false) + result := b.CreateCall(target, args, "") + if hasOutput { + return result, nil +@@ -159,7 +159,7 @@ func (b *builder) emitSVCall(args []ssa.Value) (llvm.Value, error) { + // marked as clobbered. + constraints += ",~{r1},~{r2},~{r3}" + fnType := llvm.FunctionType(b.uintptrType, argTypes, false) +- target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0) ++ target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0, false) + return b.CreateCall(target, llvmArgs, ""), nil + } + +@@ -197,7 +197,7 @@ func (b *builder) emitSV64Call(args []ssa.Value) (llvm.Value, error) { + // marked as clobbered. + constraints += ",~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7}" + fnType := llvm.FunctionType(b.uintptrType, argTypes, false) +- target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0) ++ target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0, false) + return b.CreateCall(target, llvmArgs, ""), nil + } + +@@ -222,24 +222,24 @@ func (b *builder) emitCSROperation(call *ssa.CallCommon) (llvm.Value, error) { + // marked as such. + fnType := llvm.FunctionType(b.uintptrType, nil, false) + asm := fmt.Sprintf("csrr $0, %d", csr) +- target := llvm.InlineAsm(fnType, asm, "=r", true, false, 0) ++ target := llvm.InlineAsm(fnType, asm, "=r", true, false, 0, false) + return b.CreateCall(target, nil, ""), nil + case "Set": + fnType := llvm.FunctionType(b.ctx.VoidType(), []llvm.Type{b.uintptrType}, false) + asm := fmt.Sprintf("csrw %d, $0", csr) +- target := llvm.InlineAsm(fnType, asm, "r", true, false, 0) ++ target := llvm.InlineAsm(fnType, asm, "r", true, false, 0, false) + return b.CreateCall(target, []llvm.Value{b.getValue(call.Args[1])}, ""), nil + case "SetBits": + // Note: it may be possible to optimize this to csrrsi in many cases. + fnType := llvm.FunctionType(b.uintptrType, []llvm.Type{b.uintptrType}, false) + asm := fmt.Sprintf("csrrs $0, %d, $1", csr) +- target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0) ++ target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0, false) + return b.CreateCall(target, []llvm.Value{b.getValue(call.Args[1])}, ""), nil + case "ClearBits": + // Note: it may be possible to optimize this to csrrci in many cases. + fnType := llvm.FunctionType(b.uintptrType, []llvm.Type{b.uintptrType}, false) + asm := fmt.Sprintf("csrrc $0, %d, $1", csr) +- target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0) ++ target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0, false) + return b.CreateCall(target, []llvm.Value{b.getValue(call.Args[1])}, ""), nil + default: + return llvm.Value{}, b.makeError(call.Pos(), "unknown CSR operation: "+name) +diff --git a/compiler/syscall.go b/compiler/syscall.go +index db379d52..37330684 100644 +--- a/compiler/syscall.go ++++ b/compiler/syscall.go +@@ -56,7 +56,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { + } + constraints += ",~{rcx},~{r11}" + fnType := llvm.FunctionType(b.uintptrType, argTypes, false) +- target := llvm.InlineAsm(fnType, "syscall", constraints, true, false, llvm.InlineAsmDialectIntel) ++ target := llvm.InlineAsm(fnType, "syscall", constraints, true, false, llvm.InlineAsmDialectIntel, false) + return b.CreateCall(target, args, ""), nil + case b.GOARCH == "386" && b.GOOS == "linux": + // Sources: +@@ -82,7 +82,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { + argTypes = append(argTypes, llvmValue.Type()) + } + fnType := llvm.FunctionType(b.uintptrType, argTypes, false) +- target := llvm.InlineAsm(fnType, "int 0x80", constraints, true, false, llvm.InlineAsmDialectIntel) ++ target := llvm.InlineAsm(fnType, "int 0x80", constraints, true, false, llvm.InlineAsmDialectIntel, false) + return b.CreateCall(target, args, ""), nil + case b.GOARCH == "arm" && b.GOOS == "linux": + // Implement the EABI system call convention for Linux. +@@ -114,7 +114,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { + constraints += ",~{r" + strconv.Itoa(i) + "}" + } + fnType := llvm.FunctionType(b.uintptrType, argTypes, false) +- target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0) ++ target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0, false) + return b.CreateCall(target, args, ""), nil + case b.GOARCH == "arm64" && b.GOOS == "linux": + // Source: syscall(2) man page. +@@ -146,7 +146,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { + } + constraints += ",~{x16},~{x17}" // scratch registers + fnType := llvm.FunctionType(b.uintptrType, argTypes, false) +- target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0) ++ target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0, false) + return b.CreateCall(target, args, ""), nil + default: + return llvm.Value{}, b.makeError(call.Pos(), "unknown GOOS/GOARCH for syscall: "+b.GOOS+"/"+b.GOARCH) +-- +2.31.1 + diff --git a/0003-Use-clang-to-do-linking.patch b/0003-Use-clang-to-do-linking.patch deleted file mode 100644 index 02df169..0000000 --- a/0003-Use-clang-to-do-linking.patch +++ /dev/null @@ -1,52 +0,0 @@ -From ebec9ce9c029ce56820b6b07051cd6ad76988e30 Mon Sep 17 00:00:00 2001 -From: Elliott Sales de Andrade -Date: Mon, 21 Dec 2020 04:28:59 -0500 -Subject: [PATCH 3/4] Use clang to do linking. - -This avoids having to guess what the linker name-with-build-triplet is, -as we can just pass the target to it in the same way as the compilation -stage. - -Signed-off-by: Elliott Sales de Andrade ---- - compileopts/target.go | 9 ++------- - 1 file changed, 2 insertions(+), 7 deletions(-) - -diff --git a/compileopts/target.go b/compileopts/target.go -index a84896c9..cf654748 100644 ---- a/compileopts/target.go -+++ b/compileopts/target.go -@@ -248,9 +248,10 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { - GOARCH: goarch, - BuildTags: []string{goos, goarch}, - Scheduler: "tasks", -- Linker: "cc", - DefaultStackSize: 1024 * 64, // 64kB - CFlags: []string{"--target=" + triple}, -+ Linker: "clang", -+ LDFlags: []string{"--target=" + triple}, - GDB: []string{"gdb"}, - PortReset: "false", - } -@@ -272,18 +273,12 @@ func defaultTarget(goos, goarch, triple string) (*TargetSpec, error) { - spec.GDB = []string{"gdb-multiarch"} - if goarch == "arm" && goos == "linux" { - spec.CFlags = append(spec.CFlags, "--sysroot=/usr/arm-linux-gnueabihf") -- spec.Linker = "arm-linux-gnueabihf-gcc" - spec.Emulator = []string{"qemu-arm", "-L", "/usr/arm-linux-gnueabihf"} - } - if goarch == "arm64" && goos == "linux" { - spec.CFlags = append(spec.CFlags, "--sysroot=/usr/aarch64-linux-gnu") -- spec.Linker = "aarch64-linux-gnu-gcc" - spec.Emulator = []string{"qemu-aarch64", "-L", "/usr/aarch64-linux-gnu"} - } -- if goarch == "386" && runtime.GOARCH == "amd64" { -- spec.CFlags = append(spec.CFlags, "-m32") -- spec.LDFlags = append(spec.LDFlags, "-m32") -- } - } - return &spec, nil - } --- -2.31.1 - diff --git a/0004-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch b/0004-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch deleted file mode 100644 index 82511c3..0000000 --- a/0004-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch +++ /dev/null @@ -1,127 +0,0 @@ -From 763a6ed16697dc032fdd125b916bb7e349655b29 Mon Sep 17 00:00:00 2001 -From: Elliott Sales de Andrade -Date: Mon, 6 Sep 2021 05:01:19 -0400 -Subject: [PATCH 4/4] Add canThrow argument to llvm.InlineAsm calls - -This is new in LLVM 13, and uses the default `false` which matches the -default in the LLVM-internal `InlineAsm::get`, but I don't know if -that's the right thing here because docs are difficult to find. - -Signed-off-by: Elliott Sales de Andrade ---- - compiler/inlineasm.go | 16 ++++++++-------- - compiler/syscall.go | 8 ++++---- - 2 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/compiler/inlineasm.go b/compiler/inlineasm.go -index 31312a92..b99b1360 100644 ---- a/compiler/inlineasm.go -+++ b/compiler/inlineasm.go -@@ -24,7 +24,7 @@ func (b *builder) createInlineAsm(args []ssa.Value) (llvm.Value, error) { - // Magic function: insert inline assembly instead of calling it. - fnType := llvm.FunctionType(b.ctx.VoidType(), []llvm.Type{}, false) - asm := constant.StringVal(args[0].(*ssa.Const).Value) -- target := llvm.InlineAsm(fnType, asm, "", true, false, 0) -+ target := llvm.InlineAsm(fnType, asm, "", true, false, 0, false) - return b.CreateCall(target, nil, ""), nil - } - -@@ -116,7 +116,7 @@ func (b *builder) createInlineAsmFull(instr *ssa.CallCommon) (llvm.Value, error) - outputType = b.ctx.VoidType() - } - fnType := llvm.FunctionType(outputType, argTypes, false) -- target := llvm.InlineAsm(fnType, asmString, strings.Join(constraints, ","), true, false, 0) -+ target := llvm.InlineAsm(fnType, asmString, strings.Join(constraints, ","), true, false, 0, false) - result := b.CreateCall(target, args, "") - if hasOutput { - return result, nil -@@ -159,7 +159,7 @@ func (b *builder) emitSVCall(args []ssa.Value) (llvm.Value, error) { - // marked as clobbered. - constraints += ",~{r1},~{r2},~{r3}" - fnType := llvm.FunctionType(b.uintptrType, argTypes, false) -- target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0) -+ target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0, false) - return b.CreateCall(target, llvmArgs, ""), nil - } - -@@ -197,7 +197,7 @@ func (b *builder) emitSV64Call(args []ssa.Value) (llvm.Value, error) { - // marked as clobbered. - constraints += ",~{x1},~{x2},~{x3},~{x4},~{x5},~{x6},~{x7}" - fnType := llvm.FunctionType(b.uintptrType, argTypes, false) -- target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0) -+ target := llvm.InlineAsm(fnType, asm, constraints, true, false, 0, false) - return b.CreateCall(target, llvmArgs, ""), nil - } - -@@ -222,24 +222,24 @@ func (b *builder) emitCSROperation(call *ssa.CallCommon) (llvm.Value, error) { - // marked as such. - fnType := llvm.FunctionType(b.uintptrType, nil, false) - asm := fmt.Sprintf("csrr $0, %d", csr) -- target := llvm.InlineAsm(fnType, asm, "=r", true, false, 0) -+ target := llvm.InlineAsm(fnType, asm, "=r", true, false, 0, false) - return b.CreateCall(target, nil, ""), nil - case "Set": - fnType := llvm.FunctionType(b.ctx.VoidType(), []llvm.Type{b.uintptrType}, false) - asm := fmt.Sprintf("csrw %d, $0", csr) -- target := llvm.InlineAsm(fnType, asm, "r", true, false, 0) -+ target := llvm.InlineAsm(fnType, asm, "r", true, false, 0, false) - return b.CreateCall(target, []llvm.Value{b.getValue(call.Args[1])}, ""), nil - case "SetBits": - // Note: it may be possible to optimize this to csrrsi in many cases. - fnType := llvm.FunctionType(b.uintptrType, []llvm.Type{b.uintptrType}, false) - asm := fmt.Sprintf("csrrs $0, %d, $1", csr) -- target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0) -+ target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0, false) - return b.CreateCall(target, []llvm.Value{b.getValue(call.Args[1])}, ""), nil - case "ClearBits": - // Note: it may be possible to optimize this to csrrci in many cases. - fnType := llvm.FunctionType(b.uintptrType, []llvm.Type{b.uintptrType}, false) - asm := fmt.Sprintf("csrrc $0, %d, $1", csr) -- target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0) -+ target := llvm.InlineAsm(fnType, asm, "=r,r", true, false, 0, false) - return b.CreateCall(target, []llvm.Value{b.getValue(call.Args[1])}, ""), nil - default: - return llvm.Value{}, b.makeError(call.Pos(), "unknown CSR operation: "+name) -diff --git a/compiler/syscall.go b/compiler/syscall.go -index 6a0bd328..582f2c5f 100644 ---- a/compiler/syscall.go -+++ b/compiler/syscall.go -@@ -56,7 +56,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { - } - constraints += ",~{rcx},~{r11}" - fnType := llvm.FunctionType(b.uintptrType, argTypes, false) -- target := llvm.InlineAsm(fnType, "syscall", constraints, true, false, llvm.InlineAsmDialectIntel) -+ target := llvm.InlineAsm(fnType, "syscall", constraints, true, false, llvm.InlineAsmDialectIntel, false) - return b.CreateCall(target, args, ""), nil - case b.GOARCH == "386" && b.GOOS == "linux": - // Sources: -@@ -82,7 +82,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { - argTypes = append(argTypes, llvmValue.Type()) - } - fnType := llvm.FunctionType(b.uintptrType, argTypes, false) -- target := llvm.InlineAsm(fnType, "int 0x80", constraints, true, false, llvm.InlineAsmDialectIntel) -+ target := llvm.InlineAsm(fnType, "int 0x80", constraints, true, false, llvm.InlineAsmDialectIntel, false) - return b.CreateCall(target, args, ""), nil - case b.GOARCH == "arm" && b.GOOS == "linux": - // Implement the EABI system call convention for Linux. -@@ -114,7 +114,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { - constraints += ",~{r" + strconv.Itoa(i) + "}" - } - fnType := llvm.FunctionType(b.uintptrType, argTypes, false) -- target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0) -+ target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0, false) - return b.CreateCall(target, args, ""), nil - case b.GOARCH == "arm64" && b.GOOS == "linux": - // Source: syscall(2) man page. -@@ -146,7 +146,7 @@ func (b *builder) createRawSyscall(call *ssa.CallCommon) (llvm.Value, error) { - } - constraints += ",~{x16},~{x17}" // scratch registers - fnType := llvm.FunctionType(b.uintptrType, argTypes, false) -- target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0) -+ target := llvm.InlineAsm(fnType, "svc #0", constraints, true, false, 0, false) - return b.CreateCall(target, args, ""), nil - default: - return llvm.Value{}, b.makeError(call.Pos(), "unknown GOOS/GOARCH for syscall: "+b.GOOS+"/"+b.GOARCH) --- -2.31.1 - diff --git a/0004-Use-system-mingw64-headers-and-crt.patch b/0004-Use-system-mingw64-headers-and-crt.patch new file mode 100644 index 0000000..656a9c7 --- /dev/null +++ b/0004-Use-system-mingw64-headers-and-crt.patch @@ -0,0 +1,121 @@ +From dcc3645326cc044066bef90b704a3836e335fa00 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Sun, 2 Jan 2022 05:47:18 -0500 +Subject: [PATCH 4/4] Use system mingw64 headers and crt + +Signed-off-by: Elliott Sales de Andrade +--- + builder/mingw-w64.go | 66 +++---------------------------------------- + compileopts/config.go | 7 ++--- + 2 files changed, 6 insertions(+), 67 deletions(-) + +diff --git a/builder/mingw-w64.go b/builder/mingw-w64.go +index bdab730f..07ce05c8 100644 +--- a/builder/mingw-w64.go ++++ b/builder/mingw-w64.go +@@ -1,31 +1,11 @@ + package builder + + import ( +- "io" +- "os" +- "path/filepath" +- "strings" +- +- "github.com/tinygo-org/tinygo/goenv" ++ "fmt" + ) + + var MinGW = Library{ + name: "mingw-w64", +- makeHeaders: func(target, includeDir string) error { +- // copy _mingw.h +- srcDir := filepath.Join(goenv.Get("TINYGOROOT"), "lib", "mingw-w64") +- outf, err := os.Create(includeDir + "/_mingw.h") +- if err != nil { +- return err +- } +- defer outf.Close() +- inf, err := os.Open(srcDir + "/mingw-w64-headers/crt/_mingw.h.in") +- if err != nil { +- return err +- } +- _, err = io.Copy(outf, inf) +- return err +- }, + cflags: func(target, headerPath string) []string { + // No flags necessary because there are no files to compile. + return nil +@@ -44,47 +24,9 @@ var MinGW = Library{ + // compile these files. + func makeMinGWExtraLibs(tmpdir string) []*compileJob { + var jobs []*compileJob +- root := goenv.Get("TINYGOROOT") +- // Normally all the api-ms-win-crt-*.def files are all compiled to a single +- // .lib file. But to simplify things, we're going to leave them as separate +- // files. +- for _, name := range []string{ +- "kernel32.def.in", +- "api-ms-win-crt-conio-l1-1-0.def", +- "api-ms-win-crt-convert-l1-1-0.def", +- "api-ms-win-crt-environment-l1-1-0.def", +- "api-ms-win-crt-filesystem-l1-1-0.def", +- "api-ms-win-crt-heap-l1-1-0.def", +- "api-ms-win-crt-locale-l1-1-0.def", +- "api-ms-win-crt-math-l1-1-0.def.in", +- "api-ms-win-crt-multibyte-l1-1-0.def", +- "api-ms-win-crt-private-l1-1-0.def.in", +- "api-ms-win-crt-process-l1-1-0.def", +- "api-ms-win-crt-runtime-l1-1-0.def.in", +- "api-ms-win-crt-stdio-l1-1-0.def", +- "api-ms-win-crt-string-l1-1-0.def", +- "api-ms-win-crt-time-l1-1-0.def", +- "api-ms-win-crt-utility-l1-1-0.def", +- } { +- outpath := filepath.Join(tmpdir, filepath.Base(name)+".lib") +- inpath := filepath.Join(root, "lib/mingw-w64/mingw-w64-crt/lib-common/"+name) +- job := &compileJob{ +- description: "create lib file " + inpath, +- result: outpath, +- run: func(job *compileJob) error { +- defpath := inpath +- if strings.HasSuffix(inpath, ".in") { +- // .in files need to be preprocessed by a preprocessor (-E) +- // first. +- defpath = outpath + ".def" +- err := runCCompiler("-E", "-x", "c", "-Wp,-w", "-P", "-DDEF_X64", "-o", defpath, inpath, "-I"+goenv.Get("TINYGOROOT")+"/lib/mingw-w64/mingw-w64-crt/def-include/") +- if err != nil { +- return err +- } +- } +- return link("ld.lld", "-m", "i386pep", "-o", outpath, defpath) +- }, +- } ++ for _, name := range []string{"kernel32", "ucrt"} { ++ outpath := fmt.Sprintf("/usr/x86_64-w64-mingw32/sys-root/mingw/lib/lib%s.a", name) ++ job := dummyCompileJob(outpath) + jobs = append(jobs, job) + } + return jobs +diff --git a/compileopts/config.go b/compileopts/config.go +index 22cb676e..1f54e157 100644 +--- a/compileopts/config.go ++++ b/compileopts/config.go +@@ -273,12 +273,9 @@ func (c *Config) CFlags() []string { + root := goenv.Get("TINYGOROOT") + cflags = append(cflags, "--sysroot="+root+"/lib/wasi-libc/sysroot") + case "mingw-w64": +- root := goenv.Get("TINYGOROOT") +- path, _ := c.LibcPath("mingw-w64") + cflags = append(cflags, +- "--sysroot="+path, +- "-Xclang", "-internal-isystem", "-Xclang", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "crt"), +- "-Xclang", "-internal-isystem", "-Xclang", filepath.Join(root, "lib", "mingw-w64", "mingw-w64-headers", "defaults", "include"), ++ "--sysroot=/usr/x86_64-w64-mingw32/sys-root", ++ "-Xclang", "-internal-isystem", "-Xclang", "/usr/x86_64-w64-mingw32/sys-root/mingw/include", + "-D_UCRT", + ) + case "": +-- +2.31.1 + diff --git a/musl.pub b/musl.pub new file mode 100644 index 0000000..7b7a8e9 --- /dev/null +++ b/musl.pub @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.12 (GNU/Linux) + +mQENBFNcU8EBCAC3g30bXEEh+YzD06JQ+iG+gr5Nb+tjianh8aJ/ql35lqICVj6F +nitol0KgSB1L3T80+EON3IEmic9rb2dw6EQ0rMl/6mSW91jQC1rGkGBZnlPZXOSW +JznNTBeHaK1NlG6m0shZ+wePWXHoFDtxaEoaMqAzR+E3EkSduLQb9tJJ2vtmIC2X +5SFT625DKpRYOpcUxX/d63U+gSQThTitHS9Me0mljcP+qKhP/HIajesx6s5QTBBe +vOlzih5MpI0FHcwSIbPwhPUWRS2RdFKfJRQZQAQ1ZiOJL0W82eFI1uztDgfudPcf +BbgZcSjqvrKiXaeZxHsj3aguaOqaKdRlkyD1ABEBAAG0GW11c2wgbGliYyA8bXVz +bEBsaWJjLm9yZz6JATcEEwECACEFAlNcU8ECGwMGCwkIBwMCBhUIAgkKCwMWAgEC +HgECF4AACgkQVrzbWTAgRQ91FwgAnxSTh6Yjz8Oj3p5hTA/5t/ueGpf3dgbVrOXB +W0dgIkv+JbpJnpNFzLLz+Yi7J0eDGhW2OXMvZ1AEJmwoNsbsXBvd2rQAMQGUdcDT +EhmM+9bRGvWW3hpRT9xFtVJb9bsj0vs6Tpcb9LmmUxwmrguAVo2eOQLQ3UvVWaFh +oqEbvhfEb7kvhDds4iFuHxpAH11GmK5Q6POtfFBhYXZBhXqbcHzs1hs51vdDWPUg +pcHdpeR9NiP1Ch7lVMHaTuiTmvQcOtCvk9K8OMsG+9z8e7BIis7bXbIjHOTLNVBI +IE+kq4I0/Co9shhdqump1pJ0b7R+CfgkFP3n9GpGKkGTgc3djrkBDQRTXFPBAQgA +y1PIPj4GJD8AAgSsNMkGxgT1Q0lV8cUh+qN4+uHjO6XzxyiX2rULnO25AWVSq4X2 +i4LzZxgfFG9wUPEWdeYsJzEzNQYL5JWJREBc1UO73pbVWykvP0zUlxtGKNIKHETx +7D02vBpkTUErlNXbKWw1jpApyBmhWZhRsCa320t2yL6v6lO/1YxxCZ/VkSYYbCZ3 +Rl/uH+l7CfAsOJLczMSHpLNFg+fl9gYy6S/LUZ1kwHWLFbTYbzTdEaPSm9i+iNJ2 +tMHnvkvDv9GhOhIrixENCzfe3muxd8+8/UxAjZdj24AYphIRhvMSxnLSOUsoGjeP +BWhTvKsr6r2MZGQcCiDNjwARAQABiQEeBBgBAgAJBQJTXFPBAhsMAAoJEFa821kw +IEUPz50H93mm0dQVPDJV075V5eySx8kYgQUwc7aP6zSQdoMZ3GDa8+fpta3PQv09 +CqVFeJf8KUTkJwMKbNu5GUUmuA1WbxdmRkOHp81PalLbZS0vAJh62TNntmHU0sFJ +kp+IviwOmAJaAO64BQAy/arH0D8q+LFAnMLdIFEVWiMuULXUCB1P4D8agbltd0rH +KniPwcWR8Sh0PUcVjUPFzdZz1Qpc+9VYp626p2OZ+tlLO41OZAsbJ24+cWB/fkWu +H6g/nw7y9+2xtX8TIi6YBtLCPx/5IcY8LzrSFC+NFYll5V1SoTiGtdhudSfs0Eb2 +RXdP42mK+kMrgynbOn1RP7p/rfpSlA== +=FgKg +-----END PGP PUBLIC KEY BLOCK----- diff --git a/sources b/sources index a08cd59..a84e639 100644 --- a/sources +++ b/sources @@ -1,8 +1,10 @@ -SHA512 (tinygo-0.20.0.tar.gz) = 6a675c306badf11fe25ff968491693d3d9ac6116df5c99ec4fa32bb484217faf0d7160f9899ce7ac2c78e4eb680fbff20b1b0815c4038987f7becabef9a0a65a +SHA512 (tinygo-0.21.0.tar.gz) = 2c2bff6921db0f8e1b7f16055a640277606d9052437dc8928b4799de76ac3bee24e43322c6d5b9b1edd142d82edd518c22fbd956aea2dcf7810b696d980205dd SHA512 (avr-6624554c02b237b23dc17d53e992bf54033fc228.tar.gz) = 1aa157bd761db38f8680614fa1cf47d7009508f65291b7eaaa5aba1ae76d35103f68a42947b7269a170d2f1cf8fb09941a5d74070fe6d204b68dd15a9ad2ed29 SHA512 (cmsis-9fe411cef1cef5de58e5957b89760759de44e393-clean.tar.xz) = f131fc241f61982c49f334eb502c2f13da61eb7bdaa641ee84a8de30c4d576b735b8aadeafd7d75351473a2df6a42de6a236ecc5dcc616ee6cfcc07af29446f9 SHA512 (cmsis_svd-df75ff974c76a911fc2815e29807f5ecaae06fc2-clean.tar.xz) = 8abbc6f366aed9571a74a4b6e7065ed2d6a59e0495c3745681d9a654d61edd136319788741f7afc781211adb64ed1faeafe9d6acc6be5a16d9ee48e98c5ddeb1 SHA512 (compiler-rt-9.0.0.src.tar.xz) = a7bb0a67165d29317cee58c22ed79f0d6a9cb9279dcd355d4267f3cd6c531a7be455a28267c591d6e2c0f9c56e363d40c10a405391e07d02ab3e30f00ffef2a8 +SHA512 (musl-1.2.2.tar.gz) = 5344b581bd6463d71af8c13e91792fa51f25a96a1ecbea81e42664b63d90b325aeb421dfbc8c22e187397ca08e84d9296a0c0c299ba04fa2b751d6864914bd82 +SHA512 (musl-1.2.2.tar.gz.asc) = 9d76bd9d88438e21689d37d7c519bc5575fa72b121ddf89c55c1a2246ecf423664d8e5199192720d652f6d08229f9b17b5520465d49b12ed2ba80814d1d8e9d8 SHA512 (nrfx-d779b49fc59c7a165e7da1d7cd7d57b28a059f16.tar.gz) = 31c7fc6fd88d4a74e5739b29659cb717a4629480d17d84e491d61c36c435aba16d38ef63d1036e508666a17eeaac5f11a5ff83211f88410f30cc2e152146ee83 -SHA512 (picolibc-80528c684b10aaee977397e7eb40c4784e6dc433.tar.gz) = d7cdddf4ba2c4c4a447864e899c9e92674438358e8c1123c80d38b0c1d57cb35fdaaa60a73a16331637884d23207fdc9f06d7f28dc5920c76e25808869e2c7b1 -SHA512 (wasi-libc-215adc8ac9f91eb055311acc72683fd2eb1ae15a.tar.gz) = f7e5dd8689d86bd781d2985bcab996018e9fefec7744fbbfcc19215d082f20b1ee84b252c3f905926327da6d6e0465c0f22b94e52f5fdb523317275a6b4bf3e1 +SHA512 (picolibc-f68b8204f797d6b3bfbc7c4da4d257961fbc8770.tar.gz) = fa58a7ddcb1a40239a220ca701a83895804b9ddc837652fa18e9aed2603bba2825df2074e2fa4fbf8649bb9a21308e877850273ec9d421795e2ae549f331ab13 +SHA512 (wasi-libc-ad5133410f66b93a2381db5b542aad5e0964db96.tar.gz) = 04cb3a25fef7949bf77f262bd939102f5b36e2ae85f28cdbfcd8a8984425fba54fae68049b777974bdbad96882fab383b44203e8f19a776d8a56a55475c4aab6 diff --git a/tinygo.spec b/tinygo.spec index c15e9fc..19f26f6 100644 --- a/tinygo.spec +++ b/tinygo.spec @@ -6,16 +6,17 @@ # https://github.com/tinygo-org/tinygo %global goipath github.com/tinygo-org/tinygo -Version: 0.20.0 +Version: 0.21.0 %global CMSIS_commit 9fe411cef1cef5de58e5957b89760759de44e393 %global avr_commit 6624554c02b237b23dc17d53e992bf54033fc228 %global clang_llvm_version 11 %global cmsis_svd_commit df75ff974c76a911fc2815e29807f5ecaae06fc2 %global compiler_rt_version 9.0.0 +%global musl_version 1.2.2 %global nrfx_commit d779b49fc59c7a165e7da1d7cd7d57b28a059f16 -%global picolibc_commit 80528c684b10aaee977397e7eb40c4784e6dc433 -%global wasi_libc_commit 215adc8ac9f91eb055311acc72683fd2eb1ae15a +%global picolibc_commit f68b8204f797d6b3bfbc7c4da4d257961fbc8770 +%global wasi_libc_commit ad5133410f66b93a2381db5b542aad5e0964db96 # No longer matching regular Go's /usr/share/gocode because it also provides # pre-compiled binaries, and symlinks to arch-specific clang headers. @@ -40,6 +41,7 @@ Summary: Go compiler for small places # avr-mcu: ASL 2.0 (packs) and MIT (Rust code, unused by this package) # cmsis-svd: ASL 2.0 and BSD and ISC and MIT (subsetted) # compiler-rt: NCSA or MIT +# musl: MIT # nrfx: BSD and ASL 2.0 # picolibc: BSD and ISC and MIT and GPLv2 (testing code only, unused by this package) # wasi-libc: BSD and CC0 and ISC and MIT and Public Domain @@ -51,21 +53,24 @@ Source2: cmsis-%{CMSIS_commit}-clean.tar.xz Source3: https://github.com/avr-rust/avr-mcu/archive/%{avr_commit}/avr-%{avr_commit}.tar.gz Source4: cmsis_svd-%{cmsis_svd_commit}-clean.tar.xz Source5: https://releases.llvm.org/%{compiler_rt_version}/compiler-rt-%{compiler_rt_version}.src.tar.xz -Source6: https://github.com/NordicSemiconductor/nrfx/archive/%{nrfx_commit}/nrfx-%{nrfx_commit}.tar.gz -Source7: https://github.com/keith-packard/picolibc/archive/%{picolibc_commit}/picolibc-%{picolibc_commit}.tar.gz -Source8: https://github.com/WebAssembly/wasi-libc/archive/%{wasi_libc_commit}/wasi-libc-%{wasi_libc_commit}.tar.gz +Source60: https://musl.libc.org/releases/musl-%{musl_version}.tar.gz +Source61: https://musl.libc.org/releases/musl-%{musl_version}.tar.gz.asc +Source62: https://musl.libc.org/musl.pub +Source7: https://github.com/NordicSemiconductor/nrfx/archive/%{nrfx_commit}/nrfx-%{nrfx_commit}.tar.gz +Source8: https://github.com/keith-packard/picolibc/archive/%{picolibc_commit}/picolibc-%{picolibc_commit}.tar.gz +Source9: https://github.com/WebAssembly/wasi-libc/archive/%{wasi_libc_commit}/wasi-libc-%{wasi_libc_commit}.tar.gz # We don't have wasmtime to run these. Patch0001: 0001-Skip-WASI-tests.patch # We don't have cross-compiled glibc to build these. Patch0002: 0002-Only-run-native-Linux-tests-on-their-own-GOARCH.patch -# https://github.com/tinygo-org/tinygo/pull/1538 -Patch0003: 0003-Use-clang-to-do-linking.patch -Patch0004: 0004-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch +Patch0003: 0003-Add-canThrow-argument-to-llvm.InlineAsm-calls.patch +Patch0004: 0004-Use-system-mingw64-headers-and-crt.patch # Not supported upstream yet. ExcludeArch: armv7hl ppc64le s390x BuildRequires: (clang-devel >= %{clang_llvm_version} with clang-devel < %{lua: print(tonumber(rpm.expand('%{clang_llvm_version}')) + 1)}) +BuildRequires: golang(github.com/aykevl/go-wasm) BuildRequires: golang(github.com/blakesmith/ar) %ifnarch %{ix86} BuildRequires: chromium @@ -84,12 +89,20 @@ BuildRequires: make BuildRequires: avr-gcc BuildRequires: avr-libc +BuildRequires: binaryen >= 102 # We don't have glibc for arm, so skip these. #BuildRequires: gcc-arm-linux-gnu #BuildRequires: gcc-aarch64-linux-gnu BuildRequires: lld +BuildRequires: mingw64-crt +BuildRequires: mingw64-headers BuildRequires: nodejs BuildRequires: qemu-system-arm-core +BuildRequires: qemu-system-riscv-core +BuildRequires: qemu-user + +# For GPG signature verification +BuildRequires: gnupg2 Requires: golang Requires: lld @@ -98,7 +111,11 @@ Recommends: avr-libc Recommends: clang # Add this when LLVM supports ESP natively. # Recommends: esptool +Recommends: mingw64-crt +Recommends: mingw64-headers Recommends: qemu-system-arm-core +Recommends: qemu-system-riscv-core +Recommends: qemu-user %description %{common_description} @@ -108,10 +125,7 @@ Recommends: qemu-system-arm-core %prep %goprep -%patch0001 -p1 -%patch0002 -p1 -%patch0003 -p1 -%patch0004 -p1 +%autopatch -p1 tar -C lib -xf %{SOURCE2} rmdir lib/CMSIS @@ -129,17 +143,23 @@ tar -C lib -xf %{SOURCE5} rmdir lib/compiler-rt mv lib/compiler-rt-%{compiler_rt_version}.src lib/compiler-rt -tar -C lib -xf %{SOURCE6} +# Verify *before* actually unpacking! +%{gpgverify} --keyring='%{SOURCE62}' --signature='%{SOURCE61}' --data='%{SOURCE60}' +tar -C lib -xf %{SOURCE60} +rmdir lib/musl +mv lib/musl-%{musl_version} lib/musl + +tar -C lib -xf %{SOURCE7} rmdir lib/nrfx mv lib/nrfx-%{nrfx_commit} lib/nrfx rm lib/nrfx/.gitignore chmod -x lib/nrfx/doc/generate_html_doc.sh -tar -C lib -xf %{SOURCE7} +tar -C lib -xf %{SOURCE8} rmdir lib/picolibc mv lib/picolibc-%{picolibc_commit} lib/picolibc -tar -C lib -xf %{SOURCE8} +tar -C lib -xf %{SOURCE9} rmdir lib/wasi-libc mv lib/wasi-libc-%{wasi_libc_commit} lib/wasi-libc @@ -150,11 +170,13 @@ mv lib/wasi-libc-%{wasi_libc_commit} lib/wasi-libc export BUILDTAGS="llvm%{clang_llvm_version}" LDFLAGS="-X github.com/tinygo-org/tinygo/goenv.TINYGOROOT=%{tinygoroot} " %gobuild -o %{gobuilddir}/bin/tinygo %{goipath} GO111MODULE=off %make_build gen-device STM32=0 -for target in armv6m-none-eabi armv7m-none-eabi armv7em-none-eabi; do +for arch in armv6m armv7m armv7em; do + target="${arch}-unknown-unknown-eabi" + mkdir -p ${target} for libc in compiler-rt picolibc; do TINYGOROOT=$PWD \ %{gobuilddir}/bin/tinygo \ - build-library -target=$target -o ${target}-${libc}.a ${libc} + build-library -target=${target} -o ${target}/${libc} ${libc} done done %make_build wasi-libc CLANG=clang-%{clang_llvm_version} LLVM_AR=llvm-ar LLVM_NM=llvm-nm @@ -176,6 +198,31 @@ install -vpm 0644 lib/compiler-rt/README.txt %{buildroot}%{tinygoroot}/lib/compi install -vpm 0644 lib/compiler-rt/LICENSE.TXT %{buildroot}%{tinygoroot}/lib/compiler-rt/ install -vdm 0755 %{buildroot}%{tinygoroot}/lib/compiler-rt/lib cp -rp lib/compiler-rt/lib/builtins %{buildroot}%{tinygoroot}/lib/compiler-rt/lib/ +install -vdm 0755 %{buildroot}%{tinygoroot}/lib/musl +cp -rp lib/musl/COPYRIGHT %{buildroot}%{tinygoroot}/lib/musl +cp -rp lib/musl/include %{buildroot}%{tinygoroot}/lib/musl +install -vdm 0755 %{buildroot}%{tinygoroot}/lib/musl/arch +cp -rp lib/musl/arch/aarch64 %{buildroot}%{tinygoroot}/lib/musl/arch +cp -rp lib/musl/arch/arm %{buildroot}%{tinygoroot}/lib/musl/arch +cp -rp lib/musl/arch/generic %{buildroot}%{tinygoroot}/lib/musl/arch +cp -rp lib/musl/arch/i386 %{buildroot}%{tinygoroot}/lib/musl/arch +cp -rp lib/musl/arch/x86_64 %{buildroot}%{tinygoroot}/lib/musl/arch +install -vdm 0755 %{buildroot}%{tinygoroot}/lib/musl/crt +cp -rp lib/musl/crt/crt1.c %{buildroot}%{tinygoroot}/lib/musl/crt +install -vdm 0755 %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/env %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/errno %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/exit %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/include %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/internal %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/malloc %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/mman %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/signal %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/stdio %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/string %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/thread %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/time %{buildroot}%{tinygoroot}/lib/musl/src +cp -rp lib/musl/src/unistd %{buildroot}%{tinygoroot}/lib/musl/src cp -rp lib/nrfx %{buildroot}%{tinygoroot}/lib/ install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc cp -rp lib/wasi-libc/sysroot %{buildroot}%{tinygoroot}/lib/wasi-libc/ @@ -185,12 +232,15 @@ cp -rp lib/picolibc/newlib/libc/include %{buildroot}%{tinygoroot}/lib/picolibc/n cp -rp lib/picolibc/newlib/libc/locale %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc cp -rp lib/picolibc/newlib/libc/string %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc cp -rp lib/picolibc/newlib/libc/tinystdio %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc -cp -rp lib/picolibc-include %{buildroot}%{tinygoroot}/lib +install -vdm 0755 %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libm +cp -rp lib/picolibc/newlib/libm/common %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libm +cp -rp lib/picolibc-stdio.c %{buildroot}%{tinygoroot}/lib install -vdm 0755 %{buildroot}%{tinygoroot}/pkg -for target in armv6m-none-eabi armv7m-none-eabi armv7em-none-eabi; do +for arch in armv6m armv7m armv7em; do + target="${arch}-unknown-unknown-eabi" + install -vdm 0755 %{buildroot}%{tinygoroot}/pkg/${target} for libc in compiler-rt picolibc; do - install -vdm 0755 %{buildroot}%{tinygoroot}/pkg/${target} - install -vpm 0644 ${target}-${libc}.a %{buildroot}%{tinygoroot}/pkg/${target}/${libc}.a + cp -rp ${target}/${libc} %{buildroot}%{tinygoroot}/pkg/${target}/ done done cp -rp src %{buildroot}%{tinygoroot}/ @@ -199,12 +249,13 @@ cp -rp targets %{buildroot}%{tinygoroot}/ %if %{with check} -%global gotestflags %gocompilerflags -tags="llvm%{clang_llvm_version}" +%global gotestflags %gocompilerflags -v -tags="llvm%{clang_llvm_version}" %check export TINYGOROOT=%{buildroot}%{tinygoroot} export GOPATH=%{buildroot}%{tinygoroot}:%{gopath} export PATH=%{buildroot}%{_bindir}:$PATH export GO111MODULE=off +export XDG_CACHE_HOME="${PWD}/$(mktemp -d tinygo.XXXXXX)" %gocheck -v -d tests/tinygotest make smoketest STM32=0 XTENSA=0 %ifnarch %{ix86} aarch64 @@ -223,6 +274,7 @@ make wasmtest %doc %{tinygoroot}/lib/compiler-rt/README.txt %license %{tinygoroot}/lib/nrfx/LICENSE %doc %{tinygoroot}/lib/nrfx/README.md +%license %{tinygoroot}/lib/musl/COPYRIGHT #gopkgfiles