diff --git a/configure b/configure index 0827ad22a2..4a4b9e7754 100755 --- a/configure +++ b/configure @@ -341,7 +341,7 @@ EOF } if check_define __EMSCRIPTEN__ ; then - host_os=linux + host_os=emscripten elif check_define __linux__ ; then host_os=linux elif check_define _WIN32 ; then @@ -553,7 +553,7 @@ else host_bits=32 fi -if test -n "$host_arch" && { +if test -n "$host_arch" && test "$host_arch" != wasm32 && { ! test -d "$source_path/linux-user/include/host/$host_arch" || ! test -d "$source_path/common-user/host/$host_arch"; }; then error_exit "linux-user/include/host/$host_arch does not exist." \ diff --git a/meson.build b/meson.build index 2dda2e1e14..6e558969d4 100644 --- a/meson.build +++ b/meson.build @@ -45,7 +45,7 @@ genh = [] qapi_trace_events = [] bsd_oses = ['gnu/kfreebsd', 'freebsd', 'netbsd', 'openbsd', 'dragonfly', 'darwin'] -supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux'] +supported_oses = ['windows', 'freebsd', 'netbsd', 'openbsd', 'darwin', 'sunos', 'linux', 'emscripten'] supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64', 'arm', 'aarch64', 'loongarch64', 'mips', 'mips64', 'sparc64', 'wasm32'] @@ -309,6 +309,7 @@ endif # Compiler flags # ################## +if host_arch != 'wasm32' foreach lang : all_languages compiler = meson.get_compiler(lang) if compiler.get_id() == 'gcc' and compiler.version().version_compare('>=7.4') @@ -328,6 +329,7 @@ foreach lang : all_languages error('You either need GCC v7.4 or Clang v10.0 (or XCode Clang v15.0) to compile QEMU') endif endforeach +endif # default flags for all hosts # We use -fwrapv to tell the compiler that we require a C dialect where @@ -510,7 +512,7 @@ safe_stack_probe = ''' #endif return 0; }''' -if get_option('safe_stack') != not cc.compiles(safe_stack_probe) +if host_arch != 'wasm32' and get_option('safe_stack') != not cc.compiles(safe_stack_probe) safe_stack_arg = get_option('safe_stack') ? '-fsanitize=safe-stack' : '-fno-sanitize=safe-stack' if get_option('safe_stack') != not cc.compiles(safe_stack_probe, args: safe_stack_arg) error(get_option('safe_stack') \ @@ -520,7 +522,7 @@ if get_option('safe_stack') != not cc.compiles(safe_stack_probe) qemu_cflags += safe_stack_arg qemu_ldflags += safe_stack_arg endif -if get_option('safe_stack') and coroutine_backend != 'ucontext' +if host_arch != 'wasm32' and get_option('safe_stack') and coroutine_backend != 'ucontext' error('SafeStack is only supported with the ucontext coroutine backend') endif @@ -1018,7 +1020,7 @@ endif # problems on multi-arch where people try to build # 32-bit QEMU while pointing at 64-bit glib headers -if not cc.compiles(''' +if host_arch != 'wasm32' and not cc.compiles(''' #include #include @@ -1229,9 +1231,11 @@ if not get_option('slirp').auto() or have_system slirp_cflags += ['-DLIBSLIRP_STATIC'] endif - slirp = declare_dependency(dependencies: [slirp_dep], - compile_args: slirp_cflags, - version: slirp_dep.version()) + if slirp_dep.found() + slirp = declare_dependency(dependencies: [slirp_dep], + compile_args: slirp_cflags, + version: slirp_dep.version()) + endif # slirp < 4.7 is incompatible with CFI support in QEMU. This is because # it passes function pointers within libslirp as callbacks for timers. diff --git a/tcg/wasm32/tcg-target.c.inc b/tcg/wasm32/tcg-target.c.inc index 3c85588be9..9e82297a3f 100644 --- a/tcg/wasm32/tcg-target.c.inc +++ b/tcg/wasm32/tcg-target.c.inc @@ -3776,7 +3776,8 @@ void tcg_out_init() { } /* Test if a constant matches the constraint. */ -static bool tcg_target_const_match(int64_t val, TCGType type, int ct, int vece) +static bool tcg_target_const_match(int64_t val, int ct, TCGType type, + TCGCond cond, int vece) { return ct & TCG_CT_CONST; } diff --git a/tcg/wasm32/tcg-target.h b/tcg/wasm32/tcg-target.h index 37ad4b93c8..7346c3a76e 100644 --- a/tcg/wasm32/tcg-target.h +++ b/tcg/wasm32/tcg-target.h @@ -93,6 +93,8 @@ #define TCG_TARGET_HAS_orc_i64 1 #define TCG_TARGET_HAS_rot_i64 1 #define TCG_TARGET_HAS_negsetcond_i64 0 +#define TCG_TARGET_HAS_tst 0 +#define TCG_TARGET_HAS_tst_vec 0 #define TCG_TARGET_HAS_movcond_i64 1 #define TCG_TARGET_HAS_muls2_i64 0 #define TCG_TARGET_HAS_add2_i32 1