From eabcb3f52a8cc483ac27c1ad2bc1309f60114f2f Mon Sep 17 00:00:00 2001 From: "Jonathan J. Helmus" Date: Fri, 25 Sep 2026 18:35:37 -0500 Subject: [PATCH 1/5] LLVM 23.1.2 * LLVM 22.1.3 -> 23.1.2 LLVM toolchain is now built using a sysroot to target older glibc versions rather than using an older base Debian image. The toolchain includes lld. See https://github.com/astral-sh/llvm-build for details. --- pythonbuild/downloads.json | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pythonbuild/downloads.json b/pythonbuild/downloads.json index 4d19a1579..65d48106c 100644 --- a/pythonbuild/downloads.json +++ b/pythonbuild/downloads.json @@ -213,22 +213,22 @@ "version": "7.0.12-2~bpo13+1" }, "llvm-aarch64-linux": { - "url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20260410/llvm-22.1.3+20260410-gnu_only-aarch64-unknown-linux-gnu.tar.zst", - "size": 237655768, - "sha256": "9cb4b562323a3d899fffe6393148e92447e17b69a2501d7c6e7f2a86c32cddc1", - "version": "22.1.3+20260410" + "url": "https://github.com/astral-sh/llvm-build/releases/download/20260925/llvm-23.1.2+20260925-gnu_only-aarch64-unknown-linux-gnu.tar.zst", + "size": 219511882, + "sha256": "fe4dc64a553ada62fdbd732234cc6db4bab60c8516f9ea520c4abea7b646c900", + "version": "23.1.2+20260925" }, "llvm-x86_64-linux": { - "url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20260410/llvm-22.1.3+20260410-gnu_only-x86_64-unknown-linux-gnu.tar.zst", - "size": 281109065, - "sha256": "0ee8e4f89c20983d62547b1e665147ee08a7413f478e9e443fa991548da1030d", - "version": "22.1.3+20260410" + "url": "https://github.com/astral-sh/llvm-build/releases/download/20260925/llvm-23.1.2+20260925-gnu_only-x86_64-unknown-linux-gnu.tar.zst", + "size": 227890333, + "sha256": "96ea5dcf7663787984f44b3cff25259b0a8cf7cce615331102144cbdde833f9f", + "version": "23.1.2+20260925" }, "llvm-aarch64-macos": { - "url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20260410/llvm-22.1.3+20260410-aarch64-apple-darwin.tar.zst", - "size": 159775425, - "sha256": "98171836c31c04edec074e5f3fee67fcace4bf3859b68a770dd9ff2039ea127d", - "version": "22.1.3+20260410" + "url": "https://github.com/astral-sh/llvm-build/releases/download/20260925/llvm-23.1.2+20260925-aarch64-apple-darwin.tar.zst", + "size": 165484624, + "sha256": "2adaeff353a29e60f92a16c9eae603dbbdc9613c04ad6c0fac9a5c4a40dd7eb0", + "version": "23.1.2+20260925" }, "llvm-x86_64-macos": { "url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20260410/llvm-22.1.3+20260410-x86_64-apple-darwin.tar.zst", From 852dda58a0039d619b14b69c8f293c5c72f09623 Mon Sep 17 00:00:00 2001 From: "Jonathan J. Helmus" Date: Fri, 25 Sep 2026 19:02:40 -0500 Subject: [PATCH 2/5] Disable building on x86-64 macOS LLVM 23 is not provided for this platform. Rather than using an older LLVM release this architecture should be cross-compiled on a aarch64 macOS host. --- cpython-unix/targets.yml | 2 -- pythonbuild/downloads.json | 6 ------ pythonbuild/utils.py | 8 +++----- scripts/update_downloads.py | 1 - 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/cpython-unix/targets.yml b/cpython-unix/targets.yml index 9ebe96884..2088b3908 100644 --- a/cpython-unix/targets.yml +++ b/cpython-unix/targets.yml @@ -72,7 +72,6 @@ aarch64-apple-darwin: host_platforms: - macos_arm64 - - macos_x86_64 pythons_supported: - '3.10' - '3.11' @@ -636,7 +635,6 @@ s390x-unknown-linux-gnu: x86_64-apple-darwin: host_platforms: - macos_arm64 - - macos_x86_64 pythons_supported: - '3.10' - '3.11' diff --git a/pythonbuild/downloads.json b/pythonbuild/downloads.json index 65d48106c..9b0a1c127 100644 --- a/pythonbuild/downloads.json +++ b/pythonbuild/downloads.json @@ -230,12 +230,6 @@ "sha256": "2adaeff353a29e60f92a16c9eae603dbbdc9613c04ad6c0fac9a5c4a40dd7eb0", "version": "23.1.2+20260925" }, - "llvm-x86_64-macos": { - "url": "https://github.com/indygreg/toolchain-tools/releases/download/toolchain-bootstrap%2F20260410/llvm-22.1.3+20260410-x86_64-apple-darwin.tar.zst", - "size": 167376011, - "sha256": "15bfda1bc8bc920658c09ef1ebb4593f0705b3314beab23989f14775f2e3f3f0", - "version": "22.1.3+20260410" - }, "m4": { "upstream_url": "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.xz", "url": "https://astral-sh.github.io/mirror/files/m4-1.4.19.tar.xz", diff --git a/pythonbuild/utils.py b/pythonbuild/utils.py index a599925aa..ddda5205d 100644 --- a/pythonbuild/utils.py +++ b/pythonbuild/utils.py @@ -47,7 +47,9 @@ def current_host_platform() -> str: if machine == "arm64": return "macos_arm64" elif machine == "x86_64": - return "macos_x86_64" + raise Exception( + "macOS builds require an Apple Silicon host running native arm64 Python" + ) else: raise Exception(f"unhanded macOS machine type: {machine}") elif sys.platform == "win32": @@ -75,8 +77,6 @@ def default_target_triple() -> str: return "aarch64-unknown-linux-gnu" elif host == "macos_arm64": return "aarch64-apple-darwin" - elif host == "macos_x86_64": - return "x86_64-apple-darwin" elif host == "windows_x86": return "i686-pc-windows-msvc" elif host == "windows_x86_64": @@ -506,8 +506,6 @@ def clang_toolchain(host_platform: str, target_triple: str) -> str: return "llvm-aarch64-linux" elif host_platform == "macos_arm64": return "llvm-aarch64-macos" - elif host_platform == "macos_x86_64": - return "llvm-x86_64-macos" else: raise Exception("unhandled host platform") diff --git a/scripts/update_downloads.py b/scripts/update_downloads.py index 1708e521a..814ee4972 100644 --- a/scripts/update_downloads.py +++ b/scripts/update_downloads.py @@ -417,7 +417,6 @@ def xorg_policy(category: str, name: str, extension: str = "tar.gz") -> Policy: "llvm-aarch64-linux": "toolchain bootstrap requires coordinated updates", "llvm-x86_64-linux": "toolchain bootstrap requires coordinated updates", "llvm-aarch64-macos": "toolchain bootstrap requires coordinated updates", - "llvm-x86_64-macos": "toolchain bootstrap requires coordinated updates", "musl": "intentionally pinned build toolchain", "musl-static": "intentionally pinned build toolchain", "openssl-1.1": "end-of-life release series", From b55dbb6b80ccf8a35f1f617d2f25d122ea5ced9a Mon Sep 17 00:00:00 2001 From: "Jonathan J. Helmus" Date: Fri, 25 Sep 2026 18:37:38 -0500 Subject: [PATCH 3/5] update jit patches to account for LLVM 23 --- cpython-unix/patch-jit-llvm-version-3.13.patch | 2 +- cpython-unix/patch-jit-llvm-version-3.14.patch | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cpython-unix/patch-jit-llvm-version-3.13.patch b/cpython-unix/patch-jit-llvm-version-3.13.patch index f980855d7..5b484d949 100644 --- a/cpython-unix/patch-jit-llvm-version-3.13.patch +++ b/cpython-unix/patch-jit-llvm-version-3.13.patch @@ -7,7 +7,7 @@ index b68da1b6be1..cf04f83539e 100644 import typing -_LLVM_VERSION = 18 -+_LLVM_VERSION = 22 ++_LLVM_VERSION = int(os.environ.get("LLVM_VERSION", "18")) _LLVM_VERSION_PATTERN = re.compile( rf"(? Date: Fri, 25 Sep 2026 18:38:27 -0500 Subject: [PATCH 4/5] disable obj-c class selector stubs when building tk lld from LLVM 23 does not support these stubs that were added to Clang 23. --- cpython-unix/build-tk.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpython-unix/build-tk.sh b/cpython-unix/build-tk.sh index c60aab599..5dae32922 100755 --- a/cpython-unix/build-tk.sh +++ b/cpython-unix/build-tk.sh @@ -26,6 +26,13 @@ LDFLAGS="${EXTRA_TARGET_LDFLAGS}" if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then CFLAGS="${CFLAGS} -I${TOOLS_PATH}/deps/include -Wno-availability" CFLAGS="${CFLAGS} -Wno-deprecated-declarations -Wno-unknown-attributes -Wno-typedef-redefinition" + # Clang 23 emits Objective-C class selector stubs that ld64.lld cannot link. + # Probe the flag because older macOS toolchains do not recognize it. + # lld from LLVM 23 does not yet support theses stubs + # https://github.com/llvm/llvm-project/pull/219744 + if "${CC}" -fno-objc-msgsend-class-selector-stubs -x objective-c -fsyntax-only /dev/null >/dev/null 2>&1; then + CFLAGS="${CFLAGS} -fno-objc-msgsend-class-selector-stubs" + fi LDFLAGS="${LDFLAGS} -L${TOOLS_PATH}/deps/lib" EXTRA_CONFIGURE_FLAGS="--enable-aqua=yes --without-x" else From 85842d617aa71e4a606316680ba8237b0f7abfb2 Mon Sep 17 00:00:00 2001 From: "Jonathan J. Helmus" Date: Fri, 25 Sep 2026 18:39:38 -0500 Subject: [PATCH 5/5] disable tests which segfault when running bolt Disable tests from profiling that segfault when run under BOLT instrumentation. See: https://github.com/llvm/llvm-project/issues/225479 --- cpython-unix/build-cpython.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cpython-unix/build-cpython.sh b/cpython-unix/build-cpython.sh index 132d24a40..f05c60223 100755 --- a/cpython-unix/build-cpython.sh +++ b/cpython-unix/build-cpython.sh @@ -649,6 +649,14 @@ if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_13}" && "${TARGET_TRIPLE}" == x86_64* PROFILE_TASK="${PROFILE_TASK} --ignore test.test_bytes.BytesTest.test_from_format" fi +# LLVM 23's BOLT instrumentation exhausts the stack in these recursion tests. +if [[ -n "${PYTHON_MEETS_MINIMUM_VERSION_3_14}" && -n "${BOLT_CAPABLE}" && "${LLVM_VERSION}" = 23 && "${TARGET_TRIPLE}" == x86_64* ]]; then + PROFILE_TASK="${PROFILE_TASK} --ignore test.test_json.test_recursion.TestCRecursion.test_endless_recursion" + PROFILE_TASK="${PROFILE_TASK} --ignore test.test_functools.TestLRUC.test_lru_recursion" + PROFILE_TASK="${PROFILE_TASK} --ignore test.test_functools.*.test_recursive_pickle" + PROFILE_TASK="${PROFILE_TASK} --ignore test.test_xml_etree_c.BadElementTest.test_deeply_nested_deepcopy" +fi + # We use ndbm on macOS and BerkeleyDB elsewhere. if [[ "${PYBUILD_PLATFORM}" = macos* ]]; then CONFIGURE_FLAGS="${CONFIGURE_FLAGS} --with-dbmliborder=ndbm"