From 39123b090c14bd9e7749b18e6dd5e91b016c99b7 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Thu, 17 Mar 2022 14:22:43 +0000 Subject: [PATCH 1/3] bpo-46968: Check for 'sys/auxv.h' in the configure script --- .../2022-03-17-14-22-23.bpo-46968.4gz4NA.rst | 3 +++ Modules/faulthandler.c | 4 ++-- configure | 2 +- configure.ac | 2 +- pyconfig.h.in | 3 +++ 5 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2022-03-17-14-22-23.bpo-46968.4gz4NA.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-03-17-14-22-23.bpo-46968.4gz4NA.rst b/Misc/NEWS.d/next/Core and Builtins/2022-03-17-14-22-23.bpo-46968.4gz4NA.rst new file mode 100644 index 00000000000000..bef1d0532b0988 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2022-03-17-14-22-23.bpo-46968.4gz4NA.rst @@ -0,0 +1,3 @@ +Check for the existence of the "sys/auxv.h" header in :mod:`faulthandler` to +avoid compilation problems in systems where this header doesn't exist. Patch +by Pablo Galindo diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 744698cd7aba25..a32498cc17c288 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1,4 +1,4 @@ -#include "Python.h" +#include "Python.h" && defined(HAVE_SYS_AUXV_H) #include "pycore_initconfig.h" // _PyStatus_ERR #include "pycore_pyerrors.h" // _Py_DumpExtensionModules #include "pycore_pystate.h" // _PyThreadState_GET() @@ -26,7 +26,7 @@ # define FAULTHANDLER_USE_ALT_STACK #endif -#if defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_LINUX_AUXVEC_H) +#if defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_LINUX_AUXVEC_H) && defined(HAVE_SYS_AUXV_H) # include # include #endif diff --git a/configure b/configure index 4d585eba626a60..5fa6efaab4fb7c 100755 --- a/configure +++ b/configure @@ -8652,7 +8652,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h # checks for header files for ac_header in \ alloca.h asm/types.h bluetooth.h conio.h crypt.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \ - ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h linux/memfd.h linux/random.h linux/soundcard.h \ + ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/memfd.h linux/random.h linux/soundcard.h \ linux/tipc.h linux/wait.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \ sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \ sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \ diff --git a/configure.ac b/configure.ac index 81262ae38e5344..7a37ad279d0fcb 100644 --- a/configure.ac +++ b/configure.ac @@ -2375,7 +2375,7 @@ AC_DEFINE(STDC_HEADERS, 1, [Define to 1 if you have the ANSI C header files.]) # checks for header files AC_CHECK_HEADERS([ \ alloca.h asm/types.h bluetooth.h conio.h crypt.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \ - ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h linux/memfd.h linux/random.h linux/soundcard.h \ + ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/memfd.h linux/random.h linux/soundcard.h \ linux/tipc.h linux/wait.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \ sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \ sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \ diff --git a/pyconfig.h.in b/pyconfig.h.in index 1b84ee108fbfc8..40952883853e32 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -1188,6 +1188,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_AUDIOIO_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_AUXV_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_BSDTTY_H From 3fd6426915f1f7a961aca0abb8b93407901ea088 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Thu, 17 Mar 2022 16:35:53 +0000 Subject: [PATCH 2/3] Update Modules/faulthandler.c --- Modules/faulthandler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index a32498cc17c288..7a04195faa9c9d 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -1,4 +1,4 @@ -#include "Python.h" && defined(HAVE_SYS_AUXV_H) +#include "Python.h" #include "pycore_initconfig.h" // _PyStatus_ERR #include "pycore_pyerrors.h" // _Py_DumpExtensionModules #include "pycore_pystate.h" // _PyThreadState_GET() From 1488358da1738e8a05045777044a62e4a52a20a5 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Fri, 18 Mar 2022 11:39:40 +0000 Subject: [PATCH 3/3] Update Modules/faulthandler.c Co-authored-by: Victor Stinner --- Modules/faulthandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 7a04195faa9c9d..91f96665a4a308 100644 --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -27,8 +27,8 @@ #endif #if defined(FAULTHANDLER_USE_ALT_STACK) && defined(HAVE_LINUX_AUXVEC_H) && defined(HAVE_SYS_AUXV_H) -# include -# include +# include // AT_MINSIGSTKSZ +# include // getauxval() #endif /* Allocate at maximum 100 MiB of the stack to raise the stack overflow */