Skip to content

Commit db4d569

Browse files
committed
WIP: add support for LLVM 19
This is incomplete. I've only made this so that we have a LLVM 19 branch ready to go once LLVM 19 is released (and the Xtensa fork has been rebased).
1 parent 1ef1aa7 commit db4d569

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+253
-216
lines changed

.circleci/config.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ commands:
1010
steps:
1111
- restore_cache:
1212
keys:
13-
- llvm-source-18-v1
13+
- llvm-source-19-v1
1414
- run:
1515
name: "Fetch LLVM source"
1616
command: make llvm-source
1717
- save_cache:
18-
key: llvm-source-18-v1
18+
key: llvm-source-19-v1
1919
paths:
2020
- llvm-project/clang/lib/Headers
2121
- llvm-project/clang/include
@@ -107,12 +107,15 @@ jobs:
107107
# "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21
108108
fmt-check: false
109109
resource_class: large
110-
test-llvm18-go123:
110+
test-llvm19-go123:
111111
docker:
112112
- image: golang:1.23-bullseye
113113
steps:
114114
- test-linux:
115-
llvm: "18"
115+
llvm: "19"
116+
environment:
117+
# Hack to work around https://github.com/llvm/llvm-project/issues/105987
118+
LD_LIBRARY_PATH: /usr/lib/llvm-19/lib
116119
resource_class: large
117120

118121
workflows:
@@ -121,5 +124,5 @@ workflows:
121124
# This tests our lowest supported versions of Go and LLVM, to make sure at
122125
# least the smoke tests still pass.
123126
- test-llvm15-go119
124-
# This tests LLVM 18 support when linking against system libraries.
125-
- test-llvm18-go123
127+
# This tests LLVM 19 support when linking against system libraries.
128+
- test-llvm19-go123

.github/workflows/build-macos.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
uses: actions/cache/restore@v4
4444
id: cache-llvm-source
4545
with:
46-
key: llvm-source-18-${{ matrix.os }}-v2
46+
key: llvm-source-19-${{ matrix.os }}-v1
4747
path: |
4848
llvm-project/clang/lib/Headers
4949
llvm-project/clang/include
@@ -68,7 +68,7 @@ jobs:
6868
uses: actions/cache/restore@v4
6969
id: cache-llvm-build
7070
with:
71-
key: llvm-build-18-${{ matrix.os }}-v3
71+
key: llvm-build-19-${{ matrix.os }}-v1
7272
path: llvm-build
7373
- name: Build LLVM
7474
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -128,7 +128,7 @@ jobs:
128128
runs-on: macos-latest
129129
strategy:
130130
matrix:
131-
version: [16, 17, 18]
131+
version: [16, 17, 18, 19]
132132
steps:
133133
- name: Set up Homebrew
134134
uses: Homebrew/actions/setup-homebrew@master
@@ -152,8 +152,8 @@ jobs:
152152
- name: Check binary
153153
run: tinygo version
154154
- name: Build TinyGo (default LLVM)
155-
if: matrix.version == 18
155+
if: matrix.version == 19
156156
run: go install
157157
- name: Check binary
158-
if: matrix.version == 18
158+
if: matrix.version == 19
159159
run: tinygo version

