Skip to content

Commit 1b62213

Browse files
committed
all: add support for LLVM 20
This adds support for the 'go install' case, where we link against the system LLVM (Homebrew, Linux distro version, etc). This does not have an effect on `make`, which still uses LLVM 19 for now. The main reason for doing this is because newer distros like Fedora 42 and Homebrew have switched to LLVM 20, so switching to this newer version helps those people. (I'm one of those people, I'm on Fedora 42).
1 parent febb390 commit 1b62213

File tree

6 files changed

+26
-11
lines changed

6 files changed

+26
-11
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,12 @@ jobs:
101101
# "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21
102102
fmt-check: false
103103
resource_class: large
104-
test-llvm19-go124:
104+
test-llvm20-go124:
105105
docker:
106106
- image: golang:1.24-bullseye
107107
steps:
108108
- test-linux:
109-
llvm: "19"
109+
llvm: "20"
110110
resource_class: large
111111

112112
workflows:
@@ -115,5 +115,5 @@ workflows:
115115
# This tests our lowest supported versions of Go and LLVM, to make sure at
116116
# least the smoke tests still pass.
117117
- test-llvm15-go119
118-
# This tests LLVM 19 support when linking against system libraries.
119-
- test-llvm19-go124
118+
# This tests LLVM 20 support when linking against system libraries.
119+
- test-llvm20-go124

.github/workflows/build-macos.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ jobs:
117117
runs-on: macos-latest
118118
strategy:
119119
matrix:
120-
version: [16, 17, 18, 19]
120+
version: [16, 17, 18, 19, 20]
121121
steps:
122122
- name: Set up Homebrew
123123
uses: Homebrew/actions/setup-homebrew@master
@@ -141,8 +141,8 @@ jobs:
141141
- name: Check binary
142142
run: tinygo version
143143
- name: Build TinyGo (default LLVM)
144-
if: matrix.version == 19
144+
if: matrix.version == 20
145145
run: go install
146146
- name: Check binary
147-
if: matrix.version == 19
147+
if: matrix.version == 20
148148
run: tinygo version

cgo/libclang_config_llvm19.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !byollvm && !llvm15 && !llvm16 && !llvm17 && !llvm18
1+
//go:build !byollvm && llvm19
22

33
package cgo
44

cgo/libclang_config_llvm20.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//go:build !byollvm && !llvm15 && !llvm16 && !llvm17 && !llvm18 && !llvm19
2+
3+
package cgo
4+
5+
/*
6+
#cgo linux CFLAGS: -I/usr/include/llvm-20 -I/usr/include/llvm-c-20 -I/usr/lib/llvm-20/include
7+
#cgo darwin,amd64 CFLAGS: -I/usr/local/opt/llvm@20/include
8+
#cgo darwin,arm64 CFLAGS: -I/opt/homebrew/opt/llvm@20/include
9+
#cgo freebsd CFLAGS: -I/usr/local/llvm20/include
10+
#cgo linux LDFLAGS: -L/usr/lib/llvm-20/lib -lclang
11+
#cgo darwin,amd64 LDFLAGS: -L/usr/local/opt/llvm@20/lib -lclang
12+
#cgo darwin,arm64 LDFLAGS: -L/opt/homebrew/opt/llvm@20/lib -lclang
13+
#cgo freebsd LDFLAGS: -L/usr/local/llvm20/lib -lclang
14+
*/
15+
import "C"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
golang.org/x/sys v0.21.0
2121
golang.org/x/tools v0.22.1-0.20240621165957-db513b091504
2222
gopkg.in/yaml.v2 v2.4.0
23-
tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9
23+
tinygo.org/x/go-llvm v0.0.0-20250422114502-b8f170971e74
2424
)
2525

2626
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
7474
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
7575
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
7676
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
77-
tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9 h1:rMvEzuCYjyiR+pmdiCVWTQw3L6VqiSIXoL19I3lYufE=
78-
tinygo.org/x/go-llvm v0.0.0-20250119132755-9dca92dfb4f9/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=
77+
tinygo.org/x/go-llvm v0.0.0-20250422114502-b8f170971e74 h1:ovavgTdIBWCH8YWlcfq9gkpoyT1+IxMKSn+Df27QwE8=
78+
tinygo.org/x/go-llvm v0.0.0-20250422114502-b8f170971e74/go.mod h1:GFbusT2VTA4I+l4j80b17KFK+6whv69Wtny5U+T8RR0=

0 commit comments

Comments
 (0)