]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-111046: for wasi-threads, export memory as well via the linker (GH-111099...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 20 Oct 2023 22:23:15 +0000 (00:23 +0200)
committerGitHub <noreply@github.com>
Fri, 20 Oct 2023 22:23:15 +0000 (22:23 +0000)
gh-111046: for wasi-threads, export memory as well via the linker (GH-111099)
(cherry picked from commit 5dfa71769f547fffa893a89b0b04d963a41b2441)

Co-authored-by: YAMAMOTO Takashi <yamamoto@midokura.com>
Misc/NEWS.d/next/Build/2023-10-20-15-29-31.gh-issue-111046.2DxQl8.rst [new file with mode: 0644]
configure
configure.ac

diff --git a/Misc/NEWS.d/next/Build/2023-10-20-15-29-31.gh-issue-111046.2DxQl8.rst b/Misc/NEWS.d/next/Build/2023-10-20-15-29-31.gh-issue-111046.2DxQl8.rst
new file mode 100644 (file)
index 0000000..446b8b6
--- /dev/null
@@ -0,0 +1 @@
+For wasi-threads, memory is now exported to fix compatibility issues with some wasm runtimes.
index 0240ff86dccbf95867304b2e523abaea8993f48e..7c3250729c89d31ea562304379139685487ae7a4 100755 (executable)
--- a/configure
+++ b/configure
@@ -9439,10 +9439,15 @@ then :
       # without this, configure fails to find pthread_create, sem_init,
       # etc because they are only available in the sysroot for
       # wasm32-wasi-threads.
+      # Note: wasi-threads requires --import-memory.
+      # Note: wasi requires --export-memory.
+      # Note: --export-memory is implicit unless --import-memory is given
+      # Note: this requires LLVM >= 16.
       as_fn_append CFLAGS " -target wasm32-wasi-threads -pthread"
       as_fn_append CFLAGS_NODIST " -target wasm32-wasi-threads -pthread"
       as_fn_append LDFLAGS_NODIST " -target wasm32-wasi-threads -pthread"
       as_fn_append LDFLAGS_NODIST " -Wl,--import-memory"
+      as_fn_append LDFLAGS_NODIST " -Wl,--export-memory"
       as_fn_append LDFLAGS_NODIST " -Wl,--max-memory=10485760"
 
 fi
index 34e0653623dd6ede2ebdc3a3ae63e69e141448bd..3afa9aca8bbd43c1af4d5d4b9aea87c86be1dbf0 100644 (file)
@@ -2326,10 +2326,15 @@ AS_CASE([$ac_sys_system],
       # without this, configure fails to find pthread_create, sem_init,
       # etc because they are only available in the sysroot for
       # wasm32-wasi-threads.
+      # Note: wasi-threads requires --import-memory.
+      # Note: wasi requires --export-memory.
+      # Note: --export-memory is implicit unless --import-memory is given
+      # Note: this requires LLVM >= 16.
       AS_VAR_APPEND([CFLAGS], [" -target wasm32-wasi-threads -pthread"])
       AS_VAR_APPEND([CFLAGS_NODIST], [" -target wasm32-wasi-threads -pthread"])
       AS_VAR_APPEND([LDFLAGS_NODIST], [" -target wasm32-wasi-threads -pthread"])
       AS_VAR_APPEND([LDFLAGS_NODIST], [" -Wl,--import-memory"])
+      AS_VAR_APPEND([LDFLAGS_NODIST], [" -Wl,--export-memory"])
       AS_VAR_APPEND([LDFLAGS_NODIST], [" -Wl,--max-memory=10485760"])
     ])