From 0281300fef325bb0803e65c43f1cbb44ae99099f Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 20 Oct 2023 15:20:20 +0900 Subject: [PATCH 1/3] configure.ac: wasi-threads: export memory as well --- configure.ac | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure.ac b/configure.ac index cd69f0ede54496..daa59b2737bae9 100644 --- a/configure.ac +++ b/configure.ac @@ -2162,10 +2162,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"]) ]) From 3b7bd72016641b369a3859fbd135ce7c1d5599b8 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 20 Oct 2023 15:20:42 +0900 Subject: [PATCH 2/3] configure: regen --- configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure b/configure index c87f518382f2ec..3bf92ddb8fcb40 100755 --- a/configure +++ b/configure @@ -9268,10 +9268,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 From 10370e6e5d0fe526ff8b22fdf0bf6d1f1febff9b Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 20 Oct 2023 15:32:01 +0900 Subject: [PATCH 3/3] add news entry --- .../next/Build/2023-10-20-15-29-31.gh-issue-111046.2DxQl8.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2023-10-20-15-29-31.gh-issue-111046.2DxQl8.rst 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 index 00000000000000..446b8b612862f9 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-10-20-15-29-31.gh-issue-111046.2DxQl8.rst @@ -0,0 +1 @@ +For wasi-threads, memory is now exported to fix compatibility issues with some wasm runtimes.