]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-90473: Increase stack size, disable obmalloc on WASI (GH-92732)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 13 May 2022 07:00:33 +0000 (00:00 -0700)
committerGitHub <noreply@github.com>
Fri, 13 May 2022 07:00:33 +0000 (00:00 -0700)
(cherry picked from commit d81d57e9598dea741e049f3876ccd87072a38906)

Co-authored-by: Christian Heimes <christian@python.org>
Lib/test/support/os_helper.py
Lib/test/test_builtin.py
Misc/NEWS.d/next/Build/2022-05-12-10-19-15.gh-issue-90473.-syvqK.rst [new file with mode: 0644]
configure
configure.ac

index eee37ef0d5a7138d823ed4b4167fc19a980b58c3..ed4ec15c7cbe92bede9b9236e2fe9188bd99290a 100644 (file)
@@ -50,7 +50,7 @@ if os.name == 'nt':
                   % (TESTFN_UNENCODABLE, sys.getfilesystemencoding()))
             TESTFN_UNENCODABLE = None
 # macOS and Emscripten deny unencodable filenames (invalid utf-8)
-elif sys.platform not in {'darwin', 'emscripten'}:
+elif sys.platform not in {'darwin', 'emscripten', 'wasi'}:
     try:
         # ascii and utf-8 cannot encode the byte 0xff
         b'\xff'.decode(sys.getfilesystemencoding())
index ba7a7e20d7dcdad51cd0d51427a7b203f7ef4d0c..efa9459a58629d7fe8c7889900edd33f8b63679c 100644 (file)
@@ -393,7 +393,10 @@ class BuiltinTest(unittest.TestCase):
                                 msg=f"source={source} mode={mode}")
 
 
-    @unittest.skipIf(support.is_emscripten, "socket.accept is broken")
+    @unittest.skipIf(
+        support.is_emscripten or support.is_wasi,
+        "socket.accept is broken"
+    )
     def test_compile_top_level_await(self):
         """Test whether code some top level await can be compiled.
 
diff --git a/Misc/NEWS.d/next/Build/2022-05-12-10-19-15.gh-issue-90473.-syvqK.rst b/Misc/NEWS.d/next/Build/2022-05-12-10-19-15.gh-issue-90473.-syvqK.rst
new file mode 100644 (file)
index 0000000..29ce3de
--- /dev/null
@@ -0,0 +1 @@
+Disable pymalloc and increase stack size on ``wasm32-wasi``.
index a4ef0e50902cbeb988c5beec7b5bf8b2907a79ec..286a94946a08391817afde510aeb65ff533f22a0 100755 (executable)
--- a/configure
+++ b/configure
@@ -7922,6 +7922,8 @@ $as_echo "#define _WASI_EMULATED_PROCESS_CLOCKS 1" >>confdefs.h
     LIBS="$LIBS -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks"
     echo "#define _WASI_EMULATED_SIGNAL 1" >> confdefs.h
 
+            as_fn_append LDFLAGS_NODIST " -z stack-size=524288 -Wl,--stack-first -Wl,--initial-memory=10485760"
+
  ;; #(
   *) :
      ;;
@@ -14231,19 +14233,26 @@ int domain = AF_INET6;
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
   ipv6=yes
 
 else
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
   ipv6=no
 
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+case $ac_sys_system in #(
+  WASI) :
+    ipv6=no
+ ;; #(
+  *) :
+     ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6" >&5
+$as_echo "$ipv6" >&6; }
+
 if test "$ipv6" = "yes"; then
        { $as_echo "$as_me:${as_lineno-$LINENO}: checking if RFC2553 API is available" >&5
 $as_echo_n "checking if RFC2553 API is available... " >&6; }
@@ -14557,6 +14566,8 @@ then
     case $ac_sys_system in #(
   Emscripten) :
     with_pymalloc="no" ;; #(
+  WASI) :
+    with_pymalloc="no" ;; #(
   *) :
     with_pymalloc="yes"
    ;;
@@ -22597,6 +22608,12 @@ case $ac_sys_system in #(
      ;; #(
   WASI/*) :
 
+
+
+    py_cv_module__ctypes_test=n/a
+    py_cv_module_=n/a
+
+
      ;; #(
   *) :
      ;;
index c27d4ca3b569c10090d9279e677cbd3b292d4bf2..693f79bba0849b3ef48a6888ec16f2d946f2a435 100644 (file)
@@ -1994,6 +1994,10 @@ AS_CASE([$ac_sys_system],
     AC_DEFINE([_WASI_EMULATED_PROCESS_CLOCKS], [1], [Define to 1 if you want to emulate process clocks on WASI])
     LIBS="$LIBS -lwasi-emulated-signal -lwasi-emulated-getpid -lwasi-emulated-process-clocks"
     echo "#define _WASI_EMULATED_SIGNAL 1" >> confdefs.h
+
+    dnl increase initial memory and stack size, move stack first
+    dnl https://github.com/WebAssembly/wasi-libc/issues/233
+    AS_VAR_APPEND([LDFLAGS_NODIST], [" -z stack-size=524288 -Wl,--stack-first -Wl,--initial-memory=10485760"])
   ]
 )
 
@@ -4046,13 +4050,17 @@ dnl the check does not work on cross compilation case...
 #include <sys/types.h>
 #include <sys/socket.h>]],
 [[int domain = AF_INET6;]])],[
-  AC_MSG_RESULT(yes)
   ipv6=yes
 ],[
-  AC_MSG_RESULT(no)
   ipv6=no
 ])
 
+AS_CASE([$ac_sys_system],
+  [WASI], [ipv6=no]
+)
+
+AC_MSG_RESULT([$ipv6])
+
 if test "$ipv6" = "yes"; then
        AC_MSG_CHECKING(if RFC2553 API is available)
        AC_COMPILE_IFELSE([
@@ -4232,9 +4240,10 @@ AC_ARG_WITH(pymalloc,
 
 if test -z "$with_pymalloc"
 then
-  dnl default to yes except for wasm32-emscripten
+  dnl default to yes except for wasm32-emscripten and wasm32-wasi.
   AS_CASE([$ac_sys_system],
     [Emscripten], [with_pymalloc="no"],
+    [WASI], [with_pymalloc="no"],
     [with_pymalloc="yes"]
   )
 fi
@@ -6680,7 +6689,11 @@ AS_CASE([$ac_sys_system],
         )
       ],
       [Emscripten/node*], [],
-      [WASI/*], []
+      [WASI/*], [
+        PY_STDLIB_MOD_SET_NA(
+          [_ctypes_test],
+        )
+      ]
     )
   ],
   [PY_STDLIB_MOD_SET_NA([_scproxy])]