https://github.com/python/cpython/commit/507b4fa7a4d7c68ff514de4f30f6e49d7fc9cfc8 commit: 507b4fa7a4d7c68ff514de4f30f6e49d7fc9cfc8 branch: 3.13 author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com> committer: zware <zachary.w...@gmail.com> date: 2025-04-28T12:15:45-05:00 summary:
[3.13] gh-132026: Ensure _MIPS_SIM has defined _ABI identifiers for comparison (GH-133092) When built on a MIPS architecture, `_MIPS_SIM` is used to determine architecture specifics. The value is expected to match either `_ABIO32`, `_ABIN32` or `_ABI64`. In `gcc` config/mips/mips.h these values are defined as compiler `builtin_define` inside of a switch/case. That means, mips64el and mips64 architectures know about `_ABI64` but don't know about `_ABIO32` and `_ABIN32`. In turn, when CPython tries to use them in comparison, they may be undefined identifiers. In default compiler behavior, the undefined identifier will be evaluated as zero, and it will not match `_MIPS_SIM`. However, the issues pop up when `-Wundef` (or, even worse, `-Werror=undef`) compiler flag is enabled. Then suddenly it's visible as a warning or error. (cherry picked from commit 6985e2e6dea67630cf13fc02b7ca727af383207b) Co-authored-by: Valters Jansons <s...@users.noreply.github.com> files: A Misc/NEWS.d/next/Build/2025-04-02-21-08-36.gh-issue-132026.ptnR7T.rst M Misc/platform_triplet.c diff --git a/Misc/NEWS.d/next/Build/2025-04-02-21-08-36.gh-issue-132026.ptnR7T.rst b/Misc/NEWS.d/next/Build/2025-04-02-21-08-36.gh-issue-132026.ptnR7T.rst new file mode 100644 index 00000000000000..5490b98f25b124 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2025-04-02-21-08-36.gh-issue-132026.ptnR7T.rst @@ -0,0 +1 @@ +Fix use of undefined identifiers in platform triplet detection on MIPS Linux platforms. diff --git a/Misc/platform_triplet.c b/Misc/platform_triplet.c index ec0857a4a998c0..f5cd73bdea8333 100644 --- a/Misc/platform_triplet.c +++ b/Misc/platform_triplet.c @@ -57,21 +57,21 @@ PLATFORM_TRIPLET=arm-linux-androideabi # endif # if defined(_MIPS_SIM) # if defined(__mips_hard_float) -# if _MIPS_SIM == _ABIO32 +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 # define LIBC_MIPS gnu -# elif _MIPS_SIM == _ABIN32 +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 # define LIBC_MIPS gnuabin32 -# elif _MIPS_SIM == _ABI64 +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 # define LIBC_MIPS gnuabi64 # else # error unknown mips sim value # endif # else -# if _MIPS_SIM == _ABIO32 +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 # define LIBC_MIPS gnusf -# elif _MIPS_SIM == _ABIN32 +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 # define LIBC_MIPS gnuabin32sf -# elif _MIPS_SIM == _ABI64 +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 # define LIBC_MIPS gnuabi64sf # else # error unknown mips sim value @@ -107,21 +107,21 @@ PLATFORM_TRIPLET=arm-linux-androideabi # endif # if defined(_MIPS_SIM) # if defined(__mips_hard_float) -# if _MIPS_SIM == _ABIO32 +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 # define LIBC_MIPS musl -# elif _MIPS_SIM == _ABIN32 +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 # define LIBC_MIPS musln32 -# elif _MIPS_SIM == _ABI64 +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 # define LIBC_MIPS musl # else # error unknown mips sim value # endif # else -# if _MIPS_SIM == _ABIO32 +# if defined(_ABIO32) && _MIPS_SIM == _ABIO32 # define LIBC_MIPS muslsf -# elif _MIPS_SIM == _ABIN32 +# elif defined(_ABIN32) && _MIPS_SIM == _ABIN32 # define LIBC_MIPS musln32sf -# elif _MIPS_SIM == _ABI64 +# elif defined(_ABI64) && _MIPS_SIM == _ABI64 # define LIBC_MIPS muslsf # else # error unknown mips sim value _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com