Port qemu-wasm backend to Espressif QEMU 9.2

This commit is contained in:
2026-07-19 21:40:41 -04:00
parent e712868ec5
commit fa545a4ec1
4 changed files with 17 additions and 10 deletions
Vendored
+2 -2
View File
@@ -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." \
+8 -4
View File
@@ -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 <glib.h>
#include <unistd.h>
@@ -1229,9 +1231,11 @@ if not get_option('slirp').auto() or have_system
slirp_cflags += ['-DLIBSLIRP_STATIC']
endif
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.
+2 -1
View File
@@ -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;
}
+2
View File
@@ -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