.github/workflows/linux.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
uses: actions/cache/restore@v4
4444
id: cache-llvm-source
4545
with:
46-
key: llvm-source-18-linux-alpine-v1
46+
key: llvm-source-19-linux-alpine-v1
4747
path: |
4848
llvm-project/clang/lib/Headers
4949
llvm-project/clang/include
@@ -68,7 +68,7 @@ jobs:
6868
uses: actions/cache/restore@v4
6969
id: cache-llvm-build
7070
with:
71-
key: llvm-build-18-linux-alpine-v2
71+
key: llvm-build-19-linux-alpine-v1
7272
path: llvm-build
7373
- name: Build LLVM
7474
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -200,7 +200,7 @@ jobs:
200200
uses: actions/cache/restore@v4
201201
id: cache-llvm-source
202202
with:
203-
key: llvm-source-18-linux-asserts-v1
203+
key: llvm-source-19-linux-asserts-v1
204204
path: |
205205
llvm-project/clang/lib/Headers
206206
llvm-project/clang/include
@@ -225,7 +225,7 @@ jobs:
225225
uses: actions/cache/restore@v4
226226
id: cache-llvm-build
227227
with:
228-
key: llvm-build-18-linux-asserts-v2
228+
key: llvm-build-19-linux-asserts-v1
229229
path: llvm-build
230230
- name: Build LLVM
231231
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -313,7 +313,7 @@ jobs:
313313
uses: actions/cache/restore@v4
314314
id: cache-llvm-source
315315
with:
316-
key: llvm-source-18-linux-v1
316+
key: llvm-source-19-linux-v1
317317
path: |
318318
llvm-project/clang/lib/Headers
319319
llvm-project/clang/include
@@ -338,7 +338,7 @@ jobs:
338338
uses: actions/cache/restore@v4
339339
id: cache-llvm-build
340340
with:
341-
key: llvm-build-18-linux-${{ matrix.goarch }}-v2
341+
key: llvm-build-19-linux-${{ matrix.goarch }}-v2
342342
path: llvm-build
343343
- name: Build LLVM
344344
if: steps.cache-llvm-build.outputs.cache-hit != 'true'

.github/workflows/llvm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ jobs:
3535
uses: docker/metadata-action@v5
3636
with:
3737
images: |
38-
tinygo/llvm-18
39-
ghcr.io/${{ github.repository_owner }}/llvm-18
38+
tinygo/llvm-19
39+
ghcr.io/${{ github.repository_owner }}/llvm-19
4040
tags: |
4141
type=sha,format=long
4242
type=raw,value=latest

.github/workflows/nix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: actions/cache/restore@v4
2525
id: cache-llvm-source
2626
with:
27-
key: llvm-source-18-linux-nix-v1
27+
key: llvm-source-19-linux-nix-v1
2828
path: |
2929
llvm-project/compiler-rt
3030
- name: Download LLVM source

.github/workflows/sizediff-install-pkgs.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
# still works after checking out the dev branch (that is, when going from LLVM
33
# 16 to LLVM 17 for example, both Clang 16 and Clang 17 are installed).
44

5-
echo 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-18 main' | sudo tee /etc/apt/sources.list.d/llvm.list
5+
echo 'deb https://apt.llvm.org/noble/ llvm-toolchain-noble-19 main' | sudo tee /etc/apt/sources.list.d/llvm.list
66
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
77
sudo apt-get update
88
sudo apt-get install --no-install-recommends -y \
9-
llvm-18-dev \
10-
clang-18 \
11-
libclang-18-dev \
12-
lld-18
9+
llvm-19-dev \
10+
clang-19 \
11+
libclang-19-dev \
12+
lld-19

.github/workflows/sizediff.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ jobs:
1414
runs-on: ubuntu-24.04
1515
permissions:
1616
pull-requests: write
17+
env:
18+
# Hack to work around https://github.com/llvm/llvm-project/issues/105987
19+
LD_LIBRARY_PATH: /usr/lib/llvm-19/lib
1720
steps:
1821
# Prepare, install tools
1922
- name: Add GOBIN to $PATH
@@ -30,7 +33,7 @@ jobs:
3033
uses: actions/cache@v4
3134
id: cache-llvm-source
3235
with:
33-
key: llvm-source-18-sizediff-v1
36+
key: llvm-source-19-sizediff-v1
3437
path: |
3538
llvm-project/compiler-rt
3639
- name: Download LLVM source

