Skip to content

Commit 9e9768b

Browse files
aykevldeadprogram
authored andcommitted
all: add support for LLVM 19
1 parent 127557d commit 9e9768b

Some content is hidden

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

52 files changed

+247
-213
lines changed

Diff for: .circleci/config.yml

+6-6
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
@@ -109,12 +109,12 @@ jobs:
109109
# "make lint" fails before go 1.21 because internal/tools/go.mod specifies packages that require go 1.21
110110
fmt-check: false
111111
resource_class: large
112-
test-llvm18-go123:
112+
test-llvm19-go123:
113113
docker:
114114
- image: golang:1.23-bullseye
115115
steps:
116116
- test-linux:
117-
llvm: "18"
117+
llvm: "19"
118118
resource_class: large
119119

120120
workflows:
@@ -123,5 +123,5 @@ workflows:
123123
# This tests our lowest supported versions of Go and LLVM, to make sure at
124124
# least the smoke tests still pass.
125125
- test-llvm15-go119
126-
# This tests LLVM 18 support when linking against system libraries.
127-
- test-llvm18-go123
126+
# This tests LLVM 19 support when linking against system libraries.
127+
- test-llvm19-go123

Diff for: .github/workflows/build-macos.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
uses: actions/cache/restore@v4
4646
id: cache-llvm-source
4747
with:
48-
key: llvm-source-18-${{ matrix.os }}-v2
48+
key: llvm-source-19-${{ matrix.os }}-v1
4949
path: |
5050
llvm-project/clang/lib/Headers
5151
llvm-project/clang/include
@@ -70,7 +70,7 @@ jobs:
7070
uses: actions/cache/restore@v4
7171
id: cache-llvm-build
7272
with:
73-
key: llvm-build-18-${{ matrix.os }}-v3
73+
key: llvm-build-19-${{ matrix.os }}-v1
7474
path: llvm-build
7575
- name: Build LLVM
7676
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -126,7 +126,7 @@ jobs:
126126
runs-on: macos-latest
127127
strategy:
128128
matrix:
129-
version: [16, 17, 18]
129+
version: [16, 17, 18, 19]
130130
steps:
131131
- name: Set up Homebrew
132132
uses: Homebrew/actions/setup-homebrew@master
@@ -150,8 +150,8 @@ jobs:
150150
- name: Check binary
151151
run: tinygo version
152152
- name: Build TinyGo (default LLVM)
153-
if: matrix.version == 18
153+
if: matrix.version == 19
154154
run: go install
155155
- name: Check binary
156-
if: matrix.version == 18
156+
if: matrix.version == 19
157157
run: tinygo version

Diff for: .github/workflows/linux.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
uses: actions/cache/restore@v4
4949
id: cache-llvm-source
5050
with:
51-
key: llvm-source-18-linux-alpine-v1
51+
key: llvm-source-19-linux-alpine-v1
5252
path: |
5353
llvm-project/clang/lib/Headers
5454
llvm-project/clang/include
@@ -73,7 +73,7 @@ jobs:
7373
uses: actions/cache/restore@v4
7474
id: cache-llvm-build
7575
with:
76-
key: llvm-build-18-linux-alpine-v2
76+
key: llvm-build-19-linux-alpine-v1
7777
path: llvm-build
7878
- name: Build LLVM
7979
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -205,7 +205,7 @@ jobs:
205205
uses: actions/cache/restore@v4
206206
id: cache-llvm-source
207207
with:
208-
key: llvm-source-18-linux-asserts-v1
208+
key: llvm-source-19-linux-asserts-v1
209209
path: |
210210
llvm-project/clang/lib/Headers
211211
llvm-project/clang/include
@@ -230,7 +230,7 @@ jobs:
230230
uses: actions/cache/restore@v4
231231
id: cache-llvm-build
232232
with:
233-
key: llvm-build-18-linux-asserts-v2
233+
key: llvm-build-19-linux-asserts-v1
234234
path: llvm-build
235235
- name: Build LLVM
236236
if: steps.cache-llvm-build.outputs.cache-hit != 'true'
@@ -321,7 +321,7 @@ jobs:
321321
uses: actions/cache/restore@v4
322322
id: cache-llvm-source
323323
with:
324-
key: llvm-source-18-linux-v1
324+
key: llvm-source-19-linux-v1
325325
path: |
326326
llvm-project/clang/lib/Headers
327327
llvm-project/clang/include
@@ -346,7 +346,7 @@ jobs:
346346
uses: actions/cache/restore@v4
347347
id: cache-llvm-build
348348
with:
349-
key: llvm-build-18-linux-${{ matrix.goarch }}-v2
349+
key: llvm-build-19-linux-${{ matrix.goarch }}-v2
350350
path: llvm-build
351351
- name: Build LLVM
352352
if: steps.cache-llvm-build.outputs.cache-hit != 'true'

