[3.12] gh-111046: for wasi-threads, export memory as well via the linker (GH-111099) (GH-111141)

gh-111046: for wasi-threads, export memory as well via the linker (GH-111099)
(cherry picked from commit 5dfa71769f)

Co-authored-by: YAMAMOTO Takashi <yamamoto@midokura.com>
This commit is contained in:
Miss Islington (bot) 2023-10-21 00:23:15 +02:00 committed by GitHub
parent 4a1026077a
commit 727f8ee31c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View file

@ -0,0 +1 @@
For wasi-threads, memory is now exported to fix compatibility issues with some wasm runtimes.

5
configure generated vendored
View file

@ -9439,10 +9439,15 @@ then :
# without this, configure fails to find pthread_create, sem_init, # without this, configure fails to find pthread_create, sem_init,
# etc because they are only available in the sysroot for # etc because they are only available in the sysroot for
# wasm32-wasi-threads. # 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 " -target wasm32-wasi-threads -pthread"
as_fn_append CFLAGS_NODIST " -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 " -target wasm32-wasi-threads -pthread"
as_fn_append LDFLAGS_NODIST " -Wl,--import-memory" 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" as_fn_append LDFLAGS_NODIST " -Wl,--max-memory=10485760"
fi fi

View file

@ -2326,10 +2326,15 @@ AS_CASE([$ac_sys_system],
# without this, configure fails to find pthread_create, sem_init, # without this, configure fails to find pthread_create, sem_init,
# etc because they are only available in the sysroot for # etc because they are only available in the sysroot for
# wasm32-wasi-threads. # 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], [" -target wasm32-wasi-threads -pthread"])
AS_VAR_APPEND([CFLAGS_NODIST], [" -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], [" -target wasm32-wasi-threads -pthread"])
AS_VAR_APPEND([LDFLAGS_NODIST], [" -Wl,--import-memory"]) 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"]) AS_VAR_APPEND([LDFLAGS_NODIST], [" -Wl,--max-memory=10485760"])
]) ])