.github/workflows/windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
uses: actions/cache/restore@v4
4242
id: cache-llvm-source
4343
with:
44-
key: llvm-source-18-windows-v1
44+
key: llvm-source-19-windows-v1
4545
path: |
4646
llvm-project/clang/lib/Headers
4747
llvm-project/clang/include
@@ -66,7 +66,7 @@ jobs:
6666
uses: actions/cache/restore@v4
6767
id: cache-llvm-build
6868
with:
69-
key: llvm-build-18-windows-v2
69+
key: llvm-build-19-windows-v1
7070
path: llvm-build
7171
- name: Build LLVM
7272
if: steps.cache-llvm-build.outputs.cache-hit != 'true'

GNUmakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ LLD_SRC ?= $(LLVM_PROJECTDIR)/lld
1010

1111
# Try to autodetect LLVM build tools.
1212
# Versions are listed here in descending priority order.
13-
LLVM_VERSIONS = 18 17 16 15
13+
LLVM_VERSIONS = 19 18 17 16 15
1414
errifempty = $(if $(1),$(1),$(error $(2)))
1515
detect = $(shell which $(call errifempty,$(firstword $(foreach p,$(2),$(shell command -v $(p) 2> /dev/null && echo $(p)))),failed to locate $(1) at any of: $(2)))
1616
toolSearchPathsVersion = $(1)-$(2)
@@ -147,7 +147,7 @@ endif
147147
MD5SUM ?= md5sum
148148

149149
# Libraries that should be linked in for the statically linked Clang.
150-
CLANG_LIB_NAMES = clangAnalysis clangAPINotes clangAST clangASTMatchers clangBasic clangCodeGen clangCrossTU clangDriver clangDynamicASTMatchers clangEdit clangExtractAPI clangFormat clangFrontend clangFrontendTool clangHandleCXX clangHandleLLVM clangIndex clangLex clangParse clangRewrite clangRewriteFrontend clangSema clangSerialization clangSupport clangTooling clangToolingASTDiff clangToolingCore clangToolingInclusions
150+
CLANG_LIB_NAMES = clangAnalysis clangAPINotes clangAST clangASTMatchers clangBasic clangCodeGen clangCrossTU clangDriver clangDynamicASTMatchers clangEdit clangExtractAPI clangFormat clangFrontend clangFrontendTool clangHandleCXX clangHandleLLVM clangIndex clangInstallAPI clangLex clangParse clangRewrite clangRewriteFrontend clangSema clangSerialization clangSupport clangTooling clangToolingASTDiff clangToolingCore clangToolingInclusions
151151
CLANG_LIBS = $(START_GROUP) $(addprefix -l,$(CLANG_LIB_NAMES)) $(END_GROUP) -lstdc++
152152

153153
# Libraries that should be linked in for the statically linked LLD.
@@ -238,7 +238,7 @@ gen-device-renesas: build/gen-device-svd
238238
GO111MODULE=off $(GO) fmt ./src/device/renesas
239239

240240
$(LLVM_PROJECTDIR)/llvm:
241-
git clone -b tinygo_xtensa_release_18.1.2 --depth=1 https://github.com/tinygo-org/llvm-project $(LLVM_PROJECTDIR)
241+
git clone -b llvmorg-19.1.0-rc3 --depth=1 https://github.com/llvm/llvm-project $(LLVM_PROJECTDIR)
242242
llvm-source: $(LLVM_PROJECTDIR)/llvm ## Get LLVM sources
243243

244244
# Configure LLVM.

builder/builder_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ func TestClangAttributes(t *testing.T) {
3838
"wasm",
3939
"wasm-unknown",
4040
}
41-
if hasBuiltinTools {
41+
// TODO: remove this version check.
42+
if hasBuiltinTools && llvm.Version != "19.1.0-rc3" {
4243
// hasBuiltinTools is set when TinyGo is statically linked with LLVM,
4344
// which also implies it was built with Xtensa support.
4445
targetNames = append(targetNames, "esp32", "esp8266")

0 commit comments

Comments
 (0)