@@ -6963,15 +6963,16 @@ then
6963
6963
fi
6964
6964
6965
6965
# gh-109054: Check if -latomic is needed to get <pyatomic.h> atomic functions.
6966
- # On aarch64, GCC may require programs to be linked explicitly to libatomic.
6967
- # Use _Py_atomic_or_uint64() which may require libatomic __atomic_fetch_or_8()
6968
- # on Linux aarch64 (or not depending on the compiler and the compiler flags).
6966
+ # On Linux aarch64, GCC may require programs and libraries to be linked
6967
+ # explicitly to libatomic. Call _Py_atomic_or_uint64() which may require
6968
+ # libatomic __atomic_fetch_or_8(), or not, depending on the C compiler and the
6969
+ # compiler flags.
6969
6970
#
6970
6971
# Avoid #include <Python.h> or #include <pyport.h>. The <Python.h> header
6971
6972
# requires <pyconfig.h> header which is only written below by AC_OUTPUT below.
6972
- # If the check is done after AC_OUTPUT, modifying LIBS has no effect anymore.
6973
- # <pyport.h> cannot be included alone, it's designed to be included by
6974
- # <Python.h>: it expects other includes and macros to be defined.
6973
+ # If the check is done after AC_OUTPUT, modifying LIBATOMIC has no effect
6974
+ # anymore. <pyport.h> cannot be included alone, it's designed to be included
6975
+ # by <Python.h>: it expects other includes and macros to be defined.
6975
6976
_SAVE_VAR([ CPPFLAGS] )
6976
6977
CPPFLAGS="${BASECPPFLAGS} -I. -I${srcdir}/Include ${CPPFLAGS}"
6977
6978
@@ -6985,19 +6986,17 @@ AC_CACHE_CHECK([whether libatomic is needed by <pyatomic.h>],
6985
6986
#endif
6986
6987
// Code adapted from Include/pyport.h
6987
6988
#if HAVE_SSIZE_T
6988
- typedef ssize_t Py_ssize_t;
6989
+ typedef ssize_t Py_ssize_t;
6989
6990
#elif SIZEOF_VOID_P == SIZEOF_SIZE_T
6990
6991
typedef intptr_t Py_ssize_t;
6991
6992
#else
6992
- # error "unable to find a type fitting ssize_t "
6993
+ # error "unable to define Py_ssize_t "
6993
6994
#endif
6994
6995
6995
6996
#include "cpython/pyatomic.h"
6996
6997
6997
6998
int main()
6998
6999
{
6999
- // use _Py_atomic_or_uint64() which requires libatomic __atomic_fetch_or_8()
7000
- // on Linux aarch64.
7001
7000
uint64_t byte;
7002
7001
_Py_atomic_store_uint64(&byte, 2);
7003
7002
if (_Py_atomic_or_uint64(&byte, 8) != 2) {
0 commit comments