wasmedge: update to 0.11.1 and enable arm

This commit is contained in:
Chongyun Lee 2022-10-05 17:47:31 +08:00 committed by Uchiha Kakashi
parent 6e9deb9336
commit a0b581b771
3 changed files with 89 additions and 24 deletions

View File

@ -3,15 +3,21 @@ TERMUX_PKG_DESCRIPTION="A lightweight, high-performance, and extensible WebAssem
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_LICENSE_FILE="LICENSE, LICENSE.spdx"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.10.1
TERMUX_PKG_VERSION=0.11.1
TERMUX_PKG_SRCURL=https://github.com/WasmEdge/WasmEdge/archive/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=f87bf06be0b94e8fcf974b6029f1f7ab46fd7526de33bff70d9cf4117512d07a
TERMUX_PKG_SHA256=85131c93811111424045dda6bd0ca012491b297638a0e7d9387391457aa1a301
TERMUX_PKG_DEPENDS="libc++, libllvm"
TERMUX_PKG_BUILD_DEPENDS="boost-headers, boost-static, libllvm-static, libpolly, lld, llvm"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DWASMEDGE_FORCE_DISABLE_LTO=ON
"
# WASMEDGE_BUILD_AOT_RUNTIME is not supported on 32-bit archs.
# See https://github.com/WasmEdge/WasmEdge/blob/2414c83047f2bf8fe241716be6ef8c0de34dc245/lib/aot/compiler.cpp#L4874
if [ $TERMUX_ARCH_BITS = 32 ]; then
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DWASMEDGE_BUILD_AOT_RUNTIME=OFF"
fi
# Build failure for i686 (0.9.1):
# ```
# [...]/wasmedge/src/thirdparty/wasi/api.hpp:55:1: error: static_assert failed
@ -26,27 +32,12 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
# /home/builder/.termux-build/wasmedge/src/lib/system/allocator.cpp:149:42: error: use of undeclared identifier 'PROT_READ'
# if (auto Pointer = mmap(nullptr, Size, PROT_READ | PROT_WRITE,
# ^
# Build failure for arm (0.10.1):
# [23/83] Building CXX object lib/plugin/CMakeFiles/wasmedgePlugin.dir/plugin.cpp.o
# FAILED: lib/plugin/CMakeFiles/wasmedgePlugin.dir/plugin.cpp.o
# ...
# In file included from /home/builder/.termux-build/wasmedge/src/lib/plugin/plugin.cpp:4:
# In file included from /home/builder/.termux-build/wasmedge/src/include/plugin/plugin.h:20:
# In file included from /home/builder/.termux-build/wasmedge/src/include/runtime/instance/module.h:24:
# /home/builder/.termux-build/wasmedge/src/include/runtime/instance/table.h:146:15: error: object of type
# 'std::__vector_base<WasmEdge::Variant<WasmEdge::UnknownRef, WasmEdge::FuncRef, WasmEdge::ExternRef>,
# std::allocator<WasmEdge::Variant<WasmEdge::UnknownRef,
# WasmEdge::FuncRef, WasmEdge::ExternRef>>>::value_type'
# (aka 'WasmEdge::Variant<WasmEdge::UnknownRef, WasmEdge::FuncRef, WasmEdge::ExternRef>')
# cannot be assigned because its copy assignment operator is implicitly deleted
# Refs[Idx] = Val;
# ^
# Both i686 and arm warning (0.10.1):
# /home/builder/.termux-build/wasmedge/src/lib/aot/compiler.cpp:1202:24: warning: unused variable 'VectorSize' [-Wunused-variable]
# const uint32_t VectorSize = IsFloat ? 4 : 2;
# ^
# Upstream doesnt seem to support 32bit platforms well
TERMUX_PKG_BLACKLISTED_ARCHES="arm, i686"
TERMUX_PKG_BLACKLISTED_ARCHES="i686"
termux_step_pre_configure() {
_NEED_DUMMY_LIBPTHREAD_A=

View File

@ -0,0 +1,74 @@
This reverts commit af59a11d976821c7775fecc1f5cad6c2b6fc728c.
diff --git a/include/common/variant.h b/include/common/variant.h
index dbfaad64..d1e6846f 100644
--- a/include/common/variant.h
+++ b/include/common/variant.h
@@ -35,7 +35,9 @@ union VariadicUnion<FirstT, RestT...> {
template <typename... Args>
constexpr VariadicUnion(std::in_place_index_t<0>, Args &&...Values)
- : First(std::forward<Args>(Values)...) {}
+ : First() {
+ ::new (&First) FirstT(std::forward<Args>(Values)...);
+ }
template <std::size_t N, typename... Args>
constexpr VariadicUnion(std::in_place_index_t<N>, Args &&...Values)
@@ -43,28 +45,28 @@ union VariadicUnion<FirstT, RestT...> {
template <typename T> constexpr const T &get() const &noexcept {
if constexpr (std::is_same_v<T, FirstT>) {
- return First;
+ return *std::launder(reinterpret_cast<const FirstT *>(&First));
} else {
return Rest.template get<T>();
}
}
template <typename T> constexpr T &get() &noexcept {
if constexpr (std::is_same_v<T, FirstT>) {
- return First;
+ return *std::launder(reinterpret_cast<FirstT *>(&First));
} else {
return Rest.template get<T>();
}
}
template <typename T> constexpr const T &&get() const &&noexcept {
if constexpr (std::is_same_v<T, FirstT>) {
- return std::move(First);
+ return std::move(*std::launder(reinterpret_cast<const FirstT *>(&First)));
} else {
return std::move(Rest).template get<T>();
}
}
template <typename T> constexpr T &&get() &&noexcept {
if constexpr (std::is_same_v<T, FirstT>) {
- return std::move(First);
+ return std::move(*std::launder(reinterpret_cast<FirstT *>(&First)));
} else {
return std::move(Rest).template get<T>();
}
@@ -74,7 +76,7 @@ union VariadicUnion<FirstT, RestT...> {
constexpr T &emplace(Args &&...Values) &noexcept {
if constexpr (std::is_same_v<T, FirstT>) {
::new (&First) FirstT(std::forward<Args>(Values)...);
- return *std::launder(&First);
+ return *std::launder(reinterpret_cast<FirstT *>(&First));
} else {
return Rest.template emplace<T>(std::forward<Args>(Values)...);
}
@@ -84,13 +86,13 @@ union VariadicUnion<FirstT, RestT...> {
constexpr T &emplace(Args &&...Values) &&noexcept {
if constexpr (std::is_same_v<T, FirstT>) {
::new (&First) FirstT(std::forward<Args>(Values)...);
- return std::move(*std::launder(&First));
+ return std::move(*std::launder(reinterpret_cast<FirstT *>(&First)));
} else {
return std::move(Rest).template emplace<T>(std::forward<Args>(Values)...);
}
}
- FirstT First;
+ std::aligned_storage_t<sizeof(FirstT), alignof(FirstT)> First;
VariadicUnion<RestT...> Rest;
};

View File

@ -64,14 +64,14 @@ diff -uNr WasmEdge/lib/host/wasi/wasifunc.cpp WasmEdge.mod/lib/host/wasi/wasifun
--- WasmEdge/lib/host/wasi/wasifunc.cpp 2022-07-28 18:56:12.000000000 +0800
+++ WasmEdge.mod/lib/host/wasi/wasifunc.cpp 2022-08-15 01:56:27.730339246 +0800
@@ -2061,7 +2061,7 @@
Expect<uint32_t>
WasiSockGetOpt::body(Runtime::Instance::MemoryInstance *MemInst, int32_t Fd,
uint32_t SockOptLevel, uint32_t SockOptName,
- uint32_t FlagPtr, uint32_t FlagSizePtr) {
+ uint32_t FlagPtr, socklen_t FlagSizePtr) {
Expect<uint32_t> WasiSockGetOpt::body(const Runtime::CallingFrame &Frame,
int32_t Fd, uint32_t SockOptLevel,
uint32_t SockOptName, uint32_t FlagPtr,
- uint32_t FlagSizePtr) {
+ socklen_t FlagSizePtr) {
auto *MemInst = Frame.getMemoryByIndex(0);
if (MemInst == nullptr) {
return __WASI_ERRNO_FAULT;
}
@@ -2080,7 +2080,7 @@
WasiSockOptName = *Res;
}