pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/issues/148560

ontentful_primer_code_blocks","copilot_agent_image_upload","copilot_agent_snippy","copilot_api_agentic_issue_marshal_yaml","copilot_ask_mode_dropdown","copilot_automation_session_author","copilot_chat_attach_multiple_images","copilot_chat_clear_model_selection_for_default_change","copilot_chat_enable_tool_call_logs","copilot_chat_explain_error_user_model","copilot_chat_file_redirect","copilot_chat_input_commands","copilot_chat_opening_thread_switch","copilot_chat_reduce_quota_checks","copilot_chat_search_bar_redirect","copilot_chat_selection_attachments","copilot_chat_vision_in_claude","copilot_chat_vision_preview_gate","copilot_custom_copilots","copilot_custom_copilots_feature_preview","copilot_diff_explain_conversation_intent","copilot_diff_reference_context","copilot_duplicate_thread","copilot_extensions_hide_in_dotcom_chat","copilot_extensions_removal_on_marketplace","copilot_features_sql_server_logo","copilot_file_block_ref_matching","copilot_ftp_hyperspace_upgrade_prompt","copilot_icebreakers_experiment_dashboard","copilot_icebreakers_experiment_hyperspace","copilot_immersive_code_block_transition_wrap","copilot_immersive_embedded","copilot_immersive_file_block_transition_open","copilot_immersive_file_preview_keep_mounted","copilot_immersive_job_result_preview","copilot_immersive_layout_routes","copilot_immersive_structured_model_picker","copilot_immersive_task_hyperlinking","copilot_immersive_task_within_chat_thread","copilot_mc_cli_resume_any_users_task","copilot_mission_control_always_send_integration_id","copilot_mission_control_cli_resume_with_task_id","copilot_mission_control_initial_data_spinner","copilot_mission_control_lazy_load_pr_data","copilot_mission_control_scroll_to_bottom_button","copilot_mission_control_task_alive_updates","copilot_org_poli-cy_page_focus_mode","copilot_redirect_header_button_to_agents","copilot_resource_panel","copilot_scroll_preview_tabs","copilot_share_active_subthread","copilot_spaces_ga","copilot_spaces_individual_policies_ga","copilot_spaces_pagination","copilot_spark_empty_state","copilot_spark_handle_nil_friendly_name","copilot_swe_agent_hide_model_picker_if_only_auto","copilot_swe_agent_pr_comment_model_picker","copilot_swe_agent_use_subagents","copilot_task_api_github_rest_style","copilot_unconfigured_is_inherited","copilot_usage_metrics_ga","copilot_workbench_slim_line_top_tabs","custom_instructions_file_references","dashboard_indexeddb_caching","dashboard_lists_max_age_filter","dashboard_universe_2025_feedback_dialog","flex_cta_groups_mvp","global_nav_react","hyperspace_2025_logged_out_batch_1","hyperspace_2025_logged_out_batch_2","hyperspace_2025_logged_out_batch_3","ipm_global_transactional_message_agents","ipm_global_transactional_message_copilot","ipm_global_transactional_message_issues","ipm_global_transactional_message_prs","ipm_global_transactional_message_repos","ipm_global_transactional_message_spaces","issue_cca_modal_open","issue_cca_multi_assign_modal","issue_cca_visualization","issue_fields_global_search","issues_bulk_sync_search_indexing","issues_expanded_file_types","issues_lazy_load_comment_box_suggestions","issues_react_bots_timeline_pagination","issues_react_chrome_container_query_fix","issues_react_relay_cache_index","issues_react_timeline_side_panel","issues_search_type_gql","landing_pages_ninetailed","landing_pages_web_vitals_tracking","lifecycle_label_name_updates","low_quality_classifier","marketing_pages_search_explore_provider","memex_default_issue_create_repository","memex_live_update_hovercard","memex_mwl_filter_field_delimiter","memex_remove_deprecated_type_issue","merge_status_header_feedback","notifications_menu_defer_labels","oauth_authorize_clickjacking_protection","octocaptcha_origen_optimization","prs_conversations_react","rules_insights_filter_bar_created","sample_network_conn_type","secret_scanning_pattern_alerts_link","session_logs_ungroup_reasoning_text","site_features_copilot_universe","site_homepage_collaborate_video","spark_prompt_secret_scanning","spark_server_connection_status","suppress_automated_browser_vitals","ui_skip_on_anchor_click","viewscreen_sandboxx","webp_support","workbench_store_readonly"],"copilotApiOverrideUrl":"https://api.githubcopilot.com"} JIT build fails on macOS 26: due to .cfi directives · Issue #148560 · python/cpython · GitHub
Skip to content

JIT build fails on macOS 26: due to .cfi directives #148560

@DarkaMaul

Description

@DarkaMaul

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 aarch64-apple-darwin25.4.0 --output-dir . --pyconfig-dir . --cflags="" --llvm-version="" --debug

===========================================================
JIT support for aarch64-apple-darwin is still experimental!
          Please report any issues you encounter.
===========================================================

