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
Next Next commit
oooo there is a flag
  • Loading branch information
savannahostrowski committed Apr 10, 2026
commit 55069d8339e8d5ae4179ea4ea50e85754b89f6d5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Strip CFI directives from JIT stencils to fix build failures with Apple LLVM 21.
Use ``-fno-unwind-tables`` for JIT stencils to fix build failures with Apple LLVM 21.
9 changes: 1 addition & 8 deletions Tools/jit/_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,7 @@ 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"
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:
text = re.sub(r"^\s*\.cfi_\w+[^\n]*$", "", text, flags=re.MULTILINE)
return text
return re.sub(continue_symbol, continue_label, text)

def _parse_instruction(self, line: str) -> Instruction:
target = None
Expand Down
9 changes: 5 additions & 4 deletions Tools/jit/_targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ async def _compile(
# __FILE__ macro and assert failure messages) for reproducibility:
f"-ffile-prefix-map={CPYTHON}=.",
f"-ffile-prefix-map={tempdir}=.",
# 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 emit unwind tables or CFI directives. JIT stencils are
# not standard functions and their unwind info is not usable at
# runtime. The optimizer can produce unbalanced CFI directives
# that some assemblers reject (e.g. Apple LLVM 21):
"-fno-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