Diff for: .github/workflows/llvm.yml

+2-2
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

Diff for: .github/workflows/nix.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/cache/restore@v4
3030
id: cache-llvm-source
3131
with:
32-
key: llvm-source-18-linux-nix-v1
32+
key: llvm-source-19-linux-nix-v1
3333
path: |
3434
llvm-project/compiler-rt
3535
- name: Download LLVM source

Diff for: .github/workflows/sizediff-install-pkgs.sh

+5-5
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

Diff for: .github/workflows/sizediff.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
uses: actions/cache@v4
3131
id: cache-llvm-source
3232
with:
33-
key: llvm-source-18-sizediff-v1
33+
key: llvm-source-19-sizediff-v1
3434
path: |
3535
llvm-project/compiler-rt
3636
- name: Download LLVM source

Diff for: .github/workflows/windows.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/cache/restore@v4
4848
id: cache-llvm-source
4949
with:
50-
key: llvm-source-18-windows-v1
50+
key: llvm-source-19-windows-v1
5151
path: |
5252
llvm-project/clang/lib/Headers
5353
llvm-project/clang/include
@@ -72,7 +72,7 @@ jobs:
7272
uses: actions/cache/restore@v4
7373
id: cache-llvm-build
7474
with:
75-
key: llvm-build-18-windows-v2
75+
key: llvm-build-19-windows-v1
7676
path: llvm-build
7777
- name: Build LLVM
7878
if: steps.cache-llvm-build.outputs.cache-hit != 'true'

Diff for: GNUmakefile

+3-3
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 xtensa_release_19.1.2 --depth=1 https://github.com/espressif/llvm-project $(LLVM_PROJECTDIR)
242242
llvm-source: $(LLVM_PROJECTDIR)/llvm ## Get LLVM sources
243243

244244
# Configure LLVM.

Diff for: builder/cc1as.cpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
145145
}
146146

147147
Opts.RelaxELFRelocations = !Args.hasArg(OPT_mrelax_relocations_no);
148+
Opts.SSE2AVX = Args.hasArg(OPT_msse2avx);
148149
if (auto *DwarfFormatArg = Args.getLastArg(OPT_gdwarf64, OPT_gdwarf32))
149150
Opts.Dwarf64 = DwarfFormatArg->getOption().matches(OPT_gdwarf64);
150151
Opts.DwarfVersion = getLastArgIntValue(Args, OPT_dwarf_version_EQ, 2, Diags);
@@ -234,6 +235,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
234235

235236
Opts.EmitCompactUnwindNonCanonical =
236237
Args.hasArg(OPT_femit_compact_unwind_non_canonical);
238+
Opts.Crel = Args.hasArg(OPT_crel);
237239

238240
Opts.AsSecureLogFile = Args.getLastArgValue(OPT_as_secure_log_file);
239241

@@ -287,8 +289,14 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
287289
assert(MRI && "Unable to create target register info!");
288290

289291
MCTargetOptions MCOptions;
292+
MCOptions.MCRelaxAll = Opts.RelaxAll;
290293
MCOptions.EmitDwarfUnwind = Opts.EmitDwarfUnwind;
291294
MCOptions.EmitCompactUnwindNonCanonical = Opts.EmitCompactUnwindNonCanonical;
295+
MCOptions.MCSaveTempLabels = Opts.SaveTemporaryLabels;
296+
MCOptions.Crel = Opts.Crel;
297+
MCOptions.X86RelaxRelocations = Opts.RelaxELFRelocations;
298+
MCOptions.X86Sse2Avx = Opts.SSE2AVX;
299+
MCOptions.CompressDebugSections = Opts.CompressDebugSections;
292300
MCOptions.AsSecureLogFile = Opts.AsSecureLogFile;
293301

294302
std::unique_ptr<MCAsmInfo> MAI(
@@ -297,9 +305,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
297305

298306
// Ensure MCAsmInfo initialization occurs before any use, otherwise sections
299307
// may be created with a combination of default and explicit settings.
300-
MAI->setCompressDebugSections(Opts.CompressDebugSections);
301308

302-
MAI->setRelaxELFRelocations(Opts.RelaxELFRelocations);
303309

304310
bool IsBinary = Opts.OutputType == AssemblerInvocation::FT_Obj;
305311
if (Opts.OutputPath.empty())
@@ -343,8 +349,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
343349
MOFI->setDarwinTargetVariantSDKVersion(Opts.DarwinTargetVariantSDKVersion);
344350
Ctx.setObjectFileInfo(MOFI.get());
345351

346-
if (Opts.SaveTemporaryLabels)
347-
Ctx.setAllowTemporaryLabels(false);
348352
if (Opts.GenDwarfForAssembly)
349353
Ctx.setGenDwarfForAssembly(true);
350354
if (!Opts.DwarfDebugFlags.empty())
@@ -381,6 +385,9 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
381385
MCOptions.MCNoWarn = Opts.NoWarn;
382386
MCOptions.MCFatalWarnings = Opts.FatalWarnings;
383387
MCOptions.MCNoTypeCheck = Opts.NoTypeCheck;
388+
MCOptions.ShowMCInst = Opts.ShowInst;
389+
MCOptions.AsmVerbose = true;
390+
MCOptions.MCUseDwarfDirectory = MCTargetOptions::EnableDwarfDirectory;
384391
MCOptions.ABIName = Opts.TargetABI;
385392

386393
// FIXME: There is a bit of code duplication with addPassesToEmitFile.
@@ -395,10 +402,8 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
395402
TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
396403

397404
auto FOut = std::make_unique<formatted_raw_ostream>(*Out);
398-
Str.reset(TheTarget->createAsmStreamer(
399-
Ctx, std::move(FOut), /*asmverbose*/ true,
400-
/*useDwarfDirectory*/ true, IP, std::move(CE), std::move(MAB),
401-
Opts.ShowInst));
405+
Str.reset(TheTarget->createAsmStreamer(Ctx, std::move(FOut), IP,
406+
std::move(CE), std::move(MAB)));
402407
} else if (Opts.OutputType == AssemblerInvocation::FT_Null) {
403408
Str.reset(createNullStreamer(Ctx));
404409
} else {
@@ -421,9 +426,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
421426

422427
Triple T(Opts.Triple);
423428
Str.reset(TheTarget->createMCObjectStreamer(
424-
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI,
425-
Opts.RelaxAll, Opts.IncrementalLinkerCompatible,
426-
/*DWARFMustBeAtTheEnd*/ true));
429+
T, Ctx, std::move(MAB), std::move(OW), std::move(CE), *STI));
427430
Str.get()->initSections(Opts.NoExecStack, *STI);
428431
}
429432

@@ -436,9 +439,6 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts,
436439
Str.get()->emitZeros(1);
437440
}
438441

439-
// Assembly to object compilation should leverage assembly info.
440-
Str->setUseAssemblerInfoForParsing(true);
441-
442442
bool Failed = false;
443443

444444
std::unique_ptr<MCAsmParser> Parser(

0 commit comments

Comments
 (0)