-
-
Notifications
You must be signed in to change notification settings - Fork 30.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python 3.13 can't compile with armv5 target #125444
Comments
Paging @diegorusso. |
On Arm v5 it is not possible to get the thread ID via register hence the illegal instruction. The c13 register started to provide thread ID since the rev1 (r1p0) release of the ARM1136JF-S processor which is an Arm v6K architecture varian. Other variants of Arm v6 (T2, Z and base ) don’t provide the thread ID via c13. |
Does this affect the default build of Python 3.13 or just the free threading build? Here's glibc's check, for what it's worth: https://github.com/bminor/glibc/blob/9d4b4515a88c5d0bbfc7809374f322c507c2d779/sysdeps/arm/sysdep.h#L59-L60 And their fallback: |
We only test the default build, and indeed the issue in that build is seen only with the usage of the instruction in mimalloc. I've disabled mimalloc on armv5 as a workaround. |
We are currently testing a patch that draws a line between Arm v6 and Arm v7. I guess we can go with a more precise grouping like glibc does but I feel it is not that necessary for a couple of reasons:
glibc has that differentiation because it was introduce organically whilst being developed over the years (that differentiation was introduced 11 years ago and never changed it) and their main focus is back compatibility. Anyway if anyone feels strong otherwise, we could push for a more precise grouping. |
On Arm v5 it is not possible to get the thread ID via c13 register hence the illegal instruction. The c13 register started to provide thread ID since Arm v6K architecture variant. Other variants of Arm v6 (T2, Z and base) don’t provide the thread ID via c13. For the sake of simplicity we group v5 and v6 together and consider that instructions for Arm v7 only.
On Arm v5 it is not possible to get the thread ID via c13 register hence the illegal instruction. The c13 register started to provide thread ID since Arm v6K architecture variant. Other variants of Arm v6 (T2, Z and base) don’t provide the thread ID via c13. For the sake of simplicity we group v5 and v6 together and consider that instructions for Arm v7 only.
I have created the PR #125574, please have a look. Once we agree in an implementation, I will suggest the same fix to https://github.com/microsoft/mimalloc/ as well. |
Looks good to me! |
On Arm v5 it is not possible to get the thread ID via c13 register hence the illegal instruction. The c13 register started to provide thread ID since Arm v6K architecture variant. Other variants of Arm v6 (T2, Z and base) don’t provide the thread ID via c13. For the sake of simplicity we group v5 and v6 together and consider that instructions for Arm v7 only.
…ythonGH-125574) On Arm v5 it is not possible to get the thread ID via c13 register hence the illegal instruction. The c13 register started to provide thread ID since Arm v6K architecture variant. Other variants of Arm v6 (T2, Z and base) don’t provide the thread ID via c13. For the sake of simplicity we group v5 and v6 together and consider that instructions for Arm v7 only. (cherry picked from commit feda9aa) Co-authored-by: Diego Russo <[email protected]>
…GH-125574) (GH-125595) On Arm v5 it is not possible to get the thread ID via c13 register hence the illegal instruction. The c13 register started to provide thread ID since Arm v6K architecture variant. Other variants of Arm v6 (T2, Z and base) don’t provide the thread ID via c13. For the sake of simplicity we group v5 and v6 together and consider that instructions for Arm v7 only. (cherry picked from commit feda9aa) Co-authored-by: Diego Russo <[email protected]>
Changes have been merged both on main and 3.13 branches. |
Bug report
Bug description:
If we build cpython 3.13 for Linux/ARMv5 using
-march=armv5te
and then run inside a qemu with theversatilepb
machine (which uses a ARM926EJ-S processor) then python crashes with "Illegal Instruction". Specifically,mrc
is used in a few places to get the thread ID, but this not possible in cores lower than ARMv6K.Users of
mrc
:I suspect the best way of implemented the required check would be:
That is, if Arm and if the architecture level is 6 or great and if this is not bare v6 (so v6K/v6Z are included).
Or a blunter but simpler hammer on the grounds that v5/v6 is pretty niche these days could be:
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: