You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Jit stencils on Windows contain debug data in 3.15 #142050
which is in fact empty on main for Linux (at least for me on WSL) or Windows on 3.14.
The above block is contained in every stencil :(
Clang now generates debug info into the object files. Don't know when it happened, maybe one of the clang updates. Doesn't matter anyway, the fix is easy, just ignore .debug$S COFF sections, which brings us back to
fixes this. So it must be related to the update of clang to 21.1.4.0 (#140973).
Looking closer at the data
// _NOP.o: file format coff-x86-64
// 0: '\x00\x00\x00\x00\x04\x00\x00\x00\xf1\x00\x00\x00<\x00\x00\x00\n\x00\x01\x11\x00\x00\x00\x00\x00\x00\x00\x00.\x00<\x11\x00\x00\x00\x00\xd0\x00\x15\x00\x01\x00\x04\x00\x00\x00\x16R\x00\x00\x00\x00\x00\x00clang version 21.1.4\x00\x00'
// 4c: 00 00 00 00
reveals clang version 21.1.4. Thus, I had high hopes that using -fno-ident might fix it. But unfortunately, this is not enough, still more metadata is written. So searching in the clang command line reference for metadata I found -fno-stack-size-section which doesn't change anything.
Thus, I think just ignoring .debug$S COFF sections is the easiest way to go and I have verified using
py Tools\jit\build.py -p PC -o jit-files aarch64-pc-windows-msvc x86_64-pc-windows-msvc i686-pc-windows-msvc
that with this fix for all three configurations this metadata is no longer contained in the stencils (and was present in all of them before).
I've checked again in WSL Ubuntu 24.04.3 LTS for clang 21.1.3 and on native Ubuntu 24.04.3 LTS for clang 21.1.7 that this does not happen for x86_64-pc-linux-gnu. I don't have a setup for cross builds, so unfortunately I cannot comment on aarch64-unknown-linux-gnu for Linux and I have no Mac.
I have no idea why clang changed that only for Windows.
As written in #142052 (comment), I am unsure about a backport, because
3.14 uses clang 19.1.7 and is not affected. I've verified for aarch64-pc-windows-msvcx86_64-pc-windows-msvci686-pc-windows-msvc.
no clang update is planned there anymore (I assume?)
the clang version used for the jit cannot (easily without touching _llmv.py) be changed. Make LLVM_VERSION configurable with env variable #138497 supports that only for configure based builds. And it is discouraged to use a different clang version, anyway. And the jit is experimental in 3.14 ...
but better safe than sorry? The fix is small and simple ...
MSVC always emits minimal CodeView metadata with compiler information, even when debug info is otherwise disabled. Other tools may rely on this metadata being present. For example, linkers use it to determine whether hotpatching is enabled for the object file.
It is contained in clang since 21.1.0-rc1.
Unfortunately, this is done unconditionally (at first it was planned to do it only when hotpatching is enabled) and there seems to be no switch to disable it.
Activity
[-]Jit stencils on Windows contain debug data on Windows[/-][+]Jit stencils on Windows contain debug data[/+]chris-eibl commentedon Nov 30, 2025
I've done some further investigation. Just changing back to
in
cpython/Tools/jit/_llvm.py
Lines 14 to 15 in cd4d0ae
fixes this. So it must be related to the update of clang to 21.1.4.0 (#140973).
Looking closer at the data
reveals
clang version 21.1.4. Thus, I had high hopes that using -fno-ident might fix it. But unfortunately, this is not enough, still more metadata is written. So searching in the clang command line reference formetadataI found -fno-stack-size-section which doesn't change anything.Thus, I think just ignoring
.debug$SCOFF sections is the easiest way to go and I have verified usingthat with this fix for all three configurations this metadata is no longer contained in the stencils (and was present in all of them before).
I've checked again in WSL Ubuntu 24.04.3 LTS for clang 21.1.3 and on native Ubuntu 24.04.3 LTS for clang 21.1.7 that this does not happen for
x86_64-pc-linux-gnu. I don't have a setup for cross builds, so unfortunately I cannot comment onaarch64-unknown-linux-gnufor Linux and I have no Mac.I have no idea why clang changed that only for Windows.
chris-eibl commentedon Nov 30, 2025
As written in #142052 (comment), I am unsure about a backport, because
aarch64-pc-windows-msvcx86_64-pc-windows-msvci686-pc-windows-msvc._llmv.py) be changed. Make LLVM_VERSION configurable with env variable #138497 supports that only for configure based builds. And it is discouraged to use a different clang version, anyway. And the jit is experimental in 3.14 ...[-]Jit stencils on Windows contain debug data[/-][+]Jit stencils on Windows contain debug data in 3.15[/+]chris-eibl commentedon Dec 1, 2025
Ha, I found it, even though it is not part of the 21.1.0 release notes:
llvm/llvm-project#142970: [CodeGen][COFF] Always emit CodeView compiler info on Windows targets
It is contained in clang since 21.1.0-rc1.
Unfortunately, this is done unconditionally (at first it was planned to do it only when hotpatching is enabled) and there seems to be no switch to disable it.
GH-142050: Jit stencils on Windows contain debug data (#142052)
chris-eibl commentedon Dec 4, 2025
PR is merged, I think this can be closed.
pythonGH-142050: Jit stencils on Windows contain debug data (python#1…