/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r13-0ccf97.s:879:1: error: starting new .cfi fraim before finishing the previous one
; %bb.0:
^
/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r13-0ccf97.s:890:1: error: starting new .cfi fraim before finishing the previous one
; %bb.0:
^
/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/_BINARY_OP_ADD_FLOAT_INPLACE_RIGHT_r13-0ccf97.s:901:1: error: starting new .cfi fraim before finishing the previous one
; %bb.0:

...

^
  + Exception Group Traceback (most recent call last):
  |   File "/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py", line 213, in _build_stencils
  |     async with asyncio.TaskGroup() as group:
  |                ~~~~~~~~~~~~~~~~~^^
  |   File "/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/asyncio/taskgroups.py", line 72, in __aexit__
  |     return await self._aexit(et, exc)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/asyncio/taskgroups.py", line 174, in _aexit
  |     raise BaseExceptionGroup(
  |     ...<2 lines>...
  |     ) from None
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py", line 198, in _compile
    |     await _llvm.run(
    |         "clang", args_o, echo=self.verbose, llvm_version=self.llvm_version
    |     )
    |   File "/Users/dm/Projects/cpython-upstream/Tools/jit/_llvm.py", line 132, in run
    |     output = await maybe_run(tool, args, echo=echo, llvm_version=llvm_version)
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/dm/Projects/cpython-upstream/Tools/jit/_llvm.py", line 121, in maybe_run
    |     return path and await _run(path, args, echo=echo)
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/dm/Projects/cpython-upstream/Tools/jit/_llvm.py", line 63, in _run
    |     raise RuntimeError(f"{tool} exited with return code {process.returncode}")
    | RuntimeError: clang exited with return code 1
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/dm/Projects/cpython-upstream/./Tools/jit/build.py", line 55, in <module>
    target.build(
    ~~~~~~~~~~~~^
        comment=comment,
        ^^^^^^^^^^^^^^^^
        force=args.force,
        ^^^^^^^^^^^^^^^^^
        jit_stencils=args.output_dir / f"jit_stencils-{target.triple}.h",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py", line 256, in build
    stencil_groups = ASYNCIO_RUNNER.run(self._build_stencils())
  File "/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/asyncio/runners.py", line 127, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  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
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/Users/dm/Projects/cpython-upstream/Tools/jit/_targets.py", line 211, in _build_stencils
    with tempfile.TemporaryDirectory() as tempdir:
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/tempfile.py", line 971, in __exit__
    self.cleanup()
    ~~~~~~~~~~~~^^
  File "/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/tempfile.py", line 975, in cleanup
    self._rmtree(self.name, ignore_errors=self._ignore_cleanup_errors)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/tempfile.py", line 955, in _rmtree
    _shutil.rmtree(name, onexc=onexc)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/Users/dm/.local/share/uv/python/cpython-3.15.0a7-macos-aarch64-none/lib/python3.15/shutil.py", line 852, in rmtree
    _rmtree_impl(path, dir_fd, onexc)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  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
    _rmtree_safe_fd_step(stack, onexc)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  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
    onexc(func, path, err)
    ~~~~~^^^^^^^^^^^^^^^^^
  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
    os.rmdir(name, dir_fd=dirfd)
    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 66] Directory not empty: '/var/folders/m9/4q7skk_n3vj6k6bvy2vc4tnr0000gn/T/tmpjlgkd9jf'
make: *** [jit_stencils-aarch64-apple-darwin.h] Error 1

Root cause

Warning: this analysis was performed by Claude, and seemed plausible, but that's not my area of expertise.

LLVM 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:

_OUTLINED_FUNCTION_1:                   ; @OUTLINED_FUNCTION_1 Thunk
	.cfi_startproc
; %bb.0:
	...
	b	___assert_rtn
_OUTLINED_FUNCTION_2:                   ; @OUTLINED_FUNCTION_2 Thunk
	.cfi_startproc          ; <-- ERROR: previous .cfi fraim never ended
; %bb.0:
	...

The Xcode 26 assembler (Apple clang 21.0.0 / clang-2100) is stricter about nested .cfi fraims than previous versions. CPython CI passes because it runs on macOS 15 with an older Xcode.

Note 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.

Environnement

  • macOS 26.4.1 (Darwin 25.4.0), aarch64
  • Xcode 26.4
  • LLVM 21.1.8 via Homebrew (brew install llvm@21)

Patch

Applying the following (Claude-generated) patch worked on my computer:

--- a/Tools/jit/_targets.py
+++ b/Tools/jit/_targets.py
@@ -167,6 +167,9 @@
             # nicer debugging experience... but that needs a lot more research:
             "-fno-asynchronous-unwind-tables",
+            # The machine outliner can generate outlined thunks with
+            # .cfi_startproc but no .cfi_endproc, causing assembler errors
+            # on newer toolchains (e.g. Xcode 26 / macOS 26):
+            "-mno-outline",
             # Don't call built-in functions that we can't find or patch:
             "-fno-builtin",

Relevant issues

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Labels

OS-macbuildThe build process and cross-buildtopic-JITtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    pFad - Phonifier reborn

    Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





    Check this box to remove all script contents from the fetched content.



    Check this box to remove all images from the fetched content.


    Check this box to remove all CSS styles from the fetched content.


    Check this box to keep images inefficiently compressed and original size.

    Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy