Compare commits
15 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da069d072e | ||
|
|
faf08a188d | ||
|
|
20e209e6d0 | ||
|
|
1ba82360fb | ||
|
|
8526125e83 | ||
|
|
dc10663dd3 | ||
|
|
98fdc4179f | ||
|
|
4bdd7c5cf3 | ||
|
|
5f84d1ac7a | ||
|
|
36b6b72c3d | ||
|
|
b460c7c931 | ||
|
|
716d8be332 | ||
|
|
cc972cf7e5 | ||
|
|
16bb42b116 | ||
|
|
70df58fba1 |
17 changed files with 634 additions and 1199 deletions
44
.gitignore
vendored
44
.gitignore
vendored
|
|
@ -1,45 +1,19 @@
|
|||
/tinygo-*.tar.gz
|
||||
/avr-*.tar.gz
|
||||
/cmsis-*.tar.gz
|
||||
/cmsis-*-clean.tar.xz
|
||||
/cmsis_svd-*.tar.gz
|
||||
/cmsis_svd-*-clean.tar.xz
|
||||
/cmsis_svd_data-*.tar.gz
|
||||
/cmsis_svd_data-*-clean.tar.xz
|
||||
/compiler-rt-*.src.tar.xz
|
||||
/compiler-rt-*.src.tar.xz.sig
|
||||
/macos-minimal-sdk-*.tar.gz
|
||||
/mingw64-*.tar.gz
|
||||
/musl-*.tar.gz
|
||||
/musl-*.tar.gz.asc
|
||||
/net-*.tar.gz
|
||||
/nrfx-*.tar.gz
|
||||
/picolibc-*.tar.gz
|
||||
/wasi-libc-*.tar.gz
|
||||
/tinygo-0.6.0.tar.gz
|
||||
/tinygo-0.7.0.tar.gz
|
||||
/tinygo-0.7.1.tar.gz
|
||||
/tinygo-0.8.0.tar.gz
|
||||
/tinygo-0.9.0.tar.gz
|
||||
/tinygo-0.10.0.tar.gz
|
||||
/tinygo-0.11.0.tar.gz
|
||||
/tinygo-0.12.0.tar.gz
|
||||
/tinygo-0.13.0.tar.gz
|
||||
/tinygo-0.13.1.tar.gz
|
||||
/tinygo-0.14.0.tar.gz
|
||||
/tinygo-0.14.1.tar.gz
|
||||
/tinygo-0.15.0.tar.gz
|
||||
/tinygo-0.16.0.tar.gz
|
||||
/tinygo-0.17.0.tar.gz
|
||||
/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
|
||||
/tinygo-0.22.0.tar.gz
|
||||
/musl-1.2.0.tar.gz
|
||||
/musl-1.2.0.tar.gz.asc
|
||||
/tinygo-0.23.0.tar.gz
|
||||
/macos-minimal-sdk-ebb736fda2bec7cea38dcda807518b835a539525.tar.gz
|
||||
/tinygo-0.25.0.tar.gz
|
||||
/tinygo-0.26.0.tar.gz
|
||||
/tinygo-0.27.0.tar.gz
|
||||
/musl-1.2.3.tar.gz
|
||||
/musl-1.2.3.tar.gz.asc
|
||||
/mingw64-8526cb618269440a94810b94b77f8bd48c5c3396.tar.gz
|
||||
/tinygo-0.28.1.tar.gz
|
||||
/tinygo-0.29.0.tar.gz
|
||||
/tinygo-0.30.0.tar.gz
|
||||
/bdwgc-1166f11f7dee08d7ad369296b24cf8c9582f8789.tar.gz
|
||||
|
|
|
|||
|
|
@ -1,38 +1,50 @@
|
|||
From ee856392109e39cf60e83022441c94adee205447 Mon Sep 17 00:00:00 2001
|
||||
From fdd5322026e4b7b2e7fe6a80628b7239b4c4eb99 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Tue, 15 Dec 2020 05:06:04 -0500
|
||||
Subject: [PATCH 1/7] Skip WASI tests.
|
||||
Subject: [PATCH 1/5] Skip WASI tests.
|
||||
|
||||
We do not have wasmtime available.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
main_test.go | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
main_test.go | 17 -----------------
|
||||
1 file changed, 17 deletions(-)
|
||||
|
||||
diff --git a/main_test.go b/main_test.go
|
||||
index ae7aed56..ac204f0c 100644
|
||||
index b07d6aaa..ae0a4482 100644
|
||||
--- a/main_test.go
|
||||
+++ b/main_test.go
|
||||
@@ -171,10 +171,6 @@ func TestBuild(t *testing.T) {
|
||||
t.Parallel()
|
||||
runPlatTests(optionsFromTarget("wasm", sema), tests, t)
|
||||
@@ -188,22 +188,6 @@ func TestBuild(t *testing.T) {
|
||||
runTest("gc.go", optionsBoehm, t, nil, nil)
|
||||
})
|
||||
})
|
||||
- t.Run("WASI", func(t *testing.T) {
|
||||
- t.Run("WASIp1", func(t *testing.T) {
|
||||
- t.Parallel()
|
||||
- runPlatTests(optionsFromTarget("wasi", sema), tests, t)
|
||||
- runPlatTests(optionsFromTarget("wasip1", sema), tests, t)
|
||||
-
|
||||
- // Test with -gc=boehm.
|
||||
- t.Run("gc.go-boehm", func(t *testing.T) {
|
||||
- t.Parallel()
|
||||
- optionsBoehm := optionsFromTarget("wasip1", sema)
|
||||
- optionsBoehm.GC = "boehm"
|
||||
- runTest("gc.go", optionsBoehm, t, nil, nil)
|
||||
- })
|
||||
- })
|
||||
- t.Run("WASIp2", func(t *testing.T) {
|
||||
- t.Parallel()
|
||||
- runPlatTests(optionsFromTarget("wasip2", sema), tests, t)
|
||||
- })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,7 +421,6 @@ func TestTest(t *testing.T) {
|
||||
if runtime.GOOS == "linux" {
|
||||
@@ -925,7 +909,6 @@ func TestTest(t *testing.T) {
|
||||
|
||||
// Node/Wasmtime
|
||||
targ{"WASM", optionsFromTarget("wasm", sema)},
|
||||
- targ{"WASI", optionsFromTarget("wasi", sema)},
|
||||
- targ{"WASI", optionsFromTarget("wasip1", sema)},
|
||||
)
|
||||
}
|
||||
for _, targ := range targs {
|
||||
--
|
||||
2.41.0
|
||||
2.50.0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
From 1f60829a1fffdcbe268c1998a560fdeb6029407e Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Mon, 3 Jan 2022 22:39:31 -0500
|
||||
Subject: [PATCH 2/7] Skip some cross Linux tests where qemu is broken
|
||||
|
||||
The upstream issues will hopefully be fixed soon:
|
||||
|
||||
- https://gitlab.com/qemu-project/qemu/-/issues/447
|
||||
- https://gitlab.com/qemu-project/qemu/-/issues/690
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
main_test.go | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/main_test.go b/main_test.go
|
||||
index ac204f0c..27344c27 100644
|
||||
--- a/main_test.go
|
||||
+++ b/main_test.go
|
||||
@@ -264,6 +264,13 @@ func runPlatTests(options compileopts.Options, tests []string, t *testing.T) {
|
||||
}
|
||||
|
||||
func emuCheck(t *testing.T, options compileopts.Options) {
|
||||
+ // Skip running the test executable due to bugs in qemu.
|
||||
+ // https://gitlab.com/qemu-project/qemu/-/issues/447
|
||||
+ // https://gitlab.com/qemu-project/qemu/-/issues/690
|
||||
+ if runtime.GOARCH == "arm64" && (options.GOARCH == "386" || options.GOARCH == "arm") {
|
||||
+ t.Skip("qemu is broken for this host/target architecture combination")
|
||||
+ }
|
||||
+
|
||||
// Check if the emulator is installed.
|
||||
spec, err := compileopts.LoadTarget(&options)
|
||||
if err != nil {
|
||||
@@ -342,6 +349,11 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
+ if runtime.GOARCH == "arm64" && options.GOARCH == "amd64" && name == "reflect.go" {
|
||||
+ // https://github.com/tinygo-org/tinygo/issues/3888
|
||||
+ t.Skip("qemu is broken for this host/target architecture combination")
|
||||
+ }
|
||||
+
|
||||
// Build the test binary.
|
||||
stdout := &bytes.Buffer{}
|
||||
_, err = buildAndRun("./"+path, config, stdout, cmdArgs, environmentVars, time.Minute, func(cmd *exec.Cmd, result builder.BuildResult) error {
|
||||
@@ -353,6 +365,13 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
|
||||
return
|
||||
}
|
||||
|
||||
+ // Skip running the test executable due to bugs in qemu.
|
||||
+ // https://gitlab.com/qemu-project/qemu/-/issues/447
|
||||
+ // https://gitlab.com/qemu-project/qemu/-/issues/690
|
||||
+ if runtime.GOARCH == "arm64" && (options.GOARCH == "386" || options.GOARCH == "arm") {
|
||||
+ return
|
||||
+ }
|
||||
+
|
||||
// putchar() prints CRLF, convert it to LF.
|
||||
actual := bytes.Replace(stdout.Bytes(), []byte{'\r', '\n'}, []byte{'\n'}, -1)
|
||||
expected = bytes.Replace(expected, []byte{'\r', '\n'}, []byte{'\n'}, -1) // for Windows
|
||||
--
|
||||
2.41.0
|
||||
|
||||
58
0002-Skip-tests-that-require-Go-module-mode.patch
Normal file
58
0002-Skip-tests-that-require-Go-module-mode.patch
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
From f650ab16b5a3badf48922f77683ceaf791c82d64 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Wed, 28 Feb 2024 04:26:40 -0500
|
||||
Subject: [PATCH 2/5] Skip tests that require Go module mode
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
errors_test.go | 2 +-
|
||||
main_test.go | 2 +-
|
||||
testdata/errors/loader-invaliddep.go | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/errors_test.go b/errors_test.go
|
||||
index 871dc4c0..3d0bb162 100644
|
||||
--- a/errors_test.go
|
||||
+++ b/errors_test.go
|
||||
@@ -37,7 +37,7 @@ func TestErrors(t *testing.T) {
|
||||
{name: "loader-importcycle"},
|
||||
{name: "loader-invaliddep"},
|
||||
{name: "loader-invalidpackage"},
|
||||
- {name: "loader-nopackage"},
|
||||
+ // {name: "loader-nopackage"},
|
||||
{name: "optimizer"},
|
||||
{name: "syntax"},
|
||||
{name: "types"},
|
||||
diff --git a/main_test.go b/main_test.go
|
||||
index ae0a4482..ca052821 100644
|
||||
--- a/main_test.go
|
||||
+++ b/main_test.go
|
||||
@@ -78,7 +78,6 @@ func TestBuild(t *testing.T) {
|
||||
"json.go",
|
||||
"map.go",
|
||||
"math.go",
|
||||
- "oldgo/",
|
||||
"print.go",
|
||||
"reflect.go",
|
||||
"signal.go",
|
||||
@@ -1031,6 +1030,7 @@ func ioLogger(t *testing.T, wg *sync.WaitGroup) io.WriteCloser {
|
||||
}
|
||||
|
||||
func TestGetListOfPackages(t *testing.T) {
|
||||
+ t.Skip("Not available in non-module mode")
|
||||
opts := optionsFromTarget("", sema)
|
||||
tests := []struct {
|
||||
pkgs []string
|
||||
diff --git a/testdata/errors/loader-invaliddep.go b/testdata/errors/loader-invaliddep.go
|
||||
index 05c2f2d5..719a617b 100644
|
||||
--- a/testdata/errors/loader-invaliddep.go
|
||||
+++ b/testdata/errors/loader-invaliddep.go
|
||||
@@ -5,4 +5,4 @@ import _ "github.com/tinygo-org/tinygo/testdata/errors/invaliddep"
|
||||
func main() {
|
||||
}
|
||||
|
||||
-// ERROR: invaliddep{{[\\/]}}invaliddep.go:1:1: expected 'package', found ppackage
|
||||
+// ERROR: {{.*}}invaliddep{{[\\/]}}invaliddep.go:1:1: expected 'package', found ppackage
|
||||
--
|
||||
2.50.0
|
||||
|
||||
126
0003-Set-LLVM-search-paths-for-Fedora.patch
Normal file
126
0003-Set-LLVM-search-paths-for-Fedora.patch
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
From d516beb86673a9b80ca75c41e8fb7cba7e3f126f Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Sun, 27 Oct 2024 23:33:18 -0400
|
||||
Subject: [PATCH 3/5] Set LLVM search paths for Fedora
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
cgo/libclang_config_llvm15.go | 4 ++--
|
||||
cgo/libclang_config_llvm16.go | 4 ++--
|
||||
cgo/libclang_config_llvm17.go | 4 ++--
|
||||
cgo/libclang_config_llvm18.go | 4 ++--
|
||||
cgo/libclang_config_llvm19.go | 4 ++--
|
||||
cgo/libclang_config_llvm20.go | 4 ++--
|
||||
6 files changed, 12 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/cgo/libclang_config_llvm15.go b/cgo/libclang_config_llvm15.go
|
||||
index edb1128d..0dc87193 100644
|
||||
--- a/cgo/libclang_config_llvm15.go
|
||||
+++ b/cgo/libclang_config_llvm15.go
|
||||
@@ -3,11 +3,11 @@
|
||||
package cgo
|
||||
|
||||
/*
|
||||
-#cgo linux CFLAGS: -I/usr/lib/llvm-15/include
|
||||
+#cgo linux CFLAGS: -I/usr/lib64/llvm15/include
|
||||
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@15/include
|
||||
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@15/include
|
||||
#cgo freebsd CFLAGS: -I/usr/local/llvm15/include
|
||||
-#cgo linux LDFLAGS: -L/usr/lib/llvm-15/lib -lclang
|
||||
+#cgo linux LDFLAGS: -L/usr/lib64/llvm15/lib -lclang
|
||||
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@15/lib -lclang
|
||||
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@15/lib -lclang
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/llvm15/lib -lclang
|
||||
diff --git a/cgo/libclang_config_llvm16.go b/cgo/libclang_config_llvm16.go
|
||||
index ee354e21..4c338678 100644
|
||||
--- a/cgo/libclang_config_llvm16.go
|
||||
+++ b/cgo/libclang_config_llvm16.go
|
||||
@@ -9,11 +9,11 @@ package cgo
|
||||
// ln -sf ../../x86_64-linux-gnu/libclang-16.so.1 /usr/lib/llvm-16/lib/libclang.so
|
||||
|
||||
/*
|
||||
-#cgo linux CFLAGS: -I/usr/lib/llvm-16/include
|
||||
+#cgo linux CFLAGS: -I/usr/lib64/llvm16/include
|
||||
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@16/include
|
||||
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@16/include
|
||||
#cgo freebsd CFLAGS: -I/usr/local/llvm16/include
|
||||
-#cgo linux LDFLAGS: -L/usr/lib/llvm-16/lib -lclang
|
||||
+#cgo linux LDFLAGS: -L/usr/lib64/llvm16/lib -lclang
|
||||
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@16/lib -lclang
|
||||
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@16/lib -lclang
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/llvm16/lib -lclang
|
||||
diff --git a/cgo/libclang_config_llvm17.go b/cgo/libclang_config_llvm17.go
|
||||
index 6395d8a3..609b0758 100644
|
||||
--- a/cgo/libclang_config_llvm17.go
|
||||
+++ b/cgo/libclang_config_llvm17.go
|
||||
@@ -3,11 +3,11 @@
|
||||
package cgo
|
||||
|
||||
/*
|
||||
-#cgo linux CFLAGS: -I/usr/include/llvm-17 -I/usr/include/llvm-c-17 -I/usr/lib/llvm-17/include
|
||||
+#cgo linux CFLAGS: -I/usr/lib64/llvm17/include
|
||||
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@17/include
|
||||
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@17/include
|
||||
#cgo freebsd CFLAGS: -I/usr/local/llvm17/include
|
||||
-#cgo linux LDFLAGS: -L/usr/lib/llvm-17/lib -lclang
|
||||
+#cgo linux LDFLAGS: -L/usr/lib64/llvm17/lib -lclang
|
||||
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@17/lib -lclang
|
||||
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@17/lib -lclang
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/llvm17/lib -lclang
|
||||
diff --git a/cgo/libclang_config_llvm18.go b/cgo/libclang_config_llvm18.go
|
||||
index da181291..76f23129 100644
|
||||
--- a/cgo/libclang_config_llvm18.go
|
||||
+++ b/cgo/libclang_config_llvm18.go
|
||||
@@ -3,11 +3,11 @@
|
||||
package cgo
|
||||
|
||||
/*
|
||||
-#cgo linux CFLAGS: -I/usr/include/llvm-18 -I/usr/include/llvm-c-18 -I/usr/lib/llvm-18/include
|
||||
+#cgo linux CFLAGS: -I/usr/lib64/llvm18/include
|
||||
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@18/include
|
||||
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@18/include
|
||||
#cgo freebsd CFLAGS: -I/usr/local/llvm18/include
|
||||
-#cgo linux LDFLAGS: -L/usr/lib/llvm-18/lib -lclang
|
||||
+#cgo linux LDFLAGS: -L/usr/lib64/llvm18/lib -lclang
|
||||
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@18/lib -lclang
|
||||
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@18/lib -lclang
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/llvm18/lib -lclang
|
||||
diff --git a/cgo/libclang_config_llvm19.go b/cgo/libclang_config_llvm19.go
|
||||
index 11a64e72..94c95bcb 100644
|
||||
--- a/cgo/libclang_config_llvm19.go
|
||||
+++ b/cgo/libclang_config_llvm19.go
|
||||
@@ -3,11 +3,11 @@
|
||||
package cgo
|
||||
|
||||
/*
|
||||
-#cgo linux CFLAGS: -I/usr/include/llvm-19 -I/usr/include/llvm-c-19 -I/usr/lib/llvm-19/include
|
||||
+#cgo linux CFLAGS: -I/usr/lib64/llvm19/include
|
||||
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@19/include
|
||||
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@19/include
|
||||
#cgo freebsd CFLAGS: -I/usr/local/llvm19/include
|
||||
-#cgo linux LDFLAGS: -L/usr/lib/llvm-19/lib -lclang
|
||||
+#cgo linux LDFLAGS: -L/usr/lib64/llvm19/lib -lclang
|
||||
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@19/lib -lclang
|
||||
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@19/lib -lclang
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/llvm19/lib -lclang
|
||||
diff --git a/cgo/libclang_config_llvm20.go b/cgo/libclang_config_llvm20.go
|
||||
index faa2e54d..947558d6 100644
|
||||
--- a/cgo/libclang_config_llvm20.go
|
||||
+++ b/cgo/libclang_config_llvm20.go
|
||||
@@ -3,11 +3,11 @@
|
||||
package cgo
|
||||
|
||||
/*
|
||||
-#cgo linux CFLAGS: -I/usr/include/llvm-20 -I/usr/include/llvm-c-20 -I/usr/lib/llvm-20/include
|
||||
+#cgo linux CFLAGS: -I/usr/lib64/llvm20/include
|
||||
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@20/include
|
||||
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@20/include
|
||||
#cgo freebsd CFLAGS: -I/usr/local/llvm20/include
|
||||
-#cgo linux LDFLAGS: -L/usr/lib/llvm-20/lib -lclang
|
||||
+#cgo linux LDFLAGS: -L/usr/lib64/llvm20/lib -lclang
|
||||
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@20/lib -lclang
|
||||
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@20/lib -lclang
|
||||
#cgo freebsd LDFLAGS: -L/usr/local/llvm20/lib -lclang
|
||||
--
|
||||
2.50.0
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
From 3f6a6f241ab37976f07e792986b5c47fdde20c8a Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Sun, 6 Feb 2022 03:49:16 -0500
|
||||
Subject: [PATCH 3/7] Suggest optional packages to install if missing
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
builder/jobs.go | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
diff --git a/builder/jobs.go b/builder/jobs.go
|
||||
index a23d0753..2380f683 100644
|
||||
--- a/builder/jobs.go
|
||||
+++ b/builder/jobs.go
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"container/heap"
|
||||
"errors"
|
||||
"fmt"
|
||||
+ "os"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
@@ -37,6 +38,22 @@ type compileJob struct {
|
||||
duration time.Duration // how long it took to run this job (only set after finishing)
|
||||
}
|
||||
|
||||
+// checkIfPackagedFileExistsJob returns a new *compileJob that checks if a file
|
||||
+// exists. If the file does not exist, the job will fail with an error
|
||||
+// suggesting to install the named system packageToInstall.
|
||||
+func checkIfPackagedFileExistsJob(fileName, packageToInstall string) *compileJob {
|
||||
+ return &compileJob{
|
||||
+ description: fmt.Sprintf("check if %v exists", fileName),
|
||||
+ result: fileName,
|
||||
+ run: func(*compileJob) (err error) {
|
||||
+ if _, err := os.Stat(fileName); errors.Is(err, os.ErrNotExist) {
|
||||
+ return fmt.Errorf("%v does not exist; please install %v via dnf", fileName, packageToInstall)
|
||||
+ }
|
||||
+ return nil
|
||||
+ },
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
// dummyCompileJob returns a new *compileJob that produces an output without
|
||||
// doing anything. This can be useful where a *compileJob producing an output is
|
||||
// expected but nothing needs to be done, for example for a load from a cache.
|
||||
--
|
||||
2.41.0
|
||||
|
||||
33
0004-Normalize-expected-path-for-chdir-tests.patch
Normal file
33
0004-Normalize-expected-path-for-chdir-tests.patch
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
From d83874e6ab92ee4142cc7672da226a9091f7211a Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Tue, 31 Dec 2024 02:00:17 -0500
|
||||
Subject: [PATCH 4/5] Normalize expected path for chdir tests
|
||||
|
||||
The expected path comes from a simple string concatenation in shell, but
|
||||
`os.Getwd` appears to have the normalized working directory, so this can
|
||||
fail if any parent directory is a symlink.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
tests/testing/chdir/chdir.go | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/tests/testing/chdir/chdir.go b/tests/testing/chdir/chdir.go
|
||||
index 75281c21..660b25ac 100644
|
||||
--- a/tests/testing/chdir/chdir.go
|
||||
+++ b/tests/testing/chdir/chdir.go
|
||||
@@ -20,6 +20,11 @@ func main() {
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
cwd = filepath.ToSlash(cwd)
|
||||
+ } else {
|
||||
+ expectDir, err = filepath.EvalSymlinks(expectDir)
|
||||
+ if err != nil {
|
||||
+ log.Fatal(err)
|
||||
+ }
|
||||
}
|
||||
if cwd != expectDir {
|
||||
log.Fatalf("expected:\"%v\" != os.Getwd():\"%v\"", expectDir, cwd)
|
||||
--
|
||||
2.50.0
|
||||
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
From bf51015656ff3b1bbe6b41ea1155610178c2961d Mon Sep 17 00:00:00 2001
|
||||
From: Ayke van Laethem <aykevanlaethem@gmail.com>
|
||||
Date: Thu, 21 Sep 2023 15:39:06 +0200
|
||||
Subject: [PATCH 4/7] transform: fix bug in StringToBytes optimization pass
|
||||
|
||||
Previously, this pass would convert any read-only use of a
|
||||
runtime.stringToBytes call to use the original string buffer instead.
|
||||
This is incorrect: if there are any writes to the resulting buffer, none
|
||||
of the slice buffer pointers can be converted to use the original
|
||||
read-only string buffer.
|
||||
|
||||
This commit fixes that bug and adds a test to prove the new (correct)
|
||||
behavior.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
transform/rtcalls.go | 24 ++++++++++++++++++------
|
||||
transform/testdata/stringtobytes.ll | 16 ++++++++++++++++
|
||||
transform/testdata/stringtobytes.out.ll | 10 ++++++++++
|
||||
3 files changed, 44 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/transform/rtcalls.go b/transform/rtcalls.go
|
||||
index 36d2853b..0b6feff2 100644
|
||||
--- a/transform/rtcalls.go
|
||||
+++ b/transform/rtcalls.go
|
||||
@@ -28,32 +28,44 @@ func OptimizeStringToBytes(mod llvm.Module) {
|
||||
|
||||
// strptr is always constant because strings are always constant.
|
||||
|
||||
- convertedAllUses := true
|
||||
+ var pointerUses []llvm.Value
|
||||
+ canConvertPointer := true
|
||||
for _, use := range getUses(call) {
|
||||
if use.IsAExtractValueInst().IsNil() {
|
||||
// Expected an extractvalue, but this is something else.
|
||||
- convertedAllUses = false
|
||||
+ canConvertPointer = false
|
||||
continue
|
||||
}
|
||||
switch use.Type().TypeKind() {
|
||||
case llvm.IntegerTypeKind:
|
||||
// A length (len or cap). Propagate the length value.
|
||||
+ // This can always be done because the byte slice is always the
|
||||
+ // same length as the original string.
|
||||
use.ReplaceAllUsesWith(strlen)
|
||||
use.EraseFromParentAsInstruction()
|
||||
case llvm.PointerTypeKind:
|
||||
// The string pointer itself.
|
||||
if !isReadOnly(use) {
|
||||
- convertedAllUses = false
|
||||
+ // There is a store to the byte slice. This means that none
|
||||
+ // of the pointer uses can't be propagated.
|
||||
+ canConvertPointer = false
|
||||
continue
|
||||
}
|
||||
- use.ReplaceAllUsesWith(strptr)
|
||||
- use.EraseFromParentAsInstruction()
|
||||
+ // It may be that the pointer value can be propagated, if all of
|
||||
+ // the pointer uses are readonly.
|
||||
+ pointerUses = append(pointerUses, use)
|
||||
default:
|
||||
// should not happen
|
||||
panic("unknown return type of runtime.stringToBytes: " + use.Type().String())
|
||||
}
|
||||
}
|
||||
- if convertedAllUses {
|
||||
+ if canConvertPointer {
|
||||
+ // All pointer uses are readonly, so they can be converted.
|
||||
+ for _, use := range pointerUses {
|
||||
+ use.ReplaceAllUsesWith(strptr)
|
||||
+ use.EraseFromParentAsInstruction()
|
||||
+ }
|
||||
+
|
||||
// Call to runtime.stringToBytes can be eliminated: both the input
|
||||
// and the output is constant.
|
||||
call.EraseFromParentAsInstruction()
|
||||
diff --git a/transform/testdata/stringtobytes.ll b/transform/testdata/stringtobytes.ll
|
||||
index fa43f3d0..06373a51 100644
|
||||
--- a/transform/testdata/stringtobytes.ll
|
||||
+++ b/transform/testdata/stringtobytes.ll
|
||||
@@ -30,3 +30,19 @@ entry:
|
||||
call fastcc void @writeToSlice(ptr %1, i64 %2, i64 %3)
|
||||
ret void
|
||||
}
|
||||
+
|
||||
+; Test that pointer values are never propagated if there is even a single write
|
||||
+; to the pointer value (but len/cap values still can be).
|
||||
+define void @testReadSome() {
|
||||
+entry:
|
||||
+ %s = call fastcc { ptr, i64, i64 } @runtime.stringToBytes(ptr @str, i64 6)
|
||||
+ %s.ptr = extractvalue { ptr, i64, i64 } %s, 0
|
||||
+ %s.len = extractvalue { ptr, i64, i64 } %s, 1
|
||||
+ %s.cap = extractvalue { ptr, i64, i64 } %s, 2
|
||||
+ call fastcc void @writeToSlice(ptr %s.ptr, i64 %s.len, i64 %s.cap)
|
||||
+ %s.ptr2 = extractvalue { ptr, i64, i64 } %s, 0
|
||||
+ %s.len2 = extractvalue { ptr, i64, i64 } %s, 1
|
||||
+ %s.cap2 = extractvalue { ptr, i64, i64 } %s, 2
|
||||
+ call fastcc void @printSlice(ptr %s.ptr2, i64 %s.len2, i64 %s.cap2)
|
||||
+ ret void
|
||||
+}
|
||||
diff --git a/transform/testdata/stringtobytes.out.ll b/transform/testdata/stringtobytes.out.ll
|
||||
index 30aa520a..b33a1755 100644
|
||||
--- a/transform/testdata/stringtobytes.out.ll
|
||||
+++ b/transform/testdata/stringtobytes.out.ll
|
||||
@@ -22,3 +22,13 @@ entry:
|
||||
call fastcc void @writeToSlice(ptr %1, i64 6, i64 6)
|
||||
ret void
|
||||
}
|
||||
+
|
||||
+define void @testReadSome() {
|
||||
+entry:
|
||||
+ %s = call fastcc { ptr, i64, i64 } @runtime.stringToBytes(ptr @str, i64 6)
|
||||
+ %s.ptr = extractvalue { ptr, i64, i64 } %s, 0
|
||||
+ call fastcc void @writeToSlice(ptr %s.ptr, i64 6, i64 6)
|
||||
+ %s.ptr2 = extractvalue { ptr, i64, i64 } %s, 0
|
||||
+ call fastcc void @printSlice(ptr %s.ptr2, i64 6, i64 6)
|
||||
+ ret void
|
||||
+}
|
||||
--
|
||||
2.41.0
|
||||
|
||||
44
0005-Skip-x86-tests-on-ARM.patch
Normal file
44
0005-Skip-x86-tests-on-ARM.patch
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
From 9c8cef8d589dfbd2d913010a1211d8a49279c986 Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Sat, 2 Aug 2025 18:30:43 -0400
|
||||
Subject: [PATCH 5/5] Skip x86 tests on ARM
|
||||
|
||||
They are currently broken:
|
||||
https://github.com/tinygo-org/tinygo/issues/4969
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
main_test.go | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/main_test.go b/main_test.go
|
||||
index ca052821..13a40997 100644
|
||||
--- a/main_test.go
|
||||
+++ b/main_test.go
|
||||
@@ -192,7 +192,10 @@ func TestBuild(t *testing.T) {
|
||||
if runtime.GOOS == "linux" {
|
||||
for name, osArch := range supportedLinuxArches {
|
||||
options := optionsFromOSARCH(osArch, sema)
|
||||
- if options.GOARCH != runtime.GOARCH { // Native architecture already run above.
|
||||
+ if options.GOARCH == "386" && runtime.GOARCH == "arm64" {
|
||||
+ // This is currently broken running in qemu.
|
||||
+ // https://github.com/tinygo-org/tinygo/issues/4969
|
||||
+ } else if options.GOARCH != runtime.GOARCH { // Native architecture already run above.
|
||||
t.Run(name, func(t *testing.T) {
|
||||
runPlatTests(options, tests, t)
|
||||
})
|
||||
@@ -895,7 +898,10 @@ func TestTest(t *testing.T) {
|
||||
if runtime.GOOS == "linux" {
|
||||
for name, osArch := range supportedLinuxArches {
|
||||
options := optionsFromOSARCH(osArch, sema)
|
||||
- if options.GOARCH != runtime.GOARCH { // Native architecture already run above.
|
||||
+ if options.GOARCH == "386" && runtime.GOARCH == "arm64" {
|
||||
+ // This is currently broken running in qemu.
|
||||
+ // https://github.com/tinygo-org/tinygo/issues/4969
|
||||
+ } else if options.GOARCH != runtime.GOARCH { // Native architecture already run above.
|
||||
targs = append(targs, targ{name, options})
|
||||
}
|
||||
}
|
||||
--
|
||||
2.50.0
|
||||
|
||||
|
|
@ -1,424 +0,0 @@
|
|||
From 3dcb55f940011bb9bcb75d98182290da60642e4d Mon Sep 17 00:00:00 2001
|
||||
From: Ayke van Laethem <aykevanlaethem@gmail.com>
|
||||
Date: Tue, 19 Sep 2023 22:37:44 +0200
|
||||
Subject: [PATCH 5/7] all: use the new LLVM pass manager
|
||||
|
||||
The old LLVM pass manager is deprecated and should not be used anymore.
|
||||
Moreover, the pass manager builder (which we used to set up a pass
|
||||
pipeline) is actually removed from LLVM entirely in LLVM 17:
|
||||
https://reviews.llvm.org/D145387
|
||||
https://reviews.llvm.org/D145835
|
||||
|
||||
The new pass manager does change the binary size in many cases: both
|
||||
growing and shrinking it. However, on average the binary size remains
|
||||
more or less the same.
|
||||
|
||||
This is needed as a preparation for LLVM 17.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
builder/build.go | 19 +++--
|
||||
builder/sizes_test.go | 6 +-
|
||||
compileopts/config.go | 12 ++--
|
||||
compiler/compiler_test.go | 12 ++--
|
||||
interp/interp_test.go | 9 +--
|
||||
transform/allocs_test.go | 11 +--
|
||||
transform/interface-lowering_test.go | 10 +--
|
||||
transform/maps_test.go | 11 +--
|
||||
transform/optimizer.go | 102 +++++++++------------------
|
||||
transform/transform.go | 2 +-
|
||||
10 files changed, 76 insertions(+), 118 deletions(-)
|
||||
|
||||
diff --git a/builder/build.go b/builder/build.go
|
||||
index dc360b92..d920a598 100644
|
||||
--- a/builder/build.go
|
||||
+++ b/builder/build.go
|
||||
@@ -83,8 +83,7 @@ type packageAction struct {
|
||||
FileHashes map[string]string // hash of every file that's part of the package
|
||||
EmbeddedFiles map[string]string // hash of all the //go:embed files in the package
|
||||
Imports map[string]string // map from imported package to action ID hash
|
||||
- OptLevel int // LLVM optimization level (0-3)
|
||||
- SizeLevel int // LLVM optimization for size level (0-2)
|
||||
+ OptLevel string // LLVM optimization level (O0, O1, O2, Os, Oz)
|
||||
UndefinedGlobals []string // globals that are left as external globals (no initializer)
|
||||
}
|
||||
|
||||
@@ -158,7 +157,7 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
||||
return BuildResult{}, fmt.Errorf("unknown libc: %s", config.Target.Libc)
|
||||
}
|
||||
|
||||
- optLevel, sizeLevel, _ := config.OptLevels()
|
||||
+ optLevel, speedLevel, sizeLevel := config.OptLevel()
|
||||
compilerConfig := &compiler.Config{
|
||||
Triple: config.Triple(),
|
||||
CPU: config.CPU(),
|
||||
@@ -321,7 +320,6 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
||||
EmbeddedFiles: make(map[string]string, len(allFiles)),
|
||||
Imports: make(map[string]string, len(pkg.Pkg.Imports())),
|
||||
OptLevel: optLevel,
|
||||
- SizeLevel: sizeLevel,
|
||||
UndefinedGlobals: undefinedGlobals,
|
||||
}
|
||||
for filePath, hash := range pkg.FileHashes {
|
||||
@@ -743,17 +741,17 @@ func Build(pkgName, outpath, tmpdir string, config *compileopts.Config) (BuildRe
|
||||
if config.GOOS() == "windows" {
|
||||
// Options for the MinGW wrapper for the lld COFF linker.
|
||||
ldflags = append(ldflags,
|
||||
- "-Xlink=/opt:lldlto="+strconv.Itoa(optLevel),
|
||||
+ "-Xlink=/opt:lldlto="+strconv.Itoa(speedLevel),
|
||||
"--thinlto-cache-dir="+filepath.Join(cacheDir, "thinlto"))
|
||||
} else if config.GOOS() == "darwin" {
|
||||
// Options for the ld64-compatible lld linker.
|
||||
ldflags = append(ldflags,
|
||||
- "--lto-O"+strconv.Itoa(optLevel),
|
||||
+ "--lto-O"+strconv.Itoa(speedLevel),
|
||||
"-cache_path_lto", filepath.Join(cacheDir, "thinlto"))
|
||||
} else {
|
||||
// Options for the ELF linker.
|
||||
ldflags = append(ldflags,
|
||||
- "--lto-O"+strconv.Itoa(optLevel),
|
||||
+ "--lto-O"+strconv.Itoa(speedLevel),
|
||||
"--thinlto-cache-dir="+filepath.Join(cacheDir, "thinlto"),
|
||||
)
|
||||
}
|
||||
@@ -1066,10 +1064,9 @@ func optimizeProgram(mod llvm.Module, config *compileopts.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
- // Optimization levels here are roughly the same as Clang, but probably not
|
||||
- // exactly.
|
||||
- optLevel, sizeLevel, inlinerThreshold := config.OptLevels()
|
||||
- errs := transform.Optimize(mod, config, optLevel, sizeLevel, inlinerThreshold)
|
||||
+ // Run most of the whole-program optimizations (including the whole
|
||||
+ // O0/O1/O2/Os/Oz optimization pipeline).
|
||||
+ errs := transform.Optimize(mod, config)
|
||||
if len(errs) > 0 {
|
||||
return newMultiError(errs)
|
||||
}
|
||||
diff --git a/builder/sizes_test.go b/builder/sizes_test.go
|
||||
index 7aaab78a..dc45898e 100644
|
||||
--- a/builder/sizes_test.go
|
||||
+++ b/builder/sizes_test.go
|
||||
@@ -41,9 +41,9 @@ func TestBinarySize(t *testing.T) {
|
||||
// This is a small number of very diverse targets that we want to test.
|
||||
tests := []sizeTest{
|
||||
// microcontrollers
|
||||
- {"hifive1b", "examples/echo", 4568, 280, 0, 2252},
|
||||
- {"microbit", "examples/serial", 2728, 388, 8, 2256},
|
||||
- {"wioterminal", "examples/pininterrupt", 5996, 1484, 116, 6816},
|
||||
+ {"hifive1b", "examples/echo", 4484, 280, 0, 2252},
|
||||
+ {"microbit", "examples/serial", 2724, 388, 8, 2256},
|
||||
+ {"wioterminal", "examples/pininterrupt", 6000, 1484, 116, 6816},
|
||||
|
||||
// TODO: also check wasm. Right now this is difficult, because
|
||||
// wasm binaries are run through wasm-opt and therefore the
|
||||
diff --git a/compileopts/config.go b/compileopts/config.go
|
||||
index 39fc4f2a..5ad45c60 100644
|
||||
--- a/compileopts/config.go
|
||||
+++ b/compileopts/config.go
|
||||
@@ -145,18 +145,18 @@ func (c *Config) Serial() string {
|
||||
|
||||
// OptLevels returns the optimization level (0-2), size level (0-2), and inliner
|
||||
// threshold as used in the LLVM optimization pipeline.
|
||||
-func (c *Config) OptLevels() (optLevel, sizeLevel int, inlinerThreshold uint) {
|
||||
+func (c *Config) OptLevel() (level string, speedLevel, sizeLevel int) {
|
||||
switch c.Options.Opt {
|
||||
case "none", "0":
|
||||
- return 0, 0, 0 // -O0
|
||||
+ return "O0", 0, 0
|
||||
case "1":
|
||||
- return 1, 0, 0 // -O1
|
||||
+ return "O1", 1, 0
|
||||
case "2":
|
||||
- return 2, 0, 225 // -O2
|
||||
+ return "O2", 2, 0
|
||||
case "s":
|
||||
- return 2, 1, 225 // -Os
|
||||
+ return "Os", 2, 1
|
||||
case "z":
|
||||
- return 2, 2, 5 // -Oz, default
|
||||
+ return "Oz", 2, 2 // default
|
||||
default:
|
||||
// This is not shown to the user: valid choices are already checked as
|
||||
// part of Options.Verify(). It is here as a sanity check.
|
||||
diff --git a/compiler/compiler_test.go b/compiler/compiler_test.go
|
||||
index 92ce31b0..147e622a 100644
|
||||
--- a/compiler/compiler_test.go
|
||||
+++ b/compiler/compiler_test.go
|
||||
@@ -91,14 +91,12 @@ func TestCompiler(t *testing.T) {
|
||||
}
|
||||
|
||||
// Optimize IR a little.
|
||||
- funcPasses := llvm.NewFunctionPassManagerForModule(mod)
|
||||
- defer funcPasses.Dispose()
|
||||
- funcPasses.AddInstructionCombiningPass()
|
||||
- funcPasses.InitializeFunc()
|
||||
- for fn := mod.FirstFunction(); !fn.IsNil(); fn = llvm.NextFunction(fn) {
|
||||
- funcPasses.RunFunc(fn)
|
||||
+ passOptions := llvm.NewPassBuilderOptions()
|
||||
+ defer passOptions.Dispose()
|
||||
+ err = mod.RunPasses("instcombine", llvm.TargetMachine{}, passOptions)
|
||||
+ if err != nil {
|
||||
+ t.Error(err)
|
||||
}
|
||||
- funcPasses.FinalizeFunc()
|
||||
|
||||
outFilePrefix := tc.file[:len(tc.file)-3]
|
||||
if tc.target != "" {
|
||||
diff --git a/interp/interp_test.go b/interp/interp_test.go
|
||||
index fc567af2..cac56508 100644
|
||||
--- a/interp/interp_test.go
|
||||
+++ b/interp/interp_test.go
|
||||
@@ -77,12 +77,9 @@ func runTest(t *testing.T, pathPrefix string) {
|
||||
}
|
||||
|
||||
// Run some cleanup passes to get easy-to-read outputs.
|
||||
- pm := llvm.NewPassManager()
|
||||
- defer pm.Dispose()
|
||||
- pm.AddGlobalOptimizerPass()
|
||||
- pm.AddDeadStoreEliminationPass()
|
||||
- pm.AddAggressiveDCEPass()
|
||||
- pm.Run(mod)
|
||||
+ to := llvm.NewPassBuilderOptions()
|
||||
+ defer to.Dispose()
|
||||
+ mod.RunPasses("globalopt,dse,adce", llvm.TargetMachine{}, to)
|
||||
|
||||
// Read the expected output IR.
|
||||
out, err := os.ReadFile(pathPrefix + ".out.ll")
|
||||
diff --git a/transform/allocs_test.go b/transform/allocs_test.go
|
||||
index 27bb9706..59a5b14e 100644
|
||||
--- a/transform/allocs_test.go
|
||||
+++ b/transform/allocs_test.go
|
||||
@@ -38,11 +38,12 @@ func TestAllocs2(t *testing.T) {
|
||||
mod := compileGoFileForTesting(t, "./testdata/allocs2.go")
|
||||
|
||||
// Run functionattrs pass, which is necessary for escape analysis.
|
||||
- pm := llvm.NewPassManager()
|
||||
- defer pm.Dispose()
|
||||
- pm.AddInstructionCombiningPass()
|
||||
- pm.AddFunctionAttrsPass()
|
||||
- pm.Run(mod)
|
||||
+ po := llvm.NewPassBuilderOptions()
|
||||
+ defer po.Dispose()
|
||||
+ err := mod.RunPasses("function(instcombine),function-attrs", llvm.TargetMachine{}, po)
|
||||
+ if err != nil {
|
||||
+ t.Error("failed to run passes:", err)
|
||||
+ }
|
||||
|
||||
// Run heap to stack transform.
|
||||
var testOutputs []allocsTestOutput
|
||||
diff --git a/transform/interface-lowering_test.go b/transform/interface-lowering_test.go
|
||||
index 7bcce605..65f14dd9 100644
|
||||
--- a/transform/interface-lowering_test.go
|
||||
+++ b/transform/interface-lowering_test.go
|
||||
@@ -15,9 +15,11 @@ func TestInterfaceLowering(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
- pm := llvm.NewPassManager()
|
||||
- defer pm.Dispose()
|
||||
- pm.AddGlobalDCEPass()
|
||||
- pm.Run(mod)
|
||||
+ po := llvm.NewPassBuilderOptions()
|
||||
+ defer po.Dispose()
|
||||
+ err = mod.RunPasses("globaldce", llvm.TargetMachine{}, po)
|
||||
+ if err != nil {
|
||||
+ t.Error("failed to run passes:", err)
|
||||
+ }
|
||||
})
|
||||
}
|
||||
diff --git a/transform/maps_test.go b/transform/maps_test.go
|
||||
index e8b11133..329de698 100644
|
||||
--- a/transform/maps_test.go
|
||||
+++ b/transform/maps_test.go
|
||||
@@ -15,10 +15,11 @@ func TestOptimizeMaps(t *testing.T) {
|
||||
|
||||
// Run an optimization pass, to clean up the result.
|
||||
// This shows that all code related to the map is really eliminated.
|
||||
- pm := llvm.NewPassManager()
|
||||
- defer pm.Dispose()
|
||||
- pm.AddDeadStoreEliminationPass()
|
||||
- pm.AddAggressiveDCEPass()
|
||||
- pm.Run(mod)
|
||||
+ po := llvm.NewPassBuilderOptions()
|
||||
+ defer po.Dispose()
|
||||
+ err := mod.RunPasses("dse,adce", llvm.TargetMachine{}, po)
|
||||
+ if err != nil {
|
||||
+ t.Error("failed to run passes:", err)
|
||||
+ }
|
||||
})
|
||||
}
|
||||
diff --git a/transform/optimizer.go b/transform/optimizer.go
|
||||
index 20258ef4..42acc2dd 100644
|
||||
--- a/transform/optimizer.go
|
||||
+++ b/transform/optimizer.go
|
||||
@@ -14,54 +14,22 @@ import (
|
||||
// OptimizePackage runs optimization passes over the LLVM module for the given
|
||||
// Go package.
|
||||
func OptimizePackage(mod llvm.Module, config *compileopts.Config) {
|
||||
- optLevel, sizeLevel, _ := config.OptLevels()
|
||||
-
|
||||
- // Run function passes for each function in the module.
|
||||
- // These passes are intended to be run on each function right
|
||||
- // after they're created to reduce IR size (and maybe also for
|
||||
- // cache locality to improve performance), but for now they're
|
||||
- // run here for each function in turn. Maybe this can be
|
||||
- // improved in the future.
|
||||
- builder := llvm.NewPassManagerBuilder()
|
||||
- defer builder.Dispose()
|
||||
- builder.SetOptLevel(optLevel)
|
||||
- builder.SetSizeLevel(sizeLevel)
|
||||
- funcPasses := llvm.NewFunctionPassManagerForModule(mod)
|
||||
- defer funcPasses.Dispose()
|
||||
- builder.PopulateFunc(funcPasses)
|
||||
- funcPasses.InitializeFunc()
|
||||
- for fn := mod.FirstFunction(); !fn.IsNil(); fn = llvm.NextFunction(fn) {
|
||||
- if fn.IsDeclaration() {
|
||||
- continue
|
||||
- }
|
||||
- funcPasses.RunFunc(fn)
|
||||
- }
|
||||
- funcPasses.FinalizeFunc()
|
||||
+ _, speedLevel, _ := config.OptLevel()
|
||||
|
||||
// Run TinyGo-specific optimization passes.
|
||||
- if optLevel > 0 {
|
||||
+ if speedLevel > 0 {
|
||||
OptimizeMaps(mod)
|
||||
}
|
||||
}
|
||||
|
||||
// Optimize runs a number of optimization and transformation passes over the
|
||||
// given module. Some passes are specific to TinyGo, others are generic LLVM
|
||||
-// passes. You can set a preferred performance (0-3) and size (0-2) level and
|
||||
-// control the limits of the inliner (higher numbers mean more inlining, set it
|
||||
-// to 0 to disable entirely).
|
||||
+// passes.
|
||||
//
|
||||
// Please note that some optimizations are not optional, thus Optimize must
|
||||
-// alwasy be run before emitting machine code. Set all controls (optLevel,
|
||||
-// sizeLevel, inlinerThreshold) to 0 to reduce the number of optimizations to a
|
||||
-// minimum.
|
||||
-func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel int, inlinerThreshold uint) []error {
|
||||
- builder := llvm.NewPassManagerBuilder()
|
||||
- defer builder.Dispose()
|
||||
- builder.SetOptLevel(optLevel)
|
||||
- builder.SetSizeLevel(sizeLevel)
|
||||
- if inlinerThreshold != 0 {
|
||||
- builder.UseInlinerWithThreshold(inlinerThreshold)
|
||||
- }
|
||||
+// alwasy be run before emitting machine code.
|
||||
+func Optimize(mod llvm.Module, config *compileopts.Config) []error {
|
||||
+ optLevel, speedLevel, _ := config.OptLevel()
|
||||
|
||||
// Make sure these functions are kept in tact during TinyGo transformation passes.
|
||||
for _, name := range functionsUsedInTransforms {
|
||||
@@ -84,23 +52,20 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
}
|
||||
}
|
||||
|
||||
- if optLevel > 0 {
|
||||
+ if speedLevel > 0 {
|
||||
// Run some preparatory passes for the Go optimizer.
|
||||
- goPasses := llvm.NewPassManager()
|
||||
- defer goPasses.Dispose()
|
||||
- goPasses.AddGlobalDCEPass()
|
||||
- goPasses.AddGlobalOptimizerPass()
|
||||
- goPasses.AddIPSCCPPass()
|
||||
- goPasses.AddInstructionCombiningPass() // necessary for OptimizeReflectImplements
|
||||
- goPasses.AddAggressiveDCEPass()
|
||||
- goPasses.AddFunctionAttrsPass()
|
||||
- goPasses.Run(mod)
|
||||
+ po := llvm.NewPassBuilderOptions()
|
||||
+ defer po.Dispose()
|
||||
+ err := mod.RunPasses("globaldce,globalopt,ipsccp,instcombine,adce,function-attrs", llvm.TargetMachine{}, po)
|
||||
+ if err != nil {
|
||||
+ return []error{fmt.Errorf("could not build pass pipeline: %w", err)}
|
||||
+ }
|
||||
|
||||
// Run TinyGo-specific optimization passes.
|
||||
OptimizeStringToBytes(mod)
|
||||
OptimizeReflectImplements(mod)
|
||||
OptimizeAllocs(mod, nil, nil)
|
||||
- err := LowerInterfaces(mod, config)
|
||||
+ err = LowerInterfaces(mod, config)
|
||||
if err != nil {
|
||||
return []error{err}
|
||||
}
|
||||
@@ -113,7 +78,10 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
// After interfaces are lowered, there are many more opportunities for
|
||||
// interprocedural optimizations. To get them to work, function
|
||||
// attributes have to be updated first.
|
||||
- goPasses.Run(mod)
|
||||
+ err = mod.RunPasses("globaldce,globalopt,ipsccp,instcombine,adce,function-attrs", llvm.TargetMachine{}, po)
|
||||
+ if err != nil {
|
||||
+ return []error{fmt.Errorf("could not build pass pipeline: %w", err)}
|
||||
+ }
|
||||
|
||||
// Run TinyGo-specific interprocedural optimizations.
|
||||
OptimizeAllocs(mod, config.Options.PrintAllocs, func(pos token.Position, msg string) {
|
||||
@@ -134,10 +102,12 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
}
|
||||
|
||||
// Clean up some leftover symbols of the previous transformations.
|
||||
- goPasses := llvm.NewPassManager()
|
||||
- defer goPasses.Dispose()
|
||||
- goPasses.AddGlobalDCEPass()
|
||||
- goPasses.Run(mod)
|
||||
+ po := llvm.NewPassBuilderOptions()
|
||||
+ defer po.Dispose()
|
||||
+ err = mod.RunPasses("globaldce", llvm.TargetMachine{}, po)
|
||||
+ if err != nil {
|
||||
+ return []error{fmt.Errorf("could not build pass pipeline: %w", err)}
|
||||
+ }
|
||||
}
|
||||
|
||||
if config.Scheduler() == "none" {
|
||||
@@ -169,23 +139,15 @@ func Optimize(mod llvm.Module, config *compileopts.Config, optLevel, sizeLevel i
|
||||
fn.SetLinkage(llvm.InternalLinkage)
|
||||
}
|
||||
|
||||
- // Run function passes again, because without it, llvm.coro.size.i32()
|
||||
- // doesn't get lowered.
|
||||
- funcPasses := llvm.NewFunctionPassManagerForModule(mod)
|
||||
- defer funcPasses.Dispose()
|
||||
- builder.PopulateFunc(funcPasses)
|
||||
- funcPasses.InitializeFunc()
|
||||
- for fn := mod.FirstFunction(); !fn.IsNil(); fn = llvm.NextFunction(fn) {
|
||||
- funcPasses.RunFunc(fn)
|
||||
+ // Run the default pass pipeline.
|
||||
+ // TODO: set the PrepareForThinLTO flag somehow.
|
||||
+ po := llvm.NewPassBuilderOptions()
|
||||
+ defer po.Dispose()
|
||||
+ passes := fmt.Sprintf("default<%s>", optLevel)
|
||||
+ err := mod.RunPasses(passes, llvm.TargetMachine{}, po)
|
||||
+ if err != nil {
|
||||
+ return []error{fmt.Errorf("could not build pass pipeline: %w", err)}
|
||||
}
|
||||
- funcPasses.FinalizeFunc()
|
||||
-
|
||||
- // Run module passes.
|
||||
- // TODO: somehow set the PrepareForThinLTO flag in the pass manager builder.
|
||||
- modPasses := llvm.NewPassManager()
|
||||
- defer modPasses.Dispose()
|
||||
- builder.Populate(modPasses)
|
||||
- modPasses.Run(mod)
|
||||
|
||||
hasGCPass := MakeGCStackSlots(mod)
|
||||
if hasGCPass {
|
||||
diff --git a/transform/transform.go b/transform/transform.go
|
||||
index ab08317e..429cbd5f 100644
|
||||
--- a/transform/transform.go
|
||||
+++ b/transform/transform.go
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
// the -opt= compiler flag.
|
||||
func AddStandardAttributes(fn llvm.Value, config *compileopts.Config) {
|
||||
ctx := fn.Type().Context()
|
||||
- _, sizeLevel, _ := config.OptLevels()
|
||||
+ _, _, sizeLevel := config.OptLevel()
|
||||
if sizeLevel >= 1 {
|
||||
fn.AddFunctionAttr(ctx.CreateEnumAttribute(llvm.AttributeKindID("optsize"), 0))
|
||||
}
|
||||
--
|
||||
2.41.0
|
||||
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
From 0321eecc6d29d5b571930ed97f392623fe80a2e5 Mon Sep 17 00:00:00 2001
|
||||
From: Ayke van Laethem <aykevanlaethem@gmail.com>
|
||||
Date: Sat, 23 Sep 2023 14:57:25 +0200
|
||||
Subject: [PATCH 6/7] avr: don't compile large parts of picolibc (math, stdio)
|
||||
|
||||
These parts aren't critical and lead to crashes on small chips without
|
||||
long jumps (like the attiny85) with LLVM 17. (Older LLVM versions would
|
||||
emit long jumps regardless, even if the chip didn't support those).
|
||||
|
||||
For more information, see: https://github.com/llvm/llvm-project/issues/67042
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
builder/picolibc.go | 172 ++++++++++++++++++++++++--------------------
|
||||
1 file changed, 93 insertions(+), 79 deletions(-)
|
||||
|
||||
diff --git a/builder/picolibc.go b/builder/picolibc.go
|
||||
index 1b7c748b..91ad27be 100644
|
||||
--- a/builder/picolibc.go
|
||||
+++ b/builder/picolibc.go
|
||||
@@ -3,6 +3,7 @@ package builder
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
+ "strings"
|
||||
|
||||
"github.com/tinygo-org/tinygo/goenv"
|
||||
)
|
||||
@@ -41,91 +42,23 @@ var Picolibc = Library{
|
||||
},
|
||||
sourceDir: func() string { return filepath.Join(goenv.Get("TINYGOROOT"), "lib/picolibc/newlib") },
|
||||
librarySources: func(target string) ([]string, error) {
|
||||
- return picolibcSources, nil
|
||||
+ sources := append([]string(nil), picolibcSources...)
|
||||
+ if !strings.HasPrefix(target, "avr") {
|
||||
+ // Small chips without long jumps can't compile many files (printf,
|
||||
+ // pow, etc). Therefore exclude those source files for those chips.
|
||||
+ // Unfortunately it's difficult to exclude only some chips, so this
|
||||
+ // excludes those files on all AVR chips for now.
|
||||
+ // More information:
|
||||
+ // https://github.com/llvm/llvm-project/issues/67042
|
||||
+ sources = append(sources, picolibcSourcesLarge...)
|
||||
+ }
|
||||
+ return sources, nil
|
||||
},
|
||||
}
|
||||
|
||||
var picolibcSources = []string{
|
||||
"../../picolibc-stdio.c",
|
||||
|
||||
- // srcs_tinystdio
|
||||
- "libc/tinystdio/asprintf.c",
|
||||
- "libc/tinystdio/bufio.c",
|
||||
- "libc/tinystdio/clearerr.c",
|
||||
- "libc/tinystdio/ecvt_r.c",
|
||||
- "libc/tinystdio/ecvt.c",
|
||||
- "libc/tinystdio/ecvtf_r.c",
|
||||
- "libc/tinystdio/ecvtf.c",
|
||||
- "libc/tinystdio/fcvt.c",
|
||||
- "libc/tinystdio/fcvt_r.c",
|
||||
- "libc/tinystdio/fcvtf.c",
|
||||
- "libc/tinystdio/fcvtf_r.c",
|
||||
- "libc/tinystdio/gcvt.c",
|
||||
- "libc/tinystdio/gcvtf.c",
|
||||
- "libc/tinystdio/fclose.c",
|
||||
- "libc/tinystdio/fdevopen.c",
|
||||
- "libc/tinystdio/feof.c",
|
||||
- "libc/tinystdio/ferror.c",
|
||||
- "libc/tinystdio/fflush.c",
|
||||
- "libc/tinystdio/fgetc.c",
|
||||
- "libc/tinystdio/fgets.c",
|
||||
- "libc/tinystdio/fileno.c",
|
||||
- "libc/tinystdio/filestrget.c",
|
||||
- "libc/tinystdio/filestrput.c",
|
||||
- "libc/tinystdio/filestrputalloc.c",
|
||||
- "libc/tinystdio/fmemopen.c",
|
||||
- "libc/tinystdio/fprintf.c",
|
||||
- "libc/tinystdio/fputc.c",
|
||||
- "libc/tinystdio/fputs.c",
|
||||
- "libc/tinystdio/fread.c",
|
||||
- //"libc/tinystdio/freopen.c", // crashes with AVR, see: https://github.com/picolibc/picolibc/pull/369
|
||||
- "libc/tinystdio/fscanf.c",
|
||||
- "libc/tinystdio/fseek.c",
|
||||
- "libc/tinystdio/fseeko.c",
|
||||
- "libc/tinystdio/ftell.c",
|
||||
- "libc/tinystdio/ftello.c",
|
||||
- "libc/tinystdio/fwrite.c",
|
||||
- "libc/tinystdio/getchar.c",
|
||||
- "libc/tinystdio/gets.c",
|
||||
- "libc/tinystdio/matchcaseprefix.c",
|
||||
- "libc/tinystdio/mktemp.c",
|
||||
- "libc/tinystdio/perror.c",
|
||||
- "libc/tinystdio/printf.c",
|
||||
- "libc/tinystdio/putchar.c",
|
||||
- "libc/tinystdio/puts.c",
|
||||
- "libc/tinystdio/rewind.c",
|
||||
- "libc/tinystdio/scanf.c",
|
||||
- "libc/tinystdio/setbuf.c",
|
||||
- "libc/tinystdio/setbuffer.c",
|
||||
- "libc/tinystdio/setlinebuf.c",
|
||||
- "libc/tinystdio/setvbuf.c",
|
||||
- "libc/tinystdio/snprintf.c",
|
||||
- "libc/tinystdio/sprintf.c",
|
||||
- "libc/tinystdio/snprintfd.c",
|
||||
- "libc/tinystdio/snprintff.c",
|
||||
- "libc/tinystdio/sprintff.c",
|
||||
- "libc/tinystdio/sprintfd.c",
|
||||
- "libc/tinystdio/sscanf.c",
|
||||
- "libc/tinystdio/strfromf.c",
|
||||
- "libc/tinystdio/strfromd.c",
|
||||
- "libc/tinystdio/strtof.c",
|
||||
- "libc/tinystdio/strtof_l.c",
|
||||
- "libc/tinystdio/strtod.c",
|
||||
- "libc/tinystdio/strtod_l.c",
|
||||
- "libc/tinystdio/ungetc.c",
|
||||
- "libc/tinystdio/vasprintf.c",
|
||||
- "libc/tinystdio/vfiprintf.c",
|
||||
- "libc/tinystdio/vfprintf.c",
|
||||
- "libc/tinystdio/vfprintff.c",
|
||||
- "libc/tinystdio/vfscanf.c",
|
||||
- "libc/tinystdio/vfiscanf.c",
|
||||
- "libc/tinystdio/vfscanff.c",
|
||||
- "libc/tinystdio/vprintf.c",
|
||||
- "libc/tinystdio/vscanf.c",
|
||||
- "libc/tinystdio/vsscanf.c",
|
||||
- "libc/tinystdio/vsnprintf.c",
|
||||
- "libc/tinystdio/vsprintf.c",
|
||||
-
|
||||
"libc/string/bcmp.c",
|
||||
"libc/string/bcopy.c",
|
||||
"libc/string/bzero.c",
|
||||
@@ -229,6 +162,87 @@ var picolibcSources = []string{
|
||||
"libc/string/wmempcpy.c",
|
||||
"libc/string/wmemset.c",
|
||||
"libc/string/xpg_strerror_r.c",
|
||||
+}
|
||||
+
|
||||
+// Parts of picolibc that are too large for small AVRs.
|
||||
+var picolibcSourcesLarge = []string{
|
||||
+ // srcs_tinystdio
|
||||
+ "libc/tinystdio/asprintf.c",
|
||||
+ "libc/tinystdio/bufio.c",
|
||||
+ "libc/tinystdio/clearerr.c",
|
||||
+ "libc/tinystdio/ecvt_r.c",
|
||||
+ "libc/tinystdio/ecvt.c",
|
||||
+ "libc/tinystdio/ecvtf_r.c",
|
||||
+ "libc/tinystdio/ecvtf.c",
|
||||
+ "libc/tinystdio/fcvt.c",
|
||||
+ "libc/tinystdio/fcvt_r.c",
|
||||
+ "libc/tinystdio/fcvtf.c",
|
||||
+ "libc/tinystdio/fcvtf_r.c",
|
||||
+ "libc/tinystdio/gcvt.c",
|
||||
+ "libc/tinystdio/gcvtf.c",
|
||||
+ "libc/tinystdio/fclose.c",
|
||||
+ "libc/tinystdio/fdevopen.c",
|
||||
+ "libc/tinystdio/feof.c",
|
||||
+ "libc/tinystdio/ferror.c",
|
||||
+ "libc/tinystdio/fflush.c",
|
||||
+ "libc/tinystdio/fgetc.c",
|
||||
+ "libc/tinystdio/fgets.c",
|
||||
+ "libc/tinystdio/fileno.c",
|
||||
+ "libc/tinystdio/filestrget.c",
|
||||
+ "libc/tinystdio/filestrput.c",
|
||||
+ "libc/tinystdio/filestrputalloc.c",
|
||||
+ "libc/tinystdio/fmemopen.c",
|
||||
+ "libc/tinystdio/fprintf.c",
|
||||
+ "libc/tinystdio/fputc.c",
|
||||
+ "libc/tinystdio/fputs.c",
|
||||
+ "libc/tinystdio/fread.c",
|
||||
+ //"libc/tinystdio/freopen.c", // crashes with AVR, see: https://github.com/picolibc/picolibc/pull/369
|
||||
+ "libc/tinystdio/fscanf.c",
|
||||
+ "libc/tinystdio/fseek.c",
|
||||
+ "libc/tinystdio/fseeko.c",
|
||||
+ "libc/tinystdio/ftell.c",
|
||||
+ "libc/tinystdio/ftello.c",
|
||||
+ "libc/tinystdio/fwrite.c",
|
||||
+ "libc/tinystdio/getchar.c",
|
||||
+ "libc/tinystdio/gets.c",
|
||||
+ "libc/tinystdio/matchcaseprefix.c",
|
||||
+ "libc/tinystdio/mktemp.c",
|
||||
+ "libc/tinystdio/perror.c",
|
||||
+ "libc/tinystdio/printf.c",
|
||||
+ "libc/tinystdio/putchar.c",
|
||||
+ "libc/tinystdio/puts.c",
|
||||
+ "libc/tinystdio/rewind.c",
|
||||
+ "libc/tinystdio/scanf.c",
|
||||
+ "libc/tinystdio/setbuf.c",
|
||||
+ "libc/tinystdio/setbuffer.c",
|
||||
+ "libc/tinystdio/setlinebuf.c",
|
||||
+ "libc/tinystdio/setvbuf.c",
|
||||
+ "libc/tinystdio/snprintf.c",
|
||||
+ "libc/tinystdio/sprintf.c",
|
||||
+ "libc/tinystdio/snprintfd.c",
|
||||
+ "libc/tinystdio/snprintff.c",
|
||||
+ "libc/tinystdio/sprintff.c",
|
||||
+ "libc/tinystdio/sprintfd.c",
|
||||
+ "libc/tinystdio/sscanf.c",
|
||||
+ "libc/tinystdio/strfromf.c",
|
||||
+ "libc/tinystdio/strfromd.c",
|
||||
+ "libc/tinystdio/strtof.c",
|
||||
+ "libc/tinystdio/strtof_l.c",
|
||||
+ "libc/tinystdio/strtod.c",
|
||||
+ "libc/tinystdio/strtod_l.c",
|
||||
+ "libc/tinystdio/ungetc.c",
|
||||
+ "libc/tinystdio/vasprintf.c",
|
||||
+ "libc/tinystdio/vfiprintf.c",
|
||||
+ "libc/tinystdio/vfprintf.c",
|
||||
+ "libc/tinystdio/vfprintff.c",
|
||||
+ "libc/tinystdio/vfscanf.c",
|
||||
+ "libc/tinystdio/vfiscanf.c",
|
||||
+ "libc/tinystdio/vfscanff.c",
|
||||
+ "libc/tinystdio/vprintf.c",
|
||||
+ "libc/tinystdio/vscanf.c",
|
||||
+ "libc/tinystdio/vsscanf.c",
|
||||
+ "libc/tinystdio/vsnprintf.c",
|
||||
+ "libc/tinystdio/vsprintf.c",
|
||||
|
||||
"libm/common/sf_finite.c",
|
||||
"libm/common/sf_copysign.c",
|
||||
--
|
||||
2.41.0
|
||||
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
From 55fd04af5a6a815224b436ee491ed05b0ef4ee7c Mon Sep 17 00:00:00 2001
|
||||
From: Ayke van Laethem <aykevanlaethem@gmail.com>
|
||||
Date: Sat, 23 Sep 2023 15:03:24 +0200
|
||||
Subject: [PATCH 7/7] all: add initial LLVM 17 support
|
||||
|
||||
This allows us to test LLVM 17 already, before it's available in
|
||||
Homebrew etc.
|
||||
|
||||
Full support for LLVM 17 will have to wait until Espressif rebases their
|
||||
Xtensa fork of LLVM.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
.circleci/config.yml | 13 +++++++++++--
|
||||
.github/workflows/build-macos.yml | 16 +++++++++++++---
|
||||
cgo/libclang_config_llvm16.go | 2 +-
|
||||
cgo/libclang_config_llvm17.go | 15 +++++++++++++++
|
||||
go.mod | 2 +-
|
||||
go.sum | 4 ++--
|
||||
6 files changed, 43 insertions(+), 9 deletions(-)
|
||||
create mode 100644 cgo/libclang_config_llvm17.go
|
||||
|
||||
diff --git a/.circleci/config.yml b/.circleci/config.yml
|
||||
index 1dff3ba7..86da321d 100644
|
||||
--- a/.circleci/config.yml
|
||||
+++ b/.circleci/config.yml
|
||||
@@ -55,7 +55,7 @@ commands:
|
||||
- run:
|
||||
name: "Install apt dependencies"
|
||||
command: |
|
||||
- echo 'deb https://apt.llvm.org/buster/ llvm-toolchain-buster-<<parameters.llvm>> main' > /etc/apt/sources.list.d/llvm.list
|
||||
+ echo 'deb https://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-<<parameters.llvm>> main' > /etc/apt/sources.list.d/llvm.list
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
|
||||
apt-get update
|
||||
apt-get install --no-install-recommends -y \
|
||||
@@ -100,11 +100,18 @@ commands:
|
||||
jobs:
|
||||
test-llvm14-go118:
|
||||
docker:
|
||||
- - image: golang:1.18-buster
|
||||
+ - image: golang:1.18-bullseye
|
||||
steps:
|
||||
- test-linux:
|
||||
llvm: "14"
|
||||
resource_class: large
|
||||
+ test-llvm17-go121:
|
||||
+ docker:
|
||||
+ - image: golang:1.21-bullseye
|
||||
+ steps:
|
||||
+ - test-linux:
|
||||
+ llvm: "17"
|
||||
+ resource_class: large
|
||||
|
||||
workflows:
|
||||
test-all:
|
||||
@@ -112,3 +119,5 @@ workflows:
|
||||
# This tests our lowest supported versions of Go and LLVM, to make sure at
|
||||
# least the smoke tests still pass.
|
||||
- test-llvm14-go118
|
||||
+ # This tests the upcoming LLVM 17 support.
|
||||
+ - test-llvm17-go121
|
||||
diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml
|
||||
index 1284a4ed..be8bdb03 100644
|
||||
--- a/.github/workflows/build-macos.yml
|
||||
+++ b/.github/workflows/build-macos.yml
|
||||
@@ -116,11 +116,15 @@ jobs:
|
||||
test-macos-homebrew:
|
||||
name: homebrew-install
|
||||
runs-on: macos-latest
|
||||
+ strategy:
|
||||
+ matrix:
|
||||
+ version: [16, 17]
|
||||
steps:
|
||||
+ - name: Update Homebrew
|
||||
+ run: brew update
|
||||
- name: Install LLVM
|
||||
- shell: bash
|
||||
run: |
|
||||
- HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@16
|
||||
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install llvm@${{ matrix.version }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Go
|
||||
@@ -128,7 +132,13 @@ jobs:
|
||||
with:
|
||||
go-version: '1.21'
|
||||
cache: true
|
||||
- - name: Build TinyGo
|
||||
+ - name: Build TinyGo (LLVM ${{ matrix.version }})
|
||||
+ run: go install -tags=llvm${{ matrix.version }}
|
||||
+ - name: Check binary
|
||||
+ run: tinygo version
|
||||
+ - name: Build TinyGo (default LLVM)
|
||||
+ if: matrix.version == 16
|
||||
run: go install
|
||||
- name: Check binary
|
||||
+ if: matrix.version == 16
|
||||
run: tinygo version
|
||||
diff --git a/cgo/libclang_config_llvm16.go b/cgo/libclang_config_llvm16.go
|
||||
index 79aacd2f..28091701 100644
|
||||
--- a/cgo/libclang_config_llvm16.go
|
||||
+++ b/cgo/libclang_config_llvm16.go
|
||||
@@ -1,4 +1,4 @@
|
||||
-//go:build !byollvm && !llvm14 && !llvm15
|
||||
+//go:build !byollvm && !llvm14 && !llvm15 && !llvm17
|
||||
|
||||
package cgo
|
||||
|
||||
diff --git a/cgo/libclang_config_llvm17.go b/cgo/libclang_config_llvm17.go
|
||||
new file mode 100644
|
||||
index 00000000..fd6d1480
|
||||
--- /dev/null
|
||||
+++ b/cgo/libclang_config_llvm17.go
|
||||
@@ -0,0 +1,15 @@
|
||||
+//go:build !byollvm && llvm17
|
||||
+
|
||||
+package cgo
|
||||
+
|
||||
+/*
|
||||
+#cgo linux CFLAGS: -I/usr/include/llvm-17 -I/usr/include/llvm-c-17 -I/usr/lib/llvm-17/include
|
||||
+#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@17/include
|
||||
+#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@17/include
|
||||
+#cgo freebsd CFLAGS: -I/usr/local/llvm17/include
|
||||
+#cgo linux LDFLAGS: -L/usr/lib/llvm-17/lib -lclang
|
||||
+#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@17/lib -lclang -lffi
|
||||
+#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@17/lib -lclang -lffi
|
||||
+#cgo freebsd LDFLAGS: -L/usr/local/llvm17/lib -lclang
|
||||
+*/
|
||||
+import "C"
|
||||
diff --git a/go.mod b/go.mod
|
||||
index 9af3402b..36d601f8 100644
|
||||
--- a/go.mod
|
||||
+++ b/go.mod
|
||||
@@ -18,7 +18,7 @@ require (
|
||||
golang.org/x/sys v0.11.0
|
||||
golang.org/x/tools v0.12.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
- tinygo.org/x/go-llvm v0.0.0-20230918183930-9edb6403d0bc
|
||||
+ tinygo.org/x/go-llvm v0.0.0-20230923132128-bba3c7009bfd
|
||||
)
|
||||
|
||||
require (
|
||||
diff --git a/go.sum b/go.sum
|
||||
index 587efdf2..1b5ad074 100644
|
||||
--- a/go.sum
|
||||
+++ b/go.sum
|
||||
@@ -65,5 +65,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
-tinygo.org/x/go-llvm v0.0.0-20230918183930-9edb6403d0bc h1:IVX1dqCX3c88P7iEMBtz1xCAM4UIqCMgbqHdSefBaWE=
|
||||
-tinygo.org/x/go-llvm v0.0.0-20230918183930-9edb6403d0bc/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=
|
||||
+tinygo.org/x/go-llvm v0.0.0-20230923132128-bba3c7009bfd h1:iSVvs8r3ooxYTsmcf7FKCHq83eOSUkWKtmQhnDadDQU=
|
||||
+tinygo.org/x/go-llvm v0.0.0-20230923132128-bba3c7009bfd/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=
|
||||
--
|
||||
2.41.0
|
||||
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
CMSIS_VERSION=9fe411cef1cef5de58e5957b89760759de44e393
|
||||
CMSIS_SVD_VERSION=df75ff974c76a911fc2815e29807f5ecaae06fc2
|
||||
CMSIS_SVD_DATA_VERSION=05a9562ec59b87945a8d7177a4b08b7aa2f2fd58
|
||||
|
||||
if [ -e "cmsis-${CMSIS_VERSION}-clean.tar.xz" ]; then
|
||||
echo "Not downloading cmsis-${CMSIS_VERSION}-clean.tar.xz again!"
|
||||
else
|
||||
# The license for this tarball is complicated, but the headers are under a
|
||||
# simple BSD license, so we only package them.
|
||||
# The license for this tarball is complicated, but the headers are under the
|
||||
# BSD-3-Clause license, so we only package them.
|
||||
wget -nc https://github.com/ARM-software/CMSIS/archive/${CMSIS_VERSION}/cmsis-${CMSIS_VERSION}.tar.gz
|
||||
tar xf cmsis-${CMSIS_VERSION}.tar.gz
|
||||
tar cJf cmsis-${CMSIS_VERSION}-clean.tar.xz \
|
||||
|
|
@ -16,24 +16,52 @@ tar cJf cmsis-${CMSIS_VERSION}-clean.tar.xz \
|
|||
rm -r CMSIS-${CMSIS_VERSION}/
|
||||
fi
|
||||
|
||||
if [ -e "cmsis_svd-${CMSIS_SVD_VERSION}-clean.tar.xz" ]; then
|
||||
echo "Not downloading cmsis_svd-${CMSIS_SVD_VERSION}-clean.tar.xz again!"
|
||||
if [ -e "cmsis_svd_data-${CMSIS_SVD_DATA_VERSION}-clean.tar.xz" ]; then
|
||||
echo "Not downloading cmsis_svd_data-${CMSIS_SVD_DATA_VERSION}-clean.tar.xz again!"
|
||||
else
|
||||
# This is basically a "collection of random stuff" from various vendors, under
|
||||
# various licenses. Some licenses are non-free and some are actively hostile,
|
||||
# but we only need a rather small portion under a good license.
|
||||
#wget https://github.com/posborne/cmsis-svd/archive/${CMSIS_SVD_VERSION}/cmsis_svd-${CMSIS_SVD_VERSION}.tar.gz
|
||||
wget -nc https://github.com/tinygo-org/cmsis-svd/archive/${CMSIS_SVD_VERSION}/cmsis_svd-${CMSIS_SVD_VERSION}.tar.gz
|
||||
tar xf cmsis_svd-${CMSIS_SVD_VERSION}.tar.gz
|
||||
tar cJf cmsis_svd-${CMSIS_SVD_VERSION}-clean.tar.xz \
|
||||
cmsis-svd-${CMSIS_SVD_VERSION}/data/Atmel/ \
|
||||
cmsis-svd-${CMSIS_SVD_VERSION}/data/Espressif/ \
|
||||
cmsis-svd-${CMSIS_SVD_VERSION}/data/Espressif-Community/ \
|
||||
cmsis-svd-${CMSIS_SVD_VERSION}/data/Kendryte-Community/ \
|
||||
cmsis-svd-${CMSIS_SVD_VERSION}/data/SiFive-Community/ \
|
||||
cmsis-svd-${CMSIS_SVD_VERSION}/data/NXP/M* \
|
||||
cmsis-svd-${CMSIS_SVD_VERSION}/data/RaspberryPi/ \
|
||||
# This has a weird license, so we cannot include it.
|
||||
# cmsis-svd-${CMSIS_SVD_VERSION}/data/STMicro/
|
||||
rm -r cmsis-svd-${CMSIS_SVD_VERSION}/
|
||||
# but we only need a rather small portion under a good license:
|
||||
# - Atmel: Apache-2.0 AND BSD-Source-Code
|
||||
# - Espressif: Apache-2.0
|
||||
# - Espressif-Community: Apache-2.0 OR MIT
|
||||
# - Kendryte-Community: ISC
|
||||
# - Nordic: BSD-3-Clause
|
||||
# - NXP/L*: Proprietary, so not included.
|
||||
# - NXP/Q*: Unknown, so not included.
|
||||
# - NXP/M*: BSD-3-Clause
|
||||
# - RaspberryPi: BSD-3-Clause
|
||||
# - Renesas: Proprietary
|
||||
# - SiFive-Community: ISC AND (Apache-2.0 OR MIT)
|
||||
# - STMicro: Apache-2.0 AND Proprietary, so only a subset included.
|
||||
# These directories are not used by TinyGo, so are not kept:
|
||||
# - ARM_SAMPLE: BSD-3-Clause
|
||||
# - Allwinner-Community: Apache-2.0 OR MIT
|
||||
# - ArteryTek: BSD-3-Clause
|
||||
# - Cypress: Apache-2.0
|
||||
# - Freescale: Proprietary
|
||||
# - Fujitsu: Proprietary
|
||||
# - GigaDevice: Apache-2.0
|
||||
# - Holtek: Proprietary
|
||||
# - Infineon: Proprietary
|
||||
# - Nuvoton: Unknown
|
||||
# - SiliconLabs: Zlib
|
||||
# - Spansion: Proprietary
|
||||
# - TexasInstruments: Proprietary
|
||||
# - Toshiba: Unknown
|
||||
wget -nc https://github.com/cmsis-svd/cmsis-svd-data/archive/${CMSIS_SVD_DATA_VERSION}/cmsis_svd_data-${CMSIS_SVD_DATA_VERSION}.tar.gz
|
||||
tar xf cmsis_svd_data-${CMSIS_SVD_DATA_VERSION}.tar.gz
|
||||
mapfile -t clean_stmicro < <(grep -Rl '^ *SPDX-License-Identifier: Apache-2.0$' \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/STMicro/*.svd)
|
||||
tar cJf cmsis_svd_data-${CMSIS_SVD_DATA_VERSION}-clean.tar.xz \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/Atmel/ \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/Espressif/ \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/Espressif-Community/ \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/Kendryte-Community/ \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/Nordic/ \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/NXP/M* \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/RaspberryPi/ \
|
||||
cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/data/SiFive-Community/ \
|
||||
"${clean_stmicro[@]}"
|
||||
rm -r cmsis-svd-data-${CMSIS_SVD_DATA_VERSION}/
|
||||
fi
|
||||
|
|
|
|||
38
musl-cve-2025-26519-1.patch
Normal file
38
musl-cve-2025-26519-1.patch
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
>From e5adcd97b5196e29991b524237381a0202a60659 Mon Sep 17 00:00:00 2001
|
||||
From: Rich Felker <dalias@aerifal.cx>
|
||||
Date: Sun, 9 Feb 2025 10:07:19 -0500
|
||||
Subject: [PATCH] iconv: fix erroneous input validation in EUC-KR decoder
|
||||
|
||||
as a result of incorrect bounds checking on the lead byte being
|
||||
decoded, certain invalid inputs which should produce an encoding
|
||||
error, such as "\xc8\x41", instead produced out-of-bounds loads from
|
||||
the ksc table.
|
||||
|
||||
in a worst case, the loaded value may not be a valid unicode scalar
|
||||
value, in which case, if the output encoding was UTF-8, wctomb would
|
||||
return (size_t)-1, causing an overflow in the output pointer and
|
||||
remaining buffer size which could clobber memory outside of the output
|
||||
buffer.
|
||||
|
||||
bug report was submitted in private by Nick Wellnhofer on account of
|
||||
potential security implications.
|
||||
---
|
||||
src/locale/iconv.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
|
||||
index 9605c8e9..008c93f0 100644
|
||||
--- a/src/locale/iconv.c
|
||||
+++ b/src/locale/iconv.c
|
||||
@@ -502,7 +502,7 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
|
||||
if (c >= 93 || d >= 94) {
|
||||
c += (0xa1-0x81);
|
||||
d += 0xa1;
|
||||
- if (c >= 93 || c>=0xc6-0x81 && d>0x52)
|
||||
+ if (c > 0xc6-0x81 || c==0xc6-0x81 && d>0x52)
|
||||
goto ilseq;
|
||||
if (d-'A'<26) d = d-'A';
|
||||
else if (d-'a'<26) d = d-'a'+26;
|
||||
--
|
||||
2.21.0
|
||||
|
||||
38
musl-cve-2025-26519-2.patch
Normal file
38
musl-cve-2025-26519-2.patch
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
>From c47ad25ea3b484e10326f933e927c0bc8cded3da Mon Sep 17 00:00:00 2001
|
||||
From: Rich Felker <dalias@aerifal.cx>
|
||||
Date: Wed, 12 Feb 2025 17:06:30 -0500
|
||||
Subject: [PATCH] iconv: harden UTF-8 output code path against input decoder
|
||||
bugs
|
||||
|
||||
the UTF-8 output code was written assuming an invariant that iconv's
|
||||
decoders only emit valid Unicode Scalar Values which wctomb can encode
|
||||
successfully, thereby always returning a value between 1 and 4.
|
||||
|
||||
if this invariant is not satisfied, wctomb returns (size_t)-1, and the
|
||||
subsequent adjustments to the output buffer pointer and remaining
|
||||
output byte count overflow, moving the output position backwards,
|
||||
potentially past the beginning of the buffer, without storing any
|
||||
bytes.
|
||||
---
|
||||
src/locale/iconv.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
|
||||
index 008c93f0..52178950 100644
|
||||
--- a/src/locale/iconv.c
|
||||
+++ b/src/locale/iconv.c
|
||||
@@ -545,6 +545,10 @@ size_t iconv(iconv_t cd, char **restrict in, size_t *restrict inb, char **restri
|
||||
if (*outb < k) goto toobig;
|
||||
memcpy(*out, tmp, k);
|
||||
} else k = wctomb_utf8(*out, c);
|
||||
+ /* This failure condition should be unreachable, but
|
||||
+ * is included to prevent decoder bugs from translating
|
||||
+ * into advancement outside the output buffer range. */
|
||||
+ if (k>4) goto ilseq;
|
||||
*out += k;
|
||||
*outb -= k;
|
||||
break;
|
||||
--
|
||||
2.21.0
|
||||
|
||||
|
||||
16
sources
16
sources
|
|
@ -1,13 +1,15 @@
|
|||
SHA512 (tinygo-0.30.0.tar.gz) = 91c4b6a578d5730e6915d48c69f567b814d5d1201150df053f116b78be5c29553f2fa8bf05f4565ffb7d1acabc58819a1f0ef2beea9830c4cb99d69116ac4fee
|
||||
SHA512 (tinygo-0.39.0.tar.gz) = ab9dbe6bfac56470d3703617bd0da152b044e84ced1bfcfb7e7bf6ba8880d07dfac267dca7356ace18bd3ed392ed7031b6cb4a2535ad5f956ab5912ecefe3807
|
||||
SHA512 (avr-6624554c02b237b23dc17d53e992bf54033fc228.tar.gz) = 1aa157bd761db38f8680614fa1cf47d7009508f65291b7eaaa5aba1ae76d35103f68a42947b7269a170d2f1cf8fb09941a5d74070fe6d204b68dd15a9ad2ed29
|
||||
SHA512 (bdwgc-1166f11f7dee08d7ad369296b24cf8c9582f8789.tar.gz) = 030d5a9a0931915a76b1ec270e7208199cf40973ac6c8141c02e34f118f965bedcadff3bb36481b0e45703df8eb2750d20809f3fde367fd5efed5f8a44ccab32
|
||||
SHA512 (cmsis-9fe411cef1cef5de58e5957b89760759de44e393-clean.tar.xz) = f131fc241f61982c49f334eb502c2f13da61eb7bdaa641ee84a8de30c4d576b735b8aadeafd7d75351473a2df6a42de6a236ecc5dcc616ee6cfcc07af29446f9
|
||||
SHA512 (cmsis_svd-df75ff974c76a911fc2815e29807f5ecaae06fc2-clean.tar.xz) = 8abbc6f366aed9571a74a4b6e7065ed2d6a59e0495c3745681d9a654d61edd136319788741f7afc781211adb64ed1faeafe9d6acc6be5a16d9ee48e98c5ddeb1
|
||||
SHA512 (compiler-rt-17.0.1.src.tar.xz) = a440cca467e51cd7e3484adb8ea189ca1af61f9da928b17fed7ee48ebf3e997a55b4b5e0a8309c02a59b59be6ea8458745e9e898c403cfff83b93ff57fbf922d
|
||||
SHA512 (compiler-rt-17.0.1.src.tar.xz.sig) = 5f8922e2e660e7b91c9a089caba51e8132c59f8502d39a70889b6508811dbbeece734a06b97ea366e87c023b957d09d6a62a06f7d848539bc894f6841084d61c
|
||||
SHA512 (macos-minimal-sdk-ebb736fda2bec7cea38dcda807518b835a539525.tar.gz) = 2f97d5826c79116c851e1efde74faf806de56ac8acc5509d1ab7690d0edf88f6e227b273d2c5ef7d894a8ada2e316e285ef4e58d74ca0c6f91584653154eae10
|
||||
SHA512 (cmsis_svd_data-05a9562ec59b87945a8d7177a4b08b7aa2f2fd58-clean.tar.xz) = e8ba9d74fb148dfa8b3ba140d307b243fb38378f69544529455eea5df57d4276b7177d3549228f8acadc4e72c94506456e78025d9b16d606b322fda8ab38327d
|
||||
SHA512 (compiler-rt-19.1.7.src.tar.xz) = e2e8e6a094525b84184e9e4a4c1a727de518d4ef1a91370515f0c955719dc946fd60e7fabd10f52ab1905ef6d4a86084b8ddfb9b45de838aa1c5ddf3c042748b
|
||||
SHA512 (compiler-rt-19.1.7.src.tar.xz.sig) = 48550377345331bfa0015d2c5bb6e063507a76e950f8f349a8e6877d35428a11d86bd617ea7a048f1584a42c58da924ef523d622b54ce4ca94eaa12ce290b49c
|
||||
SHA512 (macos-minimal-sdk-e7c72156eac3ebf29c34cc2faa71efcb1296663f.tar.gz) = 44638fa9786e88327eb5a2f5cf06c8f09149f21b2592802bdd2db04cbdf4dfbee1bc9296af1b7745c4e30ac97f26a714e19168b742526a8a1b4f8ce23d8fa789
|
||||
SHA512 (mingw64-8526cb618269440a94810b94b77f8bd48c5c3396.tar.gz) = 723d1ac22d8026f31b59d39328f711f36976798445a82daddcdc9fa6ab4346a5030e9c2efc84ef009439b8f021c5c7c120cfa083a7912a5b0212ac6852c005a7
|
||||
SHA512 (musl-1.2.3.tar.gz) = 9332f713d3eb7de4369bc0327d99252275ee52abf523ee34b894b24a387f67579787f7c72a46cf652e090cffdb0bc3719a4e7b84dca66890b6a37f12e8ad089c
|
||||
SHA512 (musl-1.2.3.tar.gz.asc) = 01a857dbc3981c90244d4d1d883efe51986652ca5734a741c9d1a4d06c5a22831e85520ac67212268b70c22049317a8f39b3219be182e7e67741add428ac5bc6
|
||||
SHA512 (net-c134160ae47d38b468b1c5ade43e78ad5a1e616d.tar.gz) = 449149af6bca15fa0fe1a9a8b37b3cab3bf83b177dd78d760fcca561bbacb415d6c7f0a355edf8d0de1b934d13fbce9d307c2a4410f1ff1c3bfe71b28e76b228
|
||||
SHA512 (nrfx-d779b49fc59c7a165e7da1d7cd7d57b28a059f16.tar.gz) = 31c7fc6fd88d4a74e5739b29659cb717a4629480d17d84e491d61c36c435aba16d38ef63d1036e508666a17eeaac5f11a5ff83211f88410f30cc2e152146ee83
|
||||
SHA512 (picolibc-b92edfda8ac6853772d87cadaeeeaa21b78609b6.tar.gz) = 9fb60d81bd98c96264c81e95cab6622ccacb34da285f7f3c137bd3cd8bc6e87cbc065a2e9d9fdfc7b93eec52f33bbfa70b6d0abc1a30551ebec1af351344cc39
|
||||
SHA512 (wasi-libc-30094b6ed05f19cee102115215863d185f2db4f0.tar.gz) = 17492263fd5dca422f19e0ff8533e1f440e3b7516dc24ef0d16fdc44832cc63ec288c9e930f63b47fb71497144fed55cc313acc74339d067b8d4f5c7c683df0f
|
||||
SHA512 (mingw64-8526cb618269440a94810b94b77f8bd48c5c3396.tar.gz) = 723d1ac22d8026f31b59d39328f711f36976798445a82daddcdc9fa6ab4346a5030e9c2efc84ef009439b8f021c5c7c120cfa083a7912a5b0212ac6852c005a7
|
||||
SHA512 (wasi-libc-wasi-sdk-20.tar.gz) = e264240dc7dbcf6398c8ca09bc108298f4a8aa955af22de5a3015fbcde81cb09dd83cd48349090082d5de0e8a3dbcf746c7b14657c67657b3f2f1ab28bb9cf05
|
||||
|
|
|
|||
294
tinygo.spec
294
tinygo.spec
|
|
@ -1,24 +1,30 @@
|
|||
# Generated by go2rpm 1
|
||||
%bcond_without check
|
||||
%bcond check 1
|
||||
# I'm not sure what this is for, as no tests seem to use it, and it introduces
|
||||
# some weird license that needs review.
|
||||
%bcond wasi_cli 0
|
||||
|
||||
%global __brp_strip_lto %{nil}
|
||||
%global __brp_strip_static_archive %{nil}
|
||||
|
||||
# https://github.com/tinygo-org/tinygo
|
||||
%global goipath github.com/tinygo-org/tinygo
|
||||
Version: 0.30.0
|
||||
Version: 0.39.0
|
||||
|
||||
%global CMSIS_commit 9fe411cef1cef5de58e5957b89760759de44e393
|
||||
%global avr_commit 6624554c02b237b23dc17d53e992bf54033fc228
|
||||
%global clang_llvm_version 17
|
||||
%global cmsis_svd_commit df75ff974c76a911fc2815e29807f5ecaae06fc2
|
||||
%global compiler_rt_version %{clang_llvm_version}.0.1
|
||||
%global macos_minsdk_commit ebb736fda2bec7cea38dcda807518b835a539525
|
||||
%global musl_version 1.2.3
|
||||
%global nrfx_commit d779b49fc59c7a165e7da1d7cd7d57b28a059f16
|
||||
%global picolibc_commit b92edfda8ac6853772d87cadaeeeaa21b78609b6
|
||||
%global wasi_libc_commit 30094b6ed05f19cee102115215863d185f2db4f0
|
||||
%global mingw64_commit 8526cb618269440a94810b94b77f8bd48c5c3396
|
||||
%global CMSIS_commit 9fe411cef1cef5de58e5957b89760759de44e393
|
||||
%global avr_commit 6624554c02b237b23dc17d53e992bf54033fc228
|
||||
%global bdwgc_commit 1166f11f7dee08d7ad369296b24cf8c9582f8789
|
||||
%global clang_llvm_version 19
|
||||
%global cmsis_svd_data_commit 05a9562ec59b87945a8d7177a4b08b7aa2f2fd58
|
||||
%global compiler_rt_version %{clang_llvm_version}.1.7
|
||||
%global macos_minsdk_commit e7c72156eac3ebf29c34cc2faa71efcb1296663f
|
||||
%global mingw64_commit 8526cb618269440a94810b94b77f8bd48c5c3396
|
||||
%global musl_version 1.2.3
|
||||
%global net_commit c134160ae47d38b468b1c5ade43e78ad5a1e616d
|
||||
%global nrfx_commit d779b49fc59c7a165e7da1d7cd7d57b28a059f16
|
||||
%global picolibc_commit b92edfda8ac6853772d87cadaeeeaa21b78609b6
|
||||
%global wasi_libc_version 20
|
||||
%global wasi_libc_tag wasi-sdk-%{wasi_libc_version}
|
||||
%global wasi_cli_version 0.2.0
|
||||
|
||||
# No longer matching regular Go's /usr/share/gocode because it also provides
|
||||
# pre-compiled binaries, and symlinks to arch-specific clang headers.
|
||||
|
|
@ -30,31 +36,35 @@ Version: 0.30.0
|
|||
Go compiler for small places. Microcontrollers, WebAssembly, and command-line
|
||||
tools. Based on LLVM.}
|
||||
|
||||
#global godocs CHANGELOG.md BUILDING.md CONTRIBUTING.md README.md
|
||||
#global golicenses LICENSE LICENSE.TXT
|
||||
#global gosupfiles lib/CMSIS/CMSIS/Include/*.h lib/compiler-rt/lib/builtins/*/*.S lib/nrfx/mdk/*.{ld,S} src/examples/wasm/*/*.js targets/*.{js,json,ld,S}
|
||||
|
||||
Name: tinygo
|
||||
Release: %autorelease
|
||||
Summary: Go compiler for small places
|
||||
|
||||
# Main files: BSD
|
||||
# CMSIS: BSD (subsetted)
|
||||
# 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
|
||||
# macos-minimal-sdk: APSL 2.0 and BSD and ISC and Public Domain
|
||||
# Main files: BSD-3-Clause
|
||||
# builder/cc1as.*: Apache-2.0 WITH LLVM-exception
|
||||
# corpus_test.go: MIT
|
||||
# CMSIS: BSD-3-Clause (subsetted)
|
||||
# avr-mcu: Apache-2.0 (packs) AND MIT (Rust code, unused by this package)
|
||||
# cmsis-svd: Apache-2.0 AND (Apache-2.0 OR MIT) AND BSD-3-Clause AND BSD-Source-Code AND ISC AND MIT (subsetted)
|
||||
# compiler-rt: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT
|
||||
# macos-minimal-sdk: APSL-2.0 AND BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause AND BSD-4-Clause-UC AND ISC AND LicenseRef-Fedora-Public-Domain
|
||||
# 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
|
||||
License: BSD and APSL 2.0 and ASL 2.0 and CC0 and ISC and MIT and (NCSA or MIT) and Public Domain
|
||||
# net: BSD-2-Clause
|
||||
# nrfx: BSD-3-Clause AND Apache-2.0
|
||||
# picolibc: BSD-2-Clause AND BSD-2-Clause-FreeBSD AND BSD-3-Clause AND ISC AND SMLNJ AND Spencer-94 AND GPLv2 (testing code only, unused by this package)
|
||||
# wasi-libc: Apache-2.0 WITH LLVM-exception AND Apache-2.0 AND MIT AND BSD-2-Clause AND CC0-1.0 (dlmalloc implementation, unused by this package)
|
||||
License: %{shrink: BSD-3-Clause AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND MIT AND
|
||||
Apache-2.0 AND
|
||||
(Apache-2.0 OR MIT) AND BSD-Source-Code AND ISC AND
|
||||
(Apache-2.0 WITH LLVM-exception OR NCSA OR MIT) AND
|
||||
APSL-2.0 AND BSD-2-Clause AND BSD-4-Clause AND BSD-4-Clause-UC AND LicenseRef-Fedora-Public-Domain AND
|
||||
BSD-2-Clause-FreeBSD AND SMLNJ AND Spencer-94}
|
||||
URL: %{gourl}
|
||||
Source0: %{gosource}
|
||||
Source1: clean_tarballs.sh
|
||||
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
|
||||
Source4: cmsis_svd_data-%{cmsis_svd_data_commit}-clean.tar.xz
|
||||
Source50: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}/compiler-rt-%{compiler_rt_version}.src.tar.xz
|
||||
Source51: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{compiler_rt_version}/compiler-rt-%{compiler_rt_version}.src.tar.xz.sig
|
||||
Source52: https://src.fedoraproject.org/rpms/compiler-rt/raw/f8e98d51f0c3fdbaa9ce5d99816930e4fcbe504b/f/release-keys.asc#/compiler-rt-release-keys.asc
|
||||
|
|
@ -64,34 +74,40 @@ Source62: https://musl.libc.org/musl.pub
|
|||
Source7: https://github.com/aykevl/macos-minimal-sdk/archive/%{macos_minsdk_commit}/macos-minimal-sdk-%{macos_minsdk_commit}.tar.gz
|
||||
Source8: https://github.com/NordicSemiconductor/nrfx/archive/%{nrfx_commit}/nrfx-%{nrfx_commit}.tar.gz
|
||||
Source9: https://github.com/keith-packard/picolibc/archive/%{picolibc_commit}/picolibc-%{picolibc_commit}.tar.gz
|
||||
Source10: https://github.com/WebAssembly/wasi-libc/archive/%{wasi_libc_commit}/wasi-libc-%{wasi_libc_commit}.tar.gz
|
||||
Source10: https://github.com/WebAssembly/wasi-libc/archive/%{wasi_libc_tag}/wasi-libc-%{wasi_libc_tag}.tar.gz
|
||||
Source11: https://github.com/mingw-w64/mingw-w64/archive/%{mingw64_commit}/mingw64-%{mingw64_commit}.tar.gz
|
||||
# We don't have wasmtime to run these.
|
||||
Patch0001: 0001-Skip-WASI-tests.patch
|
||||
# Unbundling things
|
||||
# Patch0002: 0002-Use-system-mingw64-headers-and-crt.patch
|
||||
# Skip testing some things where qemu is broken:
|
||||
# https://gitlab.com/qemu-project/qemu/-/issues/447
|
||||
# https://gitlab.com/qemu-project/qemu/-/issues/690
|
||||
Patch0002: 0002-Skip-some-cross-Linux-tests-where-qemu-is-broken.patch
|
||||
# Add Fedora specific dnf instructions
|
||||
Patch0003: 0003-Suggest-optional-packages-to-install-if-missing.patch
|
||||
Source12: https://github.com/tinygo-org/net/archive/%{net_commit}/net-%{net_commit}.tar.gz
|
||||
%if %{with wasi_cli}
|
||||
Source13: https://github.com/WebAssembly/wasi-cli/archive/v%{wasi_cli_version}/wasi-cli-%{wasi_cli_version}.tar.gz
|
||||
%endif
|
||||
Source14: https://github.com/ivmai/bdwgc/archive/%{bdwgc_commit}/bdwgc-%{bdwgc_commit}.tar.gz
|
||||
|
||||
# Support LLVM 17.
|
||||
# https://github.com/tinygo-org/tinygo/pull/3923
|
||||
Patch0004: 0004-transform-fix-bug-in-StringToBytes-optimization-pass.patch
|
||||
# https://github.com/tinygo-org/tinygo/pull/3918
|
||||
Patch0005: 0005-all-use-the-new-LLVM-pass-manager.patch
|
||||
# https://github.com/tinygo-org/tinygo/pull/3913
|
||||
Patch0006: 0006-avr-don-t-compile-large-parts-of-picolibc-math-stdio.patch
|
||||
Patch0007: 0007-all-add-initial-LLVM-17-support.patch
|
||||
#
|
||||
# Unnumbered patches are applied to the main source tree.
|
||||
# Patches that are 1X00-1X99 are applied to the subdirectory for source X.
|
||||
#
|
||||
|
||||
# We don't have wasmtime to run these.
|
||||
Patch: 0001-Skip-WASI-tests.patch
|
||||
# We set GO111MODULE=off during tests, so can't run a few of them.
|
||||
Patch: 0002-Skip-tests-that-require-Go-module-mode.patch
|
||||
# Better search paths for non-default LLVM.
|
||||
Patch: 0003-Set-LLVM-search-paths-for-Fedora.patch
|
||||
#https://github.com/tinygo-org/tinygo/pull/4677
|
||||
Patch: 0004-Normalize-expected-path-for-chdir-tests.patch
|
||||
# https://github.com/tinygo-org/tinygo/issues/4969
|
||||
Patch: 0005-Skip-x86-tests-on-ARM.patch
|
||||
|
||||
# Fix CVE-2025-26519 in musl.
|
||||
Patch1600: https://www.openwall.com/lists/musl/2025/02/13/1/1#/musl-cve-2025-26519-1.patch
|
||||
Patch1601: https://www.openwall.com/lists/musl/2025/02/13/1/2#/musl-cve-2025-26519-2.patch
|
||||
|
||||
# Not supported upstream yet.
|
||||
ExcludeArch: ppc64le s390x
|
||||
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
|
||||
ExcludeArch: %{ix86}
|
||||
|
||||
BuildRequires: (clang-devel >= %{clang_llvm_version} with clang-devel < %{lua: print(tonumber(rpm.expand('%{clang_llvm_version}')) + 1)})
|
||||
BuildRequires: clang-devel(major) = %{clang_llvm_version}
|
||||
BuildRequires: golang(github.com/aykevl/go-wasm)
|
||||
BuildRequires: golang(github.com/blakesmith/ar)
|
||||
BuildRequires: chromium
|
||||
|
|
@ -101,26 +117,28 @@ BuildRequires: golang(github.com/gofrs/flock) >= 0.8.1
|
|||
BuildRequires: golang(github.com/google/shlex)
|
||||
BuildRequires: golang(github.com/inhies/go-bytesize)
|
||||
BuildRequires: golang(github.com/marcinbor85/gohex)
|
||||
BuildRequires: golang(github.com/mattn/go-colorable) >= 0.1.8
|
||||
BuildRequires: golang(github.com/mattn/go-colorable) >= 0.1.13
|
||||
BuildRequires: golang(github.com/mattn/go-tty) >= 0.0.4
|
||||
BuildRequires: golang(github.com/tetratelabs/wazero) >= 1.6
|
||||
BuildRequires: golang(golang.org/x/net/http/httpguts) >= 0.35
|
||||
BuildRequires: golang(github.com/sigurn/crc16)
|
||||
BuildRequires: golang(go.bug.st/serial) >= 1.6.0
|
||||
BuildRequires: golang(golang.org/x/tools/go/ast/astutil)
|
||||
BuildRequires: golang(golang.org/x/tools/go/ssa) >= 0.11
|
||||
BuildRequires: golang(golang.org/x/tools/go/ssa) >= 0.30
|
||||
BuildRequires: golang(gopkg.in/yaml.v2) >= 2.4.0
|
||||
BuildRequires: golang(tinygo.org/x/go-llvm)
|
||||
BuildRequires: golang-tests
|
||||
BuildRequires: llvm-devel(major) = %{clang_llvm_version}
|
||||
BuildRequires: make
|
||||
|
||||
BuildRequires: binaryen >= 102
|
||||
BuildRequires: binaryen >= 116
|
||||
# We don't have glibc for arm, so skip these.
|
||||
#BuildRequires: gcc-arm-linux-gnu
|
||||
#BuildRequires: gcc-aarch64-linux-gnu
|
||||
BuildRequires: lld
|
||||
BuildRequires: lld(major) = %{clang_llvm_version}
|
||||
# BuildRequires: mingw64-crt
|
||||
# BuildRequires: mingw64-headers
|
||||
BuildRequires: nodejs
|
||||
BuildRequires: nodejs >= 18
|
||||
BuildRequires: qemu-system-arm-core
|
||||
BuildRequires: qemu-system-riscv-core
|
||||
BuildRequires: qemu-user
|
||||
|
|
@ -128,9 +146,9 @@ BuildRequires: qemu-user
|
|||
# For GPG signature verification
|
||||
BuildRequires: gnupg2
|
||||
|
||||
Requires: clang
|
||||
Requires: clang(major) = %{clang_llvm_version}
|
||||
Requires: golang
|
||||
Requires: lld
|
||||
Requires: lld(major) = %{clang_llvm_version}
|
||||
# Add this when LLVM supports ESP natively.
|
||||
# Recommends: esptool
|
||||
# Recommends: mingw64-crt
|
||||
|
|
@ -140,32 +158,41 @@ Recommends: qemu-system-riscv-core
|
|||
Recommends: qemu-user
|
||||
|
||||
# Make note of bundled libc's
|
||||
Provides: bundled(bdwgc) = %{bdwgc_commit}
|
||||
Provides: bundled(gc) = %{bdwgc_commit}
|
||||
Provides: bundled(compiler-rt) = %{compiler_rt_version}
|
||||
Provides: bundled(musl) = %{musl_version}
|
||||
Provides: bundled(picolibc) = %{picolibc_commit}
|
||||
Provides: bundled(wasi-libc) = %{wasi_libc_commit}
|
||||
Provides: bundled(wasi-libc) = %{wasi_libc_version}
|
||||
|
||||
%description
|
||||
%{common_description}
|
||||
|
||||
#gopkg
|
||||
|
||||
|
||||
%prep
|
||||
%goprep
|
||||
%autopatch -p1
|
||||
%autopatch -q -p1 -M 999
|
||||
|
||||
tar -C lib -xf %{SOURCE2}
|
||||
rmdir lib/CMSIS
|
||||
mv lib/CMSIS-%{CMSIS_commit} lib/CMSIS
|
||||
pushd lib/CMSIS
|
||||
%autopatch -q -p1 -m 1200 -M 1299
|
||||
popd
|
||||
|
||||
tar -C lib -xf %{SOURCE3}
|
||||
rmdir lib/avr
|
||||
mv lib/avr-mcu-%{avr_commit} lib/avr
|
||||
pushd lib/avr
|
||||
%autopatch -q -p1 -m 1300 -M 1399
|
||||
popd
|
||||
|
||||
tar -C lib -xf %{SOURCE4}
|
||||
rmdir lib/cmsis-svd
|
||||
mv lib/cmsis-svd-%{cmsis_svd_commit} lib/cmsis-svd
|
||||
mv lib/cmsis-svd-data-%{cmsis_svd_data_commit} lib/cmsis-svd
|
||||
pushd lib/cmsis-svd
|
||||
%autopatch -q -p1 -m 1400 -M 1499
|
||||
popd
|
||||
|
||||
# Verify *before* actually unpacking!
|
||||
%{gpgverify} --keyring='%{SOURCE52}' --signature='%{SOURCE51}' --data='%{SOURCE50}'
|
||||
|
|
@ -173,60 +200,93 @@ tar -C lib -xf %{SOURCE50}
|
|||
mv lib/compiler-rt-%{compiler_rt_version}.src/lib/builtins lib/compiler-rt-builtins
|
||||
mv lib/compiler-rt-%{compiler_rt_version}.src/README.txt lib/compiler-rt-builtins/
|
||||
mv lib/compiler-rt-%{compiler_rt_version}.src/LICENSE.TXT lib/compiler-rt-builtins/
|
||||
pushd lib/compiler-rt-builtins
|
||||
%autopatch -q -p1 -m 1500 -M 1599
|
||||
popd
|
||||
|
||||
# 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
|
||||
pushd lib/musl
|
||||
%autopatch -q -p1 -m 1600 -M 1699
|
||||
popd
|
||||
|
||||
tar -C lib -xf %{SOURCE7}
|
||||
rmdir lib/macos-minimal-sdk
|
||||
mv lib/macos-minimal-sdk-%{macos_minsdk_commit} lib/macos-minimal-sdk
|
||||
pushd lib/macos-minimal-sdk
|
||||
%autopatch -q -p1 -m 1700 -M 1799
|
||||
popd
|
||||
|
||||
tar -C lib -xf %{SOURCE8}
|
||||
rmdir lib/nrfx
|
||||
mv lib/nrfx-%{nrfx_commit} lib/nrfx
|
||||
rm lib/nrfx/.gitignore
|
||||
chmod -x lib/nrfx/doc/generate_html_doc.sh
|
||||
pushd lib/nrfx
|
||||
%autopatch -q -p1 -m 1800 -M 1899
|
||||
popd
|
||||
|
||||
tar -C lib -xf %{SOURCE9}
|
||||
rmdir lib/picolibc
|
||||
mv lib/picolibc-%{picolibc_commit} lib/picolibc
|
||||
pushd lib/picolibc
|
||||
%autopatch -q -p1 -m 1900 -M 1999
|
||||
popd
|
||||
|
||||
tar -C lib -xf %{SOURCE10}
|
||||
rmdir lib/wasi-libc
|
||||
mv lib/wasi-libc-%{wasi_libc_commit} lib/wasi-libc
|
||||
mv lib/wasi-libc-%{wasi_libc_tag} lib/wasi-libc
|
||||
pushd lib/wasi-libc
|
||||
%autopatch -q -p1 -m 11000 -M 11099
|
||||
popd
|
||||
|
||||
tar -C lib -xf %{SOURCE11}
|
||||
rmdir lib/mingw-w64
|
||||
mv lib/mingw-w64-%{mingw64_commit} lib/mingw-w64
|
||||
pushd lib/mingw-w64
|
||||
%autopatch -q -p1 -m 11100 -M 11199
|
||||
popd
|
||||
|
||||
tar -C src -xf %{SOURCE12}
|
||||
rmdir src/net
|
||||
mv src/net-%{net_commit} src/net
|
||||
pushd src/net
|
||||
%autopatch -q -p1 -m 11200 -M 11299
|
||||
popd
|
||||
|
||||
%if %{with wasi_cli}
|
||||
tar -C lib -xf %{SOURCE13}
|
||||
rmdir lib/wasi-cli
|
||||
mv lib/wasi-cli-%{wasi_cli_version} lib/wasi-cli
|
||||
pushd lib/wasi-cli
|
||||
%autopatch -q -p1 -m 11300 -M 11399
|
||||
popd
|
||||
%endif
|
||||
|
||||
tar -C lib -xf %{SOURCE14}
|
||||
rmdir lib/bdwgc
|
||||
mv lib/bdwgc-%{bdwgc_commit} lib/bdwgc
|
||||
pushd lib/bdwgc
|
||||
%autopatch -q -p1 -m 11400 -M 11499
|
||||
popd
|
||||
|
||||
%build
|
||||
# Use only GOBUILDTAGS when https://pagure.io/go-rpm-macros/pull-request/34 is
|
||||
# merged and released.
|
||||
export BUILDTAGS="llvm%{clang_llvm_version}" LDFLAGS="-X github.com/tinygo-org/tinygo/goenv.TINYGOROOT=%{tinygoroot} "
|
||||
export GO_BUILDTAGS="llvm%{clang_llvm_version}" GO_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 thumbv6m-unknown-unknown-eabi-cortex-m0 thumbv6m-unknown-unknown-eabi-cortex-m0plus thumbv7em-unknown-unknown-eabi-cortex-m4; do
|
||||
mkdir -p ${target}
|
||||
for libc in compiler-rt picolibc; do
|
||||
TINYGOROOT=$PWD \
|
||||
%{gobuilddir}/bin/tinygo \
|
||||
build-library -target=${target#*eabi-} -o ${target}/${libc} ${libc}
|
||||
chmod -R a+rX ${target}/${libc}
|
||||
done
|
||||
done
|
||||
%make_build wasi-libc CLANG=clang-%{clang_llvm_version} LLVM_AR=llvm-ar LLVM_NM=llvm-nm
|
||||
GO111MODULE=off %make_build gen-device RENESAS=0 STM32=0
|
||||
|
||||
|
||||
%install
|
||||
#gopkginstall
|
||||
install -vdm 0755 %{buildroot}%{_bindir}
|
||||
install -vpm 0755 %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
|
||||
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/bdwgc
|
||||
cp -rp lib/bdwgc/* %{buildroot}%{tinygoroot}/lib/bdwgc
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/CMSIS
|
||||
install -vpm 0644 lib/CMSIS/README.md %{buildroot}%{tinygoroot}/lib/CMSIS/
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/CMSIS/CMSIS/Include
|
||||
|
|
@ -234,12 +294,24 @@ install -vpm 0644 lib/CMSIS/CMSIS/Include/* %{buildroot}%{tinygoroot}/lib/CMSIS/
|
|||
cp -rp lib/compiler-rt-builtins %{buildroot}%{tinygoroot}/lib
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/macos-minimal-sdk
|
||||
cp -rp lib/macos-minimal-sdk/* %{buildroot}%{tinygoroot}/lib/macos-minimal-sdk
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/lib-common
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/def-include %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/gdtoa %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/include %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/misc %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/stdio %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/crt
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/crt/pseudo-reloc.c %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/crt
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/math
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/math/x86 %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/math
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/lib-common
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/api-ms-win-crt-* %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/lib-common
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/advapi32.def.in %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/lib-common
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/kernel32.def.in %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/lib-common
|
||||
cp -rp lib/mingw-w64/mingw-w64-crt/lib-common/msvcrt.def.in %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-crt/lib-common
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-headers/defaults
|
||||
cp -rp lib/mingw-w64/mingw-w64-headers/crt/ %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-headers
|
||||
cp -rp lib/mingw-w64/mingw-w64-headers/include %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-headers
|
||||
cp -rp lib/mingw-w64/mingw-w64-headers/defaults/include %{buildroot}%{tinygoroot}/lib/mingw-w64/mingw-w64-headers/defaults
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/musl
|
||||
cp -rp lib/musl/COPYRIGHT %{buildroot}%{tinygoroot}/lib/musl
|
||||
|
|
@ -249,28 +321,79 @@ 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/mips %{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/conf %{buildroot}%{tinygoroot}/lib/musl/src
|
||||
cp -rp lib/musl/src/ctype %{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/fcntl %{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/legacy %{buildroot}%{tinygoroot}/lib/musl/src
|
||||
cp -rp lib/musl/src/linux %{buildroot}%{tinygoroot}/lib/musl/src
|
||||
cp -rp lib/musl/src/locale %{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/math %{buildroot}%{tinygoroot}/lib/musl/src
|
||||
cp -rp lib/musl/src/misc %{buildroot}%{tinygoroot}/lib/musl/src
|
||||
cp -rp lib/musl/src/multibyte %{buildroot}%{tinygoroot}/lib/musl/src
|
||||
cp -rp lib/musl/src/sched %{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/stdlib %{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/musl/src/process %{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/
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc/dlmalloc
|
||||
cp -rp lib/wasi-libc/dlmalloc/src %{buildroot}%{tinygoroot}/lib/wasi-libc/dlmalloc
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-bottom-half
|
||||
cp -rp lib/wasi-libc/libc-bottom-half/cloudlibc %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-bottom-half
|
||||
cp -rp lib/wasi-libc/libc-bottom-half/headers %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-bottom-half
|
||||
cp -rp lib/wasi-libc/libc-bottom-half/sources %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-bottom-half
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half
|
||||
cp -rp lib/wasi-libc/libc-top-half/headers %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half
|
||||
cp -rp lib/wasi-libc/libc-top-half/sources %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/include %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/arch
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/arch/generic %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/arch
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/arch/wasm32 %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/arch
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/conf %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/dirent %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/env %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/errno %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/exit %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/fcntl %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/fenv %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/include %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/internal %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/legacy %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/locale %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/math %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/misc %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/multibyte %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/network %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/stat %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/stdio %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/stdlib %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/string %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/thread %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/time %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
cp -rp lib/wasi-libc/libc-top-half/musl/src/unistd %{buildroot}%{tinygoroot}/lib/wasi-libc/libc-top-half/musl/src
|
||||
%if %{with wasi_cli}
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/wasi-cli
|
||||
cp -rp lib/wasi-cli/wit %{buildroot}%{tinygoroot}/lib/wasi-cli/wit
|
||||
%endif
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
||||
cp -rp lib/picolibc/newlib/libc/ctype %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc
|
||||
chmod -x %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libc/ctype/{mkcaseconv,mkcategories,mkunidata}
|
||||
|
|
@ -284,20 +407,13 @@ 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/newlib/libm/math %{buildroot}%{tinygoroot}/lib/picolibc/newlib/libm
|
||||
cp -rp lib/picolibc-stdio.c %{buildroot}%{tinygoroot}/lib
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/pkg
|
||||
for target in thumbv6m-unknown-unknown-eabi-cortex-m0 thumbv6m-unknown-unknown-eabi-cortex-m0plus thumbv7em-unknown-unknown-eabi-cortex-m4; do
|
||||
install -vdm 0755 %{buildroot}%{tinygoroot}/pkg/${target}
|
||||
for libc in compiler-rt picolibc; do
|
||||
cp -rp ${target}/${libc} %{buildroot}%{tinygoroot}/pkg/${target}/
|
||||
done
|
||||
done
|
||||
cp -rp src %{buildroot}%{tinygoroot}/
|
||||
rm %{buildroot}%{tinygoroot}/src/examples/wasm/.gitignore
|
||||
cp -rp targets %{buildroot}%{tinygoroot}/
|
||||
|
||||
|
||||
%if %{with check}
|
||||
%global gotestflags %gocompilerflags -v -tags="llvm%{clang_llvm_version}"
|
||||
%global gotestflags %gocompilerflags -v -tags="llvm%{clang_llvm_version}" -timeout 30m
|
||||
%check
|
||||
export TINYGOROOT=%{buildroot}%{tinygoroot}
|
||||
export GOPATH=%{buildroot}%{tinygoroot}:%{gopath}
|
||||
|
|
@ -318,6 +434,8 @@ make tinygo-test
|
|||
%license LICENSE
|
||||
%{_bindir}/tinygo
|
||||
%{tinygoroot}
|
||||
%doc %{tinygoroot}/lib/bdwgc/README.md
|
||||
%license %{tinygoroot}/lib/bdwgc/LICENSE
|
||||
%doc %{tinygoroot}/lib/CMSIS/README.md
|
||||
%license %{tinygoroot}/lib/compiler-rt-builtins/LICENSE.TXT
|
||||
%doc %{tinygoroot}/lib/compiler-rt-builtins/README.txt
|
||||
|
|
@ -325,8 +443,6 @@ make tinygo-test
|
|||
%doc %{tinygoroot}/lib/nrfx/README.md
|
||||
%license %{tinygoroot}/lib/musl/COPYRIGHT
|
||||
|
||||
#gopkgfiles
|
||||
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue