Skip to content

Conversation

@ktock
Copy link
Owner

@ktock ktock commented Jul 8, 2025

No description provided.

@ktock ktock changed the title support wasm64 build test wasm64 build Jul 8, 2025
@ktock ktock marked this pull request as draft July 8, 2025 09:15
@ktock ktock closed this Jul 10, 2025
@ktock ktock reopened this Jul 10, 2025
@ktock ktock closed this Jul 11, 2025
@ktock ktock reopened this Jul 11, 2025
@ktock ktock force-pushed the wasm64-tci-a branch 2 times, most recently from 4f494c2 to 47b738b Compare July 12, 2025 05:41
@ktock ktock closed this Jul 12, 2025
@ktock ktock reopened this Jul 12, 2025
@ktock ktock closed this Jul 13, 2025
@ktock ktock reopened this Jul 13, 2025
@ktock ktock closed this Jul 13, 2025
@ktock ktock reopened this Jul 13, 2025
wasm64 target enables 64bit pointers using Emscripten's -sMEMORY64=1
flag[1]. This enables QEMU to run 64bit guests.

Although the configure script uses "uname -m" as the fallback value when
"cpu" is empty, this can't be used for Emscripten which targets to Wasm.
So, in wasm build, this commit fixes configure to require --cpu flag to be
explicitly specified by the user.

[1] https://emscripten.org/docs/tools_reference/settings_reference.html#memory64

Signed-off-by: Kohei Tokunaga <[email protected]>
@ktock ktock force-pushed the wasm64-tci-a branch 2 times, most recently from 2f48120 to 3ac8cbe Compare August 2, 2025 13:10
@ktock ktock closed this Aug 3, 2025
@ktock ktock reopened this Aug 3, 2025
ktock added 2 commits August 6, 2025 17:55
Currently there are some engines that don't support wasm64 (e.g. unsupported
on Safari[1]). To mitigate this issue, the configure script allows the user
to use Emscripten's compatibility feature, "-sMEMORY64=2" flag[2].

Emscripten's "-sMEMORY64=2" flag still enables 64bit pointers in C code. But
this flag lowers the output binary into wasm32, with limiting the maximum
memory size to 4GB. So QEMU can run on wasm32 engines.

This commit adds a flag in the configure script to enable "-sMEMORY64=2"
mode.

[1] https://webassembly.org/features/
[2] https://emscripten.org/docs/tools_reference/settings_reference.html#memory64

Signed-off-by: Kohei Tokunaga <[email protected]>
This commit fixes Dockerfile of the wasm build to support both of wasm32 and
wasm64 build. Dockerfile takes the following build arguments and use these
values for building dependencies.

- TARGET_CPU: target wasm arch (wasm32 or wasm64)
- WASM64_MEMORY64: target -sMEMORY64 mode (1 or 2)

Signed-off-by: Kohei Tokunaga <[email protected]>
The wasm builds are tested for 3 targets: wasm32, wasm64(-sMEMORY64=1) and
wasm64(-sMEMORY64=2). The CI builds the containers using the same Dockerfile
(emsdk-wasm-cross.docker) with different build args.

Signed-off-by: Kohei Tokunaga <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants