diff --git a/.circleci/config.yml b/.circleci/config.yml index 257e5971ab..9ecb9c4ce3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -101,12 +101,12 @@ jobs: # "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21 fmt-check: false resource_class: large - test-llvm19-go124: + test-llvm20-go124: docker: - image: golang:1.24-bullseye steps: - test-linux: - llvm: "19" + llvm: "20" resource_class: large workflows: @@ -115,5 +115,5 @@ workflows: # This tests our lowest supported versions of Go and LLVM, to make sure at # least the smoke tests still pass. - test-llvm15-go119 - # This tests LLVM 19 support when linking against system libraries. - - test-llvm19-go124 + # This tests LLVM 20 support when linking against system libraries. + - test-llvm20-go124 diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 46ec2cc7c9..5fbe79ddfd 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -117,7 +117,7 @@ jobs: runs-on: macos-latest strategy: matrix: - version: [16, 17, 18, 19] + version: [16, 17, 18, 19, 20] steps: - name: Set up Homebrew uses: Homebrew/actions/setup-homebrew@master @@ -141,8 +141,8 @@ jobs: - name: Check binary run: tinygo version - name: Build TinyGo (default LLVM) - if: matrix.version == 19 + if: matrix.version == 20 run: go install - name: Check binary - if: matrix.version == 19 + if: matrix.version == 20 run: tinygo version diff --git a/.github/workflows/sizediff-install-pkgs.sh b/.github/workflows/sizediff-install-pkgs.sh index e81c994ea8..fd65887df8 100755 --- a/.github/workflows/sizediff-install-pkgs.sh +++ b/.github/workflows/sizediff-install-pkgs.sh @@ -2,11 +2,11 @@ # still works after checking out the dev branch (that is, when going from LLVM # 16 to LLVM 17 for example, both Clang 16 and Clang 17 are installed). -echo 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-19 main' | sudo tee /etc/apt/sources.list.d/llvm.list +echo 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-20 main' | sudo tee /etc/apt/sources.list.d/llvm.list wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - sudo apt-get update sudo apt-get install --no-install-recommends -y \ - llvm-19-dev \ - clang-19 \ - libclang-19-dev \ - lld-19 + llvm-20-dev \ + clang-20 \ + libclang-20-dev \ + lld-20 diff --git a/builder/wasilibc.go b/builder/wasilibc.go index 9b8ad7a5e2..4298f8c58d 100644 --- a/builder/wasilibc.go +++ b/builder/wasilibc.go @@ -93,12 +93,13 @@ var libWasiLibc = Library{ "-Wall", "-std=gnu11", "-nostdlibinc", - "-mnontrapping-fptoint", "-msign-ext", + "-mnontrapping-fptoint", "-msign-ext", "-mbulk-memory", "-Wno-null-pointer-arithmetic", "-Wno-unused-parameter", "-Wno-sign-compare", "-Wno-unused-variable", "-Wno-unused-function", "-Wno-ignored-attributes", "-Wno-missing-braces", "-Wno-ignored-pragmas", "-Wno-unused-but-set-variable", "-Wno-unknown-warning-option", "-Wno-parentheses", "-Wno-shift-op-parentheses", "-Wno-bitwise-op-parentheses", "-Wno-logical-op-parentheses", "-Wno-string-plus-int", "-Wno-dangling-else", "-Wno-unknown-pragmas", "-DNDEBUG", "-D__wasilibc_printscan_no_long_double", "-D__wasilibc_printscan_full_support_option=\"long double support is disabled\"", + "-DBULK_MEMORY_THRESHOLD=32", // default threshold in wasi-libc "-isystem", headerPath, "-I" + libcDir + "/libc-top-half/musl/src/include", "-I" + libcDir + "/libc-top-half/musl/src/internal", diff --git a/builder/wasmbuiltins.go b/builder/wasmbuiltins.go index 4c158f2337..ca03d6bcdd 100644 --- a/builder/wasmbuiltins.go +++ b/builder/wasmbuiltins.go @@ -29,6 +29,8 @@ var libWasmBuiltins = Library{ "-Wall", "-std=gnu11", "-nostdlibinc", + "-mnontrapping-fptoint", // match wasm-unknown (default on in LLVM 20) + "-mno-bulk-memory", // same here "-isystem", libcDir + "/libc-top-half/musl/arch/wasm32", "-isystem", libcDir + "/libc-top-half/musl/arch/generic", "-isystem", libcDir + "/libc-top-half/musl/src/internal", diff --git a/cgo/libclang_config_llvm19.go b/cgo/libclang_config_llvm19.go index 867d23f24b..11a64e72c4 100644 --- a/cgo/libclang_config_llvm19.go +++ b/cgo/libclang_config_llvm19.go @@ -1,4 +1,4 @@ -//go:build !byollvm && !llvm15 && !llvm16 && !llvm17 && !llvm18 +//go:build !byollvm && llvm19 package cgo diff --git a/cgo/libclang_config_llvm20.go b/cgo/libclang_config_llvm20.go new file mode 100644 index 0000000000..faa2e54d55 --- /dev/null +++ b/cgo/libclang_config_llvm20.go @@ -0,0 +1,15 @@ +//go:build !byollvm && !llvm15 && !llvm16 && !llvm17 && !llvm18 && !llvm19 + +package cgo + +/* +#cgo linux CFLAGS: -I/usr/include/llvm-20 -I/usr/include/llvm-c-20 -I/usr/lib/llvm-20/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 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 +*/ +import "C" diff --git a/go.mod b/go.mod index ec52702d53..25be7cca31 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( golang.org/x/sys v0.21.0 golang.org/x/tools v0.22.1-0.20240621165957-db513b091504 gopkg.in/yaml.v2 v2.4.0 - tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9 + tinygo.org/x/go-llvm v0.0.0-20250422114502-b8f170971e74 ) require ( diff --git a/go.sum b/go.sum index f8cef17c11..dbb5f7001a 100644 --- a/go.sum +++ b/go.sum @@ -74,5 +74,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.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9 h1:rMvEzuCYjyiR+pmdiCVWTQw3L6VqiSIXoL19I3lYufE= -tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0= +tinygo.org/x/go-llvm v0.0.0-20250422114502-b8f170971e74 h1:ovavgTdIBWCH8YWlcfq9gkpoyT1+IxMKSn+Df27QwE8= +tinygo.org/x/go-llvm v0.0.0-20250422114502-b8f170971e74/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=