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
The same bug affects _Py_get_machine_stack_pointer() in Include/internal/pycore_pystate.h: the intrinsic branches are guarded by _M_ARM64/_M_X64 only,
which mingw-w64 also defines, so MinGW toolchains hit MSVC-only intrinsics.
error: call to undeclared function '__getReg'; ISO C99 and later do not support implicit function declarations
x64: _AddressOfReturnAddress() is only declared by mingw-w64, never defined, so it becomes an undefined external call (jmp _AddressOfReturnAddress) and fails at link time. https://godbolt.org/z/qb7PvvMGG
The __x86_64__ fallback "{movq %%rsp, %0" is missing the |intel} half of the dialect alternative. It works in AT&T mode, but breaks with -masm=intel. It should take the same approach as _Py_ThreadId(), something like: "{movq %%rsp, %0|mov %0, rsp}".
Bug report
The same bug affects
_Py_get_machine_stack_pointer()inInclude/internal/pycore_pystate.h: the intrinsic branches are guarded by_M_ARM64/_M_X64only,which mingw-w64 also defines, so MinGW toolchains hit MSVC-only intrinsics.
__getReg(31)is not declared for MinGW (clang or GCC). https://godbolt.org/z/5zvY3W158_AddressOfReturnAddress()is only declared by mingw-w64, never defined, so it becomes an undefined external call (jmp _AddressOfReturnAddress) and fails at link time. https://godbolt.org/z/qb7PvvMGG__x86_64__fallback"{movq %%rsp, %0"is missing the|intel}half of the dialect alternative. It works in AT&T mode, but breaks with-masm=intel. It should take the same approach as_Py_ThreadId(), something like:"{movq %%rsp, %0|mov %0, rsp}".This was originally suggested by @kumaraditya303 in #157253 (comment)
Linked PRs