-
-
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
gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS #112828
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -7,7 +7,9 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
#define PY_MACCONFIG_H | ||||||||||||||||||||||||||||||||||||||||||||||||||
#ifdef __APPLE__ | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
#undef ALIGNOF_MAX_ALIGN_T | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef SIZEOF_LONG | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef SIZEOF_LONG_DOUBLE | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef SIZEOF_PTHREAD_T | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef SIZEOF_SIZE_T | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef SIZEOF_TIME_T | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -20,6 +22,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
#undef DOUBLE_IS_BIG_ENDIAN_IEEE754 | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef HAVE_GCC_ASM_FOR_X87 | ||||||||||||||||||||||||||||||||||||||||||||||||||
#undef HAVE_GCC_ASM_FOR_X64 | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
#undef VA_LIST_IS_ARRAY | ||||||||||||||||||||||||||||||||||||||||||||||||||
#if defined(__LP64__) && defined(__x86_64__) | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -74,8 +77,14 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||
# define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 | ||||||||||||||||||||||||||||||||||||||||||||||||||
#endif | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
#ifdef __i386__ | ||||||||||||||||||||||||||||||||||||||||||||||||||
#if defined(__i386__) || defined(__x86_64__) | ||||||||||||||||||||||||||||||||||||||||||||||||||
# define HAVE_GCC_ASM_FOR_X87 | ||||||||||||||||||||||||||||||||||||||||||||||||||
# define ALIGNOF_MAX_ALIGN_T 16 | ||||||||||||||||||||||||||||||||||||||||||||||||||
# define HAVE_GCC_ASM_FOR_X64 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||
# define SIZEOF_LONG_DOUBLE 16 | ||||||||||||||||||||||||||||||||||||||||||||||||||
#else | ||||||||||||||||||||||||||||||||||||||||||||||||||
# define ALIGNOF_MAX_ALIGN_T 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||
# define SIZEOF_LONG_DOUBLE 8 | ||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A compatibility question: up until now, any universal2 executable built on an Intel Mac define 16 for both Intel and Apple Silicon Macs, while builds on Apple Silicon Macs (either single arch or universal2) use 8. With this PR going forward, that would change. Are there any compatibility implications for, say, existing third-party extension modules? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another issue is If I read the code correctly I'm not sure how to effectively search for external users of the macro. My gut feeling is that this should be safe. Maybe ask Thomas about his opinion as RM? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW. I get no hits on SIZEOF_LONG_DOUBLE at all in 3.13, other than exporting it through pyconfig and sysconfig. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@Yhg1s, @ambv Any opinions? We're early enough in the 3.13 dev cycle that it shouldn't be any issue changing this now regardless. But what about for 3.12 or even 3.11? Is there any reasonable risk that this change could affect existing extension modules (for example, in PyPI wheels) that were built with previous releases of 3.12.x (et al) when used with universal2 builds with this PR merged? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be clear, one reason for backporting is that, without it, tests fail when universal2 builds are built on Apple Silicon Macs and then run on Intel Macs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering the defines are plain wrong, this feels like something that should be backported, yes. The compatibility impact scales with the bug impact: if nobody uses it, nobody should notice; if lots of people use it, they will want the fix. I think it's worth backporting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll back port to 3.12 and propose to skip the back port to 3.11 because the impact there is likely lower:
For the latter: I checked with the configure check for x87 double rounding that double rounding isn't detected when compiling for x86_64 using Lines 5469 to 5492 in 1eac0aa
|
||||||||||||||||||||||||||||||||||||||||||||||||||
#endif | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // __APPLE__ | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Make sure the preprocessor definitions for ``ALIGNOF_MAX_ALIGN_T``, | ||
``SIZEOF_LONG_DOUBLE`` and ``HAVE_GCC_ASM_FOR_X64`` are correct for | ||
Universal 2 builds on macOS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
__x86_64__
to the check because the compiler included with Xcode 15.1 (and possibly earlier) no longer defines__i386__
when building for Intel.