Skip to content

Commit b6c50f4

Browse files
committed
GH-136895: Update JIT builds to use LLVM 21
Bump the JIT toolchain from LLVM 20 to LLVM 21 (21.1.8). Updated across CI workflows, build scripts, documentation, and the externals tag.
1 parent ecc3408 commit b6c50f4

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

.github/workflows/jit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ concurrency:
2121

2222
env:
2323
FORCE_COLOR: 1
24-
LLVM_VERSION: 20
24+
LLVM_VERSION: 21
2525

2626
jobs:
2727
interpreter:

.github/workflows/tail-call.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ concurrency:
2020

2121
env:
2222
FORCE_COLOR: 1
23-
LLVM_VERSION: 20
23+
LLVM_VERSION: 21
2424

2525
jobs:
2626
windows:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Update JIT compilation to use LLVM 20 at build time.
1+
Update JIT compilation to use LLVM 21 at build time.

PCbuild/get_externals.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi-3.4.4
8282
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-3.0.19
8383
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.15.0
8484
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
85-
if NOT "%IncludeLLVM%"=="false" set binaries=%binaries% llvm-20.1.8.0
85+
if NOT "%IncludeLLVM%"=="false" set binaries=%binaries% llvm-21.1.8.0
8686

8787
for %%b in (%binaries%) do (
8888
if exist "%EXTERNALS_DIR%\%%b" (

Python/jit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ void patch_x86_64_trampoline(unsigned char *location, int ordinal, jit_state *st
428428
#define DATA_ALIGN 8
429429
#elif defined(__x86_64__) || defined(_M_X64)
430430
// x86_64 trampolines: 14 bytes (jmp *(%rip) + 8-byte addr) + 2 bytes padding.
431-
// Currently used on macOS where LLVM 20 GOT entries may exceed ±2GB
431+
// Currently used on macOS where LLVM 21 GOT entries may exceed ±2GB
432432
// PC-relative range, but enabled on all x86_64 platforms defensively.
433433
#define TRAMPOLINE_SIZE 16
434434
#define DATA_ALIGN 8

Tools/jit/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,32 @@ Python 3.11 or newer is required to build the JIT.
99

1010
The JIT compiler does not require end users to install any third-party dependencies, but part of it must be *built* using LLVM[^why-llvm]. You are *not* required to build the rest of CPython using LLVM, or even the same version of LLVM (in fact, this is uncommon).
1111

12-
LLVM version 20 is the officially supported version. You can modify if needed using the `LLVM_VERSION` env var during configure. Both `clang` and `llvm-readobj` need to be installed and discoverable (version suffixes, like `clang-19`, are okay). It's highly recommended that you also have `llvm-objdump` available, since this allows the build script to dump human-readable assembly for the generated code.
12+
LLVM version 21 is the officially supported version. You can modify if needed using the `LLVM_VERSION` env var during configure. Both `clang` and `llvm-readobj` need to be installed and discoverable (version suffixes, like `clang-21`, are okay). It's highly recommended that you also have `llvm-objdump` available, since this allows the build script to dump human-readable assembly for the generated code.
1313

1414
It's easy to install all of the required tools:
1515

1616
### Linux
1717

18-
Install LLVM 20 on Ubuntu/Debian:
18+
Install LLVM 21 on Ubuntu/Debian:
1919

2020
```sh
2121
wget https://apt.llvm.org/llvm.sh
2222
chmod +x llvm.sh
23-
sudo ./llvm.sh 20
23+
sudo ./llvm.sh 21
2424
```
2525

26-
Install LLVM 20 on Fedora Linux 40 or newer:
26+
Install LLVM 21 on Fedora Linux 40 or newer:
2727

2828
```sh
29-
sudo dnf install 'clang(major) = 20' 'llvm(major) = 20'
29+
sudo dnf install 'clang(major) = 21' 'llvm(major) = 21'
3030
```
3131

3232
### macOS
3333

34-
Install LLVM 20 with [Homebrew](https://brew.sh):
34+
Install LLVM 21 with [Homebrew](https://brew.sh):
3535

3636
```sh
37-
brew install llvm@20
37+
brew install llvm@21
3838
```
3939

4040
Homebrew won't add any of the tools to your `$PATH`. That's okay; the build script knows how to find them.
@@ -43,18 +43,18 @@ Homebrew won't add any of the tools to your `$PATH`. That's okay; the build scri
4343

4444
LLVM is downloaded automatically (along with other external binary dependencies) by `PCbuild\build.bat`.
4545

46-
Otherwise, you can install LLVM 20 [by searching for it on LLVM's GitHub releases page](https://github.com/llvm/llvm-project/releases?q=20), clicking on "Assets", downloading the appropriate Windows installer for your platform (likely the file ending with `-win64.exe`), and running it. **When installing, be sure to select the option labeled "Add LLVM to the system PATH".**
46+
Otherwise, you can install LLVM 21 [by searching for it on LLVM's GitHub releases page](https://github.com/llvm/llvm-project/releases?q=21), clicking on "Assets", downloading the appropriate Windows installer for your platform (likely the file ending with `-win64.exe`), and running it. **When installing, be sure to select the option labeled "Add LLVM to the system PATH".**
4747

4848
Alternatively, you can use [chocolatey](https://chocolatey.org):
4949

5050
```sh
51-
choco install llvm --version=20.1.8
51+
choco install llvm --version=21.1.8
5252
```
5353

5454
### Dev Containers
5555

5656
If you are working on CPython in a [Codespaces instance](https://devguide.python.org/getting-started/setup-building/#using-codespaces), there's no
57-
need to install LLVM as the Fedora 42 base image includes LLVM 20 out of the box.
57+
need to install LLVM as the Fedora 42 base image includes LLVM 21 out of the box.
5858

5959
## Building
6060

Tools/jit/_llvm.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010

1111
import _targets
1212

13-
_LLVM_VERSION = 20
13+
_LLVM_VERSION = 21
1414
_LLVM_VERSION_PATTERN = re.compile(rf"version\s+{_LLVM_VERSION}\.\d+\.\d+\S*\s+")
15-
_EXTERNALS_LLVM_TAG = "llvm-20.1.8.0"
15+
_EXTERNALS_LLVM_TAG = "llvm-21.1.8.0"
1616

1717
_P = typing.ParamSpec("_P")
1818
_R = typing.TypeVar("_R")

0 commit comments

Comments
 (0)