Title: JIT build fails on macOS 26: due to .cfi directives · Issue #148560 · python/cpython · GitHub
Open Graph Title: JIT build fails on macOS 26: due to .cfi directives · Issue #148560 · python/cpython
X Title: JIT build fails on macOS 26: due to .cfi directives · Issue #148560 · python/cpython
Description: Bug report Bug description: How to reproduce CPython Commit: 4af46b4 (April 15) ./configure --enable-experimental-jit --with-pydebug make The following command fails with the following errors: ❯ make -j1 python3.15 ./Tools/jit/build.py a...
Open Graph Description: Bug report Bug description: How to reproduce CPython Commit: 4af46b4 (April 15) ./configure --enable-experimental-jit --with-pydebug make The following command fails with the following errors: ❯ ma...
X Description: Bug report Bug description: How to reproduce CPython Commit: 4af46b4 (April 15) ./configure --enable-experimental-jit --with-pydebug make The following command fails with the following errors: ❯ ma...
Opengraph URL: https://github.com/python/cpython/issues/148560
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JIT build fails on macOS 26: due to .cfi directives","articleBody":"# Bug report\n\n### Bug description:\n\n## How to reproduce\n\nCPython Commit: 4af46b4ab5af49d8df034320a9a70fcbb062f7cf (April 15)\n\n```bash\n./configure --enable-experimental-jit --with-pydebug\nmake\n``` \n\nThe following command fails with the following errors:\n\n```\n❯ make -j1\npython3.15 ./Tools/jit/build.py aarch64-apple-darwin25.4.0 --output-dir . --pyconfig-dir . --cflags=\"\" --llvm-version=\"\" --debug\n\n===========================================================\nJIT support for aarch64-apple-darwin is still experimental!\n Please report any issues you encounter.\n===========================================================\n\n/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r13-0ccf97.s:879:1: error: starting new .cfi frame before finishing the previous one\n; %bb.0:\n^\n/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r13-0ccf97.s:890:1: error: starting new .cfi frame before finishing the previous one\n; %bb.0:\n^\n/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r13-0ccf97.s:901:1: error: starting new .cfi frame before finishing the previous one\n; %bb.0:\n\n...\n\n^\n + Exception Group Traceback (most recent call last):\n | File \"/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py\", line 213, in _build_stencils\n | async with asyncio.TaskGroup() as group:\n | ~~~~~~~~~~~~~~~~~^^\n | File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/asyncio/taskgroups.py\", line 72, in __aexit__\n | return await self._aexit(et, exc)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^\n | File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/asyncio/taskgroups.py\", line 174, in _aexit\n | raise BaseExceptionGroup(\n | ...\u003c2 lines>...\n | ) from None\n | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)\n +-+---------------- 1 ----------------\n | Traceback (most recent call last):\n | File \"/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py\", line 198, in _compile\n | await _llvm.run(\n | \"clang\", args_o, echo=self.verbose, llvm_version=self.llvm_version\n | )\n | File \"/Users/dm/Projects/cpython-upstream/Tools/jit/_llvm.py\", line 132, in run\n | output = await maybe_run(tool, args, echo=echo, llvm_version=llvm_version)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n | File \"/Users/dm/Projects/cpython-upstream/Tools/jit/_llvm.py\", line 121, in maybe_run\n | return path and await _run(path, args, echo=echo)\n | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n | File \"/Users/dm/Projects/cpython-upstream/Tools/jit/_llvm.py\", line 63, in _run\n | raise RuntimeError(f\"{tool} exited with return code {process.returncode}\")\n | RuntimeError: clang exited with return code 1\n +------------------------------------\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/Users/dm/Projects/cpython-upstream/./Tools/jit/build.py\", line 55, in \u003cmodule>\n target.build(\n ~~~~~~~~~~~~^\n comment=comment,\n ^^^^^^^^^^^^^^^^\n force=args.force,\n ^^^^^^^^^^^^^^^^^\n jit_stencils=args.output_dir / f\"jit_stencils-{target.triple}.h\",\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n )\n ^\n File \"/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py\", line 256, in build\n stencil_groups = ASYNCIO_RUNNER.run(self._build_stencils())\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/asyncio/runners.py\", line 127, in run\n return self._loop.run_until_complete(task)\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/asyncio/base_events.py\", line 719, in run_until_complete\n return future.result()\n ~~~~~~~~~~~~~^^\n File \"/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py\", line 211, in _build_stencils\n with tempfile.TemporaryDirectory() as tempdir:\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/tempfile.py\", line 971, in __exit__\n self.cleanup()\n ~~~~~~~~~~~~^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/tempfile.py\", line 975, in cleanup\n self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/tempfile.py\", line 955, in _rmtree\n _shutil.rmtree(name, onexc=onexc)\n ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/shutil.py\", line 852, in rmtree\n _rmtree_impl(path, dir_fd, onexc)\n ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/shutil.py\", line 721, in _rmtree_safe_fd\n _rmtree_safe_fd_step(stack, onexc)\n ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/shutil.py\", line 802, in _rmtree_safe_fd_step\n onexc(func, path, err)\n ~~~~~^^^^^^^^^^^^^^^^^\n File \"/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/shutil.py\", line 753, in _rmtree_safe_fd_step\n os.rmdir(name, dir_fd=dirfd)\n ~~~~~~~~^^^^^^^^^^^^^^^^^^^^\nOSError: [Errno 66] Directory not empty: '/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/tmpjlgkd9jf'\nmake: *** [jit_stencils-aarch64-apple-darwin.h] Error 1\n```\n\n\n## Root cause\n\n\u003cdetails>\n\u003csummary>\nWarning: this analysis was performed by Claude, and seemed plausible, but that's not my area of expertise.\n\u003c/summary>\n\nLLVM 21's machine outliner (enabled by `-Os`) generates `_OUTLINED_FUNCTION_*` thunks at the end of the assembly output. Each thunk has `.cfi_startproc` but no matching `.cfi_endproc`:\n\n```asm\n_OUTLINED_FUNCTION_1: ; @OUTLINED_FUNCTION_1 Thunk\n\t.cfi_startproc\n; %bb.0:\n\t...\n\tb\t___assert_rtn\n_OUTLINED_FUNCTION_2: ; @OUTLINED_FUNCTION_2 Thunk\n\t.cfi_startproc ; \u003c-- ERROR: previous .cfi frame never ended\n; %bb.0:\n\t...\n```\n\nThe Xcode 26 assembler (Apple clang 21.0.0 / clang-2100) is stricter about nested `.cfi` frames than previous versions. CPython CI passes because it runs on macOS 15 with an older Xcode.\n\nNote that `-fno-asynchronous-unwind-tables` is already passed during compilation, so the `.cfi` directives in these outlined thunks serve no purpose — the outliner just emits them unconditionally.\n\n\u003c/details>\n\n## Environnement\n\n- macOS 26.4.1 (Darwin 25.4.0), aarch64\n- Xcode 26.4\n- LLVM 21.1.8 via Homebrew (`brew install llvm@21`)\n\n## Patch\n\nApplying the following (Claude-generated) patch worked on my computer:\n\n```diff\n--- a/Tools/jit/_targets.py\n+++ b/Tools/jit/_targets.py\n@@ -167,6 +167,9 @@\n # nicer debugging experience... but that needs a lot more research:\n \"-fno-asynchronous-unwind-tables\",\n+ # The machine outliner can generate outlined thunks with\n+ # .cfi_startproc but no .cfi_endproc, causing assembler errors\n+ # on newer toolchains (e.g. Xcode 26 / macOS 26):\n+ \"-mno-outline\",\n # Don't call built-in functions that we can't find or patch:\n \"-fno-builtin\",\n```\n\n## Relevant issues\n\n- https://github.com/python/cpython/issues/145098\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nmacOS\n\n\u003c!-- gh-linked-prs -->\n### Linked PRs\n* gh-148703\n\u003c!-- /gh-linked-prs -->\n","author":{"url":"https://github.com/DarkaMaul","@type":"Person","name":"DarkaMaul"},"datePublished":"2026-04-14T15:38:59Z","url":"https://github.com/python/cpython/issues/148560"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:dc4a4ca0-5dcb-8fd3-7047-e99a8d809a71 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D308:39914:2F917D:417393:6AECC9E1 |
| html-safe-nonce | 68e0861d5c969bbff74b797bdcf9a6e29368695b06a3e4252d142e28ce4a760a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMzA4OjM5OTE0OjJGOTE3RDo0MTczOTM6NkFFQ0M5RTEiLCJ2aXNpdG9yX2lkIjoiNzc1MDQxNzk0MzY5Nzg2OTI4MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 751f679d5f6abde606f5adb2b1c148689b64cea864fc1eee03aa699435c02ade |
| hovercard-subject-tag | issue:4263174800 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/148560/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cc7181d8bf115134a1507e4bdd6938cae4d43c030e8b9cb20062bd2f019d93d7/python/cpython/issues/148560 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cc7181d8bf115134a1507e4bdd6938cae4d43c030e8b9cb20062bd2f019d93d7/python/cpython/issues/148560 |
| og:image:alt | Bug report Bug description: How to reproduce CPython Commit: 4af46b4 (April 15) ./configure --enable-experimental-jit --with-pydebug make The following command fails with the following errors: ❯ ma... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DarkaMaul |
| hostname | github.com |
| expected-hostname | github.com |
| None | dc0b519c5798dc1150b88dc4c06a8b9634d0069218dc04e469970e76aad74016 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | db139f0bf57b59bf9a8c4abb0849924d6c6ca559 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width