Skip to content

Jit stencils on Windows contain debug data in 3.15 #142050

Description

@chris-eibl

Bug report

Bug description:

E.g.

voidemit__NOP(
unsigned char*code, unsigned char*data, _PyExecutorObject*executor,
const_PyUOpInstruction*instruction, jit_state*state)
{
// // _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 00constunsigned chardata_body[80] = {
0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0xf1, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x3c, 0x11,
0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x15, 0x00,
0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x16, 0x52,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x6c,
0x61, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x72, 0x73,
0x69, 0x6f, 0x6e, 0x20, 0x32, 0x31, 0x2e, 0x31,
0x2e, 0x34,
};
memcpy(data, data_body, sizeof(data_body));
}

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

voidemit__NOP(
unsigned char*code, unsigned char*data, _PyExecutorObject*executor,
const_PyUOpInstruction*instruction, jit_state*state)
{
// // _NOP.o: file format coff-x86-64// 0: '\x00\x00\x00\x00'// 4: 00 00 00 00
}

CPython versions tested on:

CPython main branch

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15pre-release feature fixes, bugs and security fixesOS-windowstopic-JITtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions