Skip to content

Commit d145747

Browse files
LLVM 20 bump
1 parent 1ebd726 commit d145747

File tree

6 files changed

+19
-35
lines changed

6 files changed

+19
-35
lines changed

.github/workflows/jit.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- true
6969
- false
7070
llvm:
71-
- 19
71+
- 20
7272
include:
7373
- target: i686-pc-windows-msvc/msvc
7474
architecture: Win32
@@ -99,10 +99,10 @@ jobs:
9999
with:
100100
python-version: '3.11'
101101

102-
# PCbuild downloads LLVM automatically:
103102
- name: Windows
104103
if: runner.os == 'Windows'
105104
run: |
105+
choco install llvm --allow-downgrade --no-progress --version ${{ matrix.llvm }}.1.8
106106
./PCbuild/build.bat --experimental-jit ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }}
107107
./PCbuild/rt.bat ${{ matrix.debug && '-d' || '' }} -p ${{ matrix.architecture }} -q --multiprocess 0 --timeout 4500 --verbose2 --verbose3
108108
@@ -143,7 +143,7 @@ jobs:
143143
fail-fast: false
144144
matrix:
145145
llvm:
146-
- 19
146+
- 20
147147
steps:
148148
- uses: actions/checkout@v4
149149
with:
@@ -171,7 +171,7 @@ jobs:
171171
# fail-fast: false
172172
# matrix:
173173
# llvm:
174-
# - 19
174+
# - 20
175175
# steps:
176176
# - uses: actions/checkout@v4
177177
# with:

PCbuild/build.bat

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ if "%IncludeExternals%"=="" set IncludeExternals=true
111111
if "%IncludeCTypes%"=="" set IncludeCTypes=true
112112
if "%IncludeSSL%"=="" set IncludeSSL=true
113113
if "%IncludeTkinter%"=="" set IncludeTkinter=true
114-
if "%UseJIT%" NEQ "true" set IncludeLLVM=false
115114

116115
if "%IncludeExternals%"=="true" call "%dir%get_externals.bat"
117116

PCbuild/get_externals.bat

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ set IncludeSSLSrc=false
1515
if "%~1"=="--no-tkinter" (set IncludeTkinter=false) & shift & goto CheckOpts
1616
if "%~1"=="--no-openssl" (set IncludeSSL=false) & shift & goto CheckOpts
1717
if "%~1"=="--no-libffi" (set IncludeLibffi=false) & shift & goto CheckOpts
18-
if "%~1"=="--no-llvm" (set IncludeLLVM=false) & shift & goto CheckOpts
1918
if "%~1"=="--tkinter-src" (set IncludeTkinterSrc=true) & shift & goto CheckOpts
2019
if "%~1"=="--openssl-src" (set IncludeSSLSrc=true) & shift & goto CheckOpts
2120
if "%~1"=="--libffi-src" (set IncludeLibffiSrc=true) & shift & goto CheckOpts
@@ -82,7 +81,6 @@ if NOT "%IncludeLibffi%"=="false" set binaries=%binaries% libffi-3.4.4
8281
if NOT "%IncludeSSL%"=="false" set binaries=%binaries% openssl-bin-3.0.16.2
8382
if NOT "%IncludeTkinter%"=="false" set binaries=%binaries% tcltk-8.6.15.0
8483
if NOT "%IncludeSSLSrc%"=="false" set binaries=%binaries% nasm-2.11.06
85-
if NOT "%IncludeLLVM%"=="false" set binaries=%binaries% llvm-19.1.7.0
8684

8785
for %%b in (%binaries%) do (
8886
if exist "%EXTERNALS_DIR%\%%b" (
@@ -101,7 +99,7 @@ goto end
10199

102100
:usage
103101
echo.Valid options: -c, --clean, --clean-only, --organization, --python,
104-
echo.--no-tkinter, --no-openssl, --no-llvm
102+
echo.--no-tkinter, --no-openssl
105103
echo.
106104
echo.Pull all sources and binaries necessary for compiling optional extension
107105
echo.modules that rely on external libraries.

Tools/jit/README.md

Lines changed: 9 additions & 9 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 19 is required. 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 20 is required. Both `clang` and `llvm-readobj` need to be installed and discoverable (version suffixes, like `clang-20`, 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 19 on Ubuntu/Debian:
18+
Install LLVM 20 on Ubuntu/Debian:
1919

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

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

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

3232
### macOS
3333

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

3636
```sh
37-
brew install llvm@19
37+
brew install llvm@20
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,12 +43,12 @@ 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 19 [by searching for it on LLVM's GitHub releases page](https://github.com/llvm/llvm-project/releases?q=19), 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 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".**
4747

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

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

5454

Tools/jit/_llvm.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@
88
import subprocess
99
import typing
1010

11-
import _targets
12-
13-
_LLVM_VERSION = 19
11+
_LLVM_VERSION = 20
1412
_LLVM_VERSION_PATTERN = re.compile(rf"version\s+{_LLVM_VERSION}\.\d+\.\d+\S*\s+")
15-
_EXTERNALS_LLVM_TAG = "llvm-19.1.7.0"
1613

1714
_P = typing.ParamSpec("_P")
1815
_R = typing.TypeVar("_R")
@@ -75,11 +72,6 @@ async def _find_tool(tool: str, *, echo: bool = False) -> str | None:
7572
return path
7673
# Versioned executables:
7774
path = f"{tool}-{_LLVM_VERSION}"
78-
if await _check_tool_version(path, echo=echo):
79-
return path
80-
# PCbuild externals:
81-
externals = os.environ.get("EXTERNALS_DIR", _targets.EXTERNALS)
82-
path = os.path.join(externals, _EXTERNALS_LLVM_TAG, "bin", tool)
8375
if await _check_tool_version(path, echo=echo):
8476
return path
8577
# Homebrew-installed executables:

Tools/jit/_targets.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
TOOLS_JIT = TOOLS_JIT_BUILD.parent
2626
TOOLS = TOOLS_JIT.parent
2727
CPYTHON = TOOLS.parent
28-
EXTERNALS = CPYTHON / "externals"
2928
PYTHON_EXECUTOR_CASES_C_H = CPYTHON / "Python" / "executor_cases.c.h"
3029
TOOLS_JIT_TEMPLATE_C = TOOLS_JIT / "template.c"
3130

@@ -161,10 +160,6 @@ async def _compile(
161160
"-fno-asynchronous-unwind-tables",
162161
# Don't call built-in functions that we can't find or patch:
163162
"-fno-builtin",
164-
# Emit relaxable 64-bit calls/jumps, so we don't have to worry about
165-
# about emitting in-range trampolines for out-of-range targets.
166-
# We can probably remove this and emit trampolines in the future:
167-
"-fno-plt",
168163
# Don't call stack-smashing canaries that we can't find or patch:
169164
"-fno-stack-protector",
170165
"-std=c11",
@@ -561,13 +556,13 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO:
561556
target = _COFF64(host, condition, args=args, optimizer=optimizer)
562557
elif re.fullmatch(r"aarch64-.*-linux-gnu", host):
563558
# -mno-outline-atomics: Keep intrinsics from being emitted.
564-
args = ["-fpic", "-mno-outline-atomics"]
559+
args = ["-fpic", "-mno-outline-atomics", "-fno-plt"]
565560
condition = "defined(__aarch64__) && defined(__linux__)"
566561
optimizer = _optimizers.OptimizerAArch64
567562
target = _ELF(host, condition, args=args, optimizer=optimizer)
568563
elif re.fullmatch(r"i686-pc-windows-msvc", host):
569564
# -Wno-ignored-attributes: __attribute__((preserve_none)) is not supported here.
570-
args = ["-DPy_NO_ENABLE_SHARED", "-Wno-ignored-attributes"]
565+
args = ["-DPy_NO_ENABLE_SHARED", "-Wno-ignored-attributes", "-fno-plt"]
571566
optimizer = _optimizers.OptimizerX86
572567
condition = "defined(_M_IX86)"
573568
target = _COFF32(host, condition, args=args, optimizer=optimizer)
@@ -576,12 +571,12 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO:
576571
optimizer = _optimizers.OptimizerX86
577572
target = _MachO(host, condition, optimizer=optimizer)
578573
elif re.fullmatch(r"x86_64-pc-windows-msvc", host):
579-
args = ["-fms-runtime-lib=dll"]
574+
args = ["-fms-runtime-lib=dll", "-fno-plt"]
580575
condition = "defined(_M_X64)"
581576
optimizer = _optimizers.OptimizerX86
582577
target = _COFF64(host, condition, args=args, optimizer=optimizer)
583578
elif re.fullmatch(r"x86_64-.*-linux-gnu", host):
584-
args = ["-fno-pic", "-mcmodel=medium", "-mlarge-data-threshold=0"]
579+
args = ["-fno-pic", "-mcmodel=medium", "-mlarge-data-threshold=0", "-fno-plt"]
585580
condition = "defined(__x86_64__) && defined(__linux__)"
586581
optimizer = _optimizers.OptimizerX86
587582
target = _ELF(host, condition, args=args, optimizer=optimizer)

0 commit comments

Comments
 (0)