From 7b86c0249817d19ffb3e1a0d18fdf84ee1acadff Mon Sep 17 00:00:00 2001 From: Diego Russo Date: Thu, 26 Mar 2026 21:19:39 +0000 Subject: [PATCH 1/4] GH-126910: reserve FP on AArch64 when generating JIT stencils --- Tools/jit/_targets.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index fa98dcb5a40851..56f5ada3fdfa29 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -167,6 +167,7 @@ async def _compile( # 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", + "-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: @@ -580,20 +581,24 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO: host = "aarch64-apple-darwin" condition = "defined(__aarch64__) && defined(__APPLE__)" optimizer = _optimizers.OptimizerAArch64 - target = _MachO(host, condition, optimizer=optimizer) + target = _MachO(host, condition, optimizer=optimizer, frame_pointers=True) elif re.fullmatch(r"aarch64-pc-windows-msvc", host): host = "aarch64-pc-windows-msvc" condition = "defined(_M_ARM64)" args = ["-fms-runtime-lib=dll"] optimizer = _optimizers.OptimizerAArch64 - target = _COFF64(host, condition, args=args, optimizer=optimizer) + target = _COFF64( + host, condition, args=args, optimizer=optimizer, frame_pointers=True + ) elif re.fullmatch(r"aarch64-.*-linux-gnu", host): host = "aarch64-unknown-linux-gnu" condition = "defined(__aarch64__) && defined(__linux__)" # -mno-outline-atomics: Keep intrinsics from being emitted. args = ["-fpic", "-mno-outline-atomics", "-fno-plt"] optimizer = _optimizers.OptimizerAArch64 - target = _ELF(host, condition, args=args, optimizer=optimizer) + target = _ELF( + host, condition, args=args, optimizer=optimizer, frame_pointers=True + ) elif re.fullmatch(r"i686-pc-windows-msvc", host): host = "i686-pc-windows-msvc" condition = "defined(_M_IX86)" From 805e23e6b151955adb407866402b108651636920 Mon Sep 17 00:00:00 2001 From: Diego Russo Date: Fri, 27 Mar 2026 16:47:20 +0000 Subject: [PATCH 2/4] Let's do it just for Linux AArch64 for now --- Tools/jit/_targets.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index 56f5ada3fdfa29..ad2d5b3c780d54 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -167,7 +167,6 @@ async def _compile( # 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", - "-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: @@ -581,15 +580,13 @@ def get_target(host: str) -> _COFF32 | _COFF64 | _ELF | _MachO: host = "aarch64-apple-darwin" condition = "defined(__aarch64__) && defined(__APPLE__)" optimizer = _optimizers.OptimizerAArch64 - target = _MachO(host, condition, optimizer=optimizer, frame_pointers=True) + target = _MachO(host, condition, optimizer=optimizer) elif re.fullmatch(r"aarch64-pc-windows-msvc", host): host = "aarch64-pc-windows-msvc" condition = "defined(_M_ARM64)" args = ["-fms-runtime-lib=dll"] optimizer = _optimizers.OptimizerAArch64 - target = _COFF64( - host, condition, args=args, optimizer=optimizer, frame_pointers=True - ) + target = _COFF64(host, condition, args=args, optimizer=optimizer) elif re.fullmatch(r"aarch64-.*-linux-gnu", host): host = "aarch64-unknown-linux-gnu" condition = "defined(__aarch64__) && defined(__linux__)" From 926c1c229f1bfa63e61e428cdea4274628e12bde Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 27 Mar 2026 17:14:23 +0000 Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst new file mode 100644 index 00000000000000..f984bdd975259d --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst @@ -0,0 +1 @@ +Set frame pointers in ``aarch64-unknown-linux-gnu`` JIT code, allowing most native profilers and debuggers to unwind through them. From 514e449159dc59b17f185f9d2aed2ca6fb32ad5d Mon Sep 17 00:00:00 2001 From: Diego Russo Date: Fri, 27 Mar 2026 17:15:06 +0000 Subject: [PATCH 4/4] Add patch note for frame pointers in JIT code Patch by Diego Russo --- .../2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst index f984bdd975259d..e3ddf39408804b 100644 --- a/Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst +++ b/Misc/NEWS.d/next/Core_and_Builtins/2026-03-27-17-14-18.gh-issue-126910.hooVFQ.rst @@ -1 +1 @@ -Set frame pointers in ``aarch64-unknown-linux-gnu`` JIT code, allowing most native profilers and debuggers to unwind through them. +Set frame pointers in ``aarch64-unknown-linux-gnu`` JIT code, allowing most native profilers and debuggers to unwind through them. Patch by Diego Russo