Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Just kidding, the flag breaks x86 linux
  • Loading branch information
savannahostrowski committed Apr 10, 2026
commit 4e2a5d315310d4f7ad0467c4aa186eeab4392d4c
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Use ``-fno-unwind-tables`` for JIT stencils to fix build failures with Apple LLVM 21.
Strip CFI directives from JIT stencils to fix build failures with Apple LLVM 21.
9 changes: 8 additions & 1 deletion Tools/jit/_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,14 @@ def _preprocess(self, text: str) -> str:
# references to a local _JIT_CONTINUE label (which we will add later):
continue_symbol = rf"\b{re.escape(self.symbol_prefix)}_JIT_CONTINUE\b"
continue_label = f"{self.label_prefix}_JIT_CONTINUE"
return re.sub(continue_symbol, continue_label, text)
text = re.sub(continue_symbol, continue_label, text)
# Strip CFI directives as JIT stencils are compiled with
# -fno-asynchronous-unwind-tables. The optimizer can remove
# blocks containing .cfi_endproc while keeping the corresponding
# .cfi_startproc, producing unbalanced CFI frames that some
# assemblers reject (e.g. Apple LLVM 21):
text = re.sub(r"^\s*\.cfi_\w+[^\n]*$", "", text, flags=re.MULTILINE)
return text

def _parse_instruction(self, line: str) -> Instruction:
target = None
Expand Down
7 changes: 4 additions & 3 deletions Tools/jit/_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ async def _compile(
# __FILE__ macro and assert failure messages) for reproducibility:
f"-ffile-prefix-map={CPYTHON}=.",
f"-ffile-prefix-map={tempdir}=.",
# Don't emit CFI directives. The optimizer can produce unbalanced
# CFI directives that some assemblers reject (e.g. Apple LLVM 21):
"-fno-unwind-tables",
# This debug info isn't necessary, and bloats out the JIT'ed code.
# We *may* be able to re-enable this, process it, and JIT it for a
# nicer debugging experience... but that needs a lot more research:
"-fno-asynchronous-unwind-tables",
# Don't call built-in functions that we can't find or patch:
"-fno-builtin",
# Don't call stack-smashing canaries that we can't find or patch:
Expand Down
Loading