qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kohei Tokunaga <ktokunaga.mail@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	"Daniel P . Berrangé" <berrange@redhat.com>,
	"WANG Xuerui" <git@xen0n.name>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Huacai Chen" <chenhuacai@kernel.org>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Aleksandar Rikalo" <arikalo@gmail.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Stefan Weil" <sw@weilnetz.de>,
	qemu-arm@nongnu.org, qemu-riscv@nongnu.org,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
	ktokunaga.mail@gmail.com
Subject: [PATCH v2 03/35] dockerfiles: Add support for wasm64 to the wasm Dockerfile
Date: Wed, 27 Aug 2025 01:10:08 +0900	[thread overview]
Message-ID: <dd1d5aee5cc69ad95f6cf11106cf020bc3bc4b59.1756216429.git.ktokunaga.mail@gmail.com> (raw)
In-Reply-To: <cover.1756216429.git.ktokunaga.mail@gmail.com>

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 <ktokunaga.mail@gmail.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 MAINTAINERS                                   |  2 +-
 ...2-cross.docker => emsdk-wasm-cross.docker} | 29 ++++++++++++++-----
 2 files changed, 23 insertions(+), 8 deletions(-)
 rename tests/docker/dockerfiles/{emsdk-wasm32-cross.docker => emsdk-wasm-cross.docker} (85%)

V2:
- This commit is under review in another patch series so please ignore it
  here.

diff --git a/MAINTAINERS b/MAINTAINERS
index a07086ed76..433a44118d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -647,7 +647,7 @@ F: include/system/os-wasm.h
 F: os-wasm.c
 F: util/coroutine-wasm.c
 F: configs/meson/emscripten.txt
-F: tests/docker/dockerfiles/emsdk-wasm32-cross.docker
+F: tests/docker/dockerfiles/emsdk-wasm-cross.docker
 
 Alpha Machines
 --------------
diff --git a/tests/docker/dockerfiles/emsdk-wasm32-cross.docker b/tests/docker/dockerfiles/emsdk-wasm-cross.docker
similarity index 85%
rename from tests/docker/dockerfiles/emsdk-wasm32-cross.docker
rename to tests/docker/dockerfiles/emsdk-wasm-cross.docker
index 60a7d02f56..4b41be62ab 100644
--- a/tests/docker/dockerfiles/emsdk-wasm32-cross.docker
+++ b/tests/docker/dockerfiles/emsdk-wasm-cross.docker
@@ -1,14 +1,17 @@
 # syntax = docker/dockerfile:1.5
 
-ARG EMSDK_VERSION_QEMU=3.1.50
+ARG EMSDK_VERSION_QEMU=4.0.10
 ARG ZLIB_VERSION=1.3.1
 ARG GLIB_MINOR_VERSION=2.84
 ARG GLIB_VERSION=${GLIB_MINOR_VERSION}.0
 ARG PIXMAN_VERSION=0.44.2
-ARG FFI_VERSION=v3.4.7
+ARG FFI_VERSION=v3.5.2
 ARG MESON_VERSION=1.5.0
+ARG TARGET_CPU=wasm32
+ARG WASM64_MEMORY64=0
 
-FROM emscripten/emsdk:$EMSDK_VERSION_QEMU AS build-base
+FROM emscripten/emsdk:$EMSDK_VERSION_QEMU AS build-base-common
+ARG TARGET_CPU
 ARG MESON_VERSION
 ENV TARGET=/builddeps/target
 ENV CPATH="$TARGET/include"
@@ -33,8 +36,8 @@ RUN <<EOF
 cat <<EOT > /cross.meson
 [host_machine]
 system = 'emscripten'
-cpu_family = 'wasm32'
-cpu = 'wasm32'
+cpu_family = '${TARGET_CPU}'
+cpu = '${TARGET_CPU}'
 endian = 'little'
 
 [binaries]
@@ -46,6 +49,16 @@ pkgconfig = ['pkg-config', '--static']
 EOT
 EOF
 
+FROM build-base-common AS build-base-wasm32
+
+FROM build-base-common AS build-base-wasm64
+ARG WASM64_MEMORY64
+ENV CFLAGS="$CFLAGS -sMEMORY64=${WASM64_MEMORY64}"
+ENV CXXFLAGS="$CXXFLAGS -sMEMORY64=${WASM64_MEMORY64}"
+ENV LDFLAGS="$LDFLAGS -sMEMORY64=${WASM64_MEMORY64}"
+
+FROM build-base-${TARGET_CPU} AS build-base
+
 FROM build-base AS zlib-dev
 ARG ZLIB_VERSION
 RUN mkdir -p /zlib
@@ -56,17 +69,19 @@ RUN emconfigure ./configure --prefix=$TARGET --static
 RUN emmake make install -j$(nproc)
 
 FROM build-base AS libffi-dev
+ARG TARGET_CPU
+ARG WASM64_MEMORY64
 ARG FFI_VERSION
 RUN mkdir -p /libffi
 RUN git clone https://github.com/libffi/libffi /libffi
 WORKDIR /libffi
 RUN git checkout $FFI_VERSION
 RUN autoreconf -fiv
-RUN emconfigure ./configure --host=wasm32-unknown-linux \
+RUN emconfigure ./configure --host=${TARGET_CPU}-unknown-linux \
     --prefix=$TARGET --enable-static \
     --disable-shared --disable-dependency-tracking \
     --disable-builddir --disable-multi-os-directory \
-    --disable-raw-api --disable-docs
+    --disable-raw-api --disable-docs WASM64_MEMORY64=${WASM64_MEMORY64}
 RUN emmake make install SUBDIRS='include' -j$(nproc)
 
 FROM build-base AS pixman-dev
-- 
2.43.0



  parent reply	other threads:[~2025-08-26 16:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-26 16:10 [PATCH v2 00/35] wasm: Add Wasm TCG backend based on wasm64 Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 01/35] meson: Add wasm64 support to the --cpu flag Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 02/35] configure: Enable to propagate -sMEMORY64 flag to Emscripten Kohei Tokunaga
2025-08-26 16:10 ` Kohei Tokunaga [this message]
2025-08-26 16:10 ` [PATCH v2 04/35] .gitlab-ci.d: Add build tests for wasm64 Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 05/35] tcg/wasm: Add tcg-target.h and tcg-target-reg-bits.h Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 06/35] tcg/wasm: Add register-related definitions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 07/35] tcg/wasm: Add constraint definitions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 08/35] tcg/wasm: Add relocation callbacks Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 09/35] tcg/wasm: Add and/or/xor instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 10/35] tcg/wasm: Add add/sub/mul instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 11/35] tcg/wasm: Add shl/shr/sar instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 12/35] tcg/wasm: Add setcond/negsetcond/movcond instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 13/35] tcg/wasm: Add sextract instruction Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 14/35] tcg/wasm: Add load and store instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 15/35] tcg/wasm: Add mov/movi instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 16/35] tcg/wasm: Add ext instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 17/35] tcg/wasm: Add div/rem instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 18/35] tcg/wasm: Add neg/ctpop instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 19/35] tcg/wasm: Add rot/clz/ctz instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 20/35] tcg/wasm: Add br/brcond instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 21/35] tcg/wasm: Add exit_tb/goto_tb/goto_ptr instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 22/35] tcg/wasm: Add call instruction Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 23/35] tcg/wasm: Add qemu_ld/qemu_st instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 24/35] tcg/wasm: Add mb instruction Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 25/35] tcg/wasm: Mark unimplemented instructions Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 26/35] tcg/wasm: Add initialization of fundamental registers Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 27/35] tcg/wasm: Write wasm binary to TB Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 28/35] tcg/wasm: Implement instantiation of Wasm binary Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 29/35] tcg/wasm: Allow switching coroutine from a helper Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 30/35] tcg/wasm: Enable instantiation of TBs executed many times Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 31/35] tcg/wasm: Enable TLB lookup Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 32/35] tcg/wasm: Add tcg_target_init function Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 33/35] meson.build: enable to build Wasm backend Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 34/35] meson.build: Propagate optimization flag for linking on Emscripten Kohei Tokunaga
2025-08-26 16:10 ` [PATCH v2 35/35] .gitlab-ci.d: build wasm backend in CI Kohei Tokunaga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dd1d5aee5cc69ad95f6cf11106cf020bc3bc4b59.1756216429.git.ktokunaga.mail@gmail.com \
    --to=ktokunaga.mail@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=alex.bennee@linaro.org \
    --cc=arikalo@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=berrange@redhat.com \
    --cc=chenhuacai@kernel.org \
    --cc=git@xen0n.name \
    --cc=jiaxun.yang@flygoat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@redhat.com \
    --cc=sw@weilnetz.de \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).