Skip to content

Commit 55069d8

Browse files
oooo there is a flag
1 parent 00dfe93 commit 55069d8

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Strip CFI directives from JIT stencils to fix build failures with Apple LLVM 21.
1+
Use ``-fno-unwind-tables`` for JIT stencils to fix build failures with Apple LLVM 21.

Tools/jit/_optimizers.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,7 @@ def _preprocess(self, text: str) -> str:
251251
# references to a local _JIT_CONTINUE label (which we will add later):
252252
continue_symbol = rf"\b{re.escape(self.symbol_prefix)}_JIT_CONTINUE\b"
253253
continue_label = f"{self.label_prefix}_JIT_CONTINUE"
254-
text = re.sub(continue_symbol, continue_label, text)
255-
# Strip CFI directives as JIT stencils are compiled with
256-
# -fno-asynchronous-unwind-tables. The optimizer can remove blocks
257-
# containing .cfi_endproc while keeping the corresponding
258-
# .cfi_startproc, producing unbalanced CFI frames that some
259-
# assemblers reject:
260-
text = re.sub(r"^\s*\.cfi_\w+[^\n]*$", "", text, flags=re.MULTILINE)
261-
return text
254+
return re.sub(continue_symbol, continue_label, text)
262255

263256
def _parse_instruction(self, line: str) -> Instruction:
264257
target = None

Tools/jit/_targets.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,11 @@ async def _compile(
163163
# __FILE__ macro and assert failure messages) for reproducibility:
164164
f"-ffile-prefix-map={CPYTHON}=.",
165165
f"-ffile-prefix-map={tempdir}=.",
166-
# This debug info isn't necessary, and bloats out the JIT'ed code.
167-
# We *may* be able to re-enable this, process it, and JIT it for a
168-
# nicer debugging experience... but that needs a lot more research:
169-
"-fno-asynchronous-unwind-tables",
166+
# Don't emit unwind tables or CFI directives. JIT stencils are
167+
# not standard functions and their unwind info is not usable at
168+
# runtime. The optimizer can produce unbalanced CFI directives
169+
# that some assemblers reject (e.g. Apple LLVM 21):
170+
"-fno-unwind-tables",
170171
# Don't call built-in functions that we can't find or patch:
171172
"-fno-builtin",
172173
# Don't call stack-smashing canaries that we can't find or patch:

0 commit comments

Comments
 (0)