From 90a7bb508c7e5b67ab10e52d52e2d5fa92bd7a63 Mon Sep 17 00:00:00 2001 From: Maksim Bondarenkov <119937608+ognevny@users.noreply.github.com> Date: Sun, 6 Oct 2024 07:12:03 +0300 Subject: [PATCH] wasmer: update to 4.4.0 --- mingw-w64-wasmer/.gitignore | 1 + mingw-w64-wasmer/PKGBUILD | 18 +- .../corosensei-fix-compilation.patch | 225 ++++++++++++++++++ mingw-w64-wasmer/tun-tap-update-tokio.patch | 2 +- 4 files changed, 240 insertions(+), 6 deletions(-) create mode 100644 mingw-w64-wasmer/.gitignore create mode 100644 mingw-w64-wasmer/corosensei-fix-compilation.patch diff --git a/mingw-w64-wasmer/.gitignore b/mingw-w64-wasmer/.gitignore new file mode 100644 index 0000000000..13a97f0019 --- /dev/null +++ b/mingw-w64-wasmer/.gitignore @@ -0,0 +1 @@ +/wasmer diff --git a/mingw-w64-wasmer/PKGBUILD b/mingw-w64-wasmer/PKGBUILD index 791666fc09..8e34e83f01 100644 --- a/mingw-w64-wasmer/PKGBUILD +++ b/mingw-w64-wasmer/PKGBUILD @@ -3,7 +3,7 @@ _realname=wasmer pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" -pkgver=4.3.7 +pkgver=4.4.0 pkgrel=1 pkgdesc="Universal Binaries Powered by WebAssembly (mingw-w64)" arch=('any') @@ -18,12 +18,16 @@ makedepends=("${MINGW_PACKAGE_PREFIX}-rust" 'git') options=('!lto') source=("git+${url}.git#tag=v${pkgver}" + "corosensei.tar.gz::https://crates.io/api/v1/crates/corosensei/0.1.4/download" "tun-tap.tar.gz::https://crates.io/api/v1/crates/tun-tap/0.1.4/download" + "corosensei-fix-compilation.patch" "tun-tap-update-tokio.patch" "reproducible-builds.patch") -sha256sums=('4cfa4b840cae71114d2922bb03b13660fe613dcc694bfe90616f5931dc550bed' +sha256sums=('1ab4b4b98cd1442b8b23336f78f7e0f2e167985bd50c5f923dbc6eeee56a9d1d' + '80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e' '9a477a4e9367c72ac875d23cd07ac99ffa932497d8428767fed0cfa27bbabe50' - 'e4ccc94dfe30033080fee5f0f773f29f94ae0c7a3f075178a6417a646307874b' + '1636cded85171dc138c68e81336823e2db1e269e744c428426ab05157b41cf34' + '684f6a479385e3646b82d5d6588d9290a78708a59dec4aab7af76a0f23aaa249' '7f08b41e0077a23b16eb2e9410ac953b293d1eeeaf1b83915a596ac437f81125') prepare() { @@ -31,16 +35,20 @@ prepare() { rm rust-toolchain patch -Np1 -i "../reproducible-builds.patch" - # update tokio in tun-tap dependency so outdated winapi@0.2.8, kerenel32-sys and ws2_32-sys are dropped + # update old dependencies in corosensei and tun-tap crates so outdated winapi@0.2.8, + # kernel32-sys, ws2_32-sys and windows-sys@0.33.0 are dropped; fix compile error in corosensei mv -f ../tun-tap-0.1.4/Cargo.toml.orig ../tun-tap-0.1.4/Cargo.toml + mv -f ../corosensei-0.1.4/Cargo.toml.orig ../corosensei-0.1.4/Cargo.toml + patch -d ../corosensei-0.1.4 -Np1 -i "../corosensei-fix-compilation.patch" patch -d ../tun-tap-0.1.4 -Np1 -i "../tun-tap-update-tokio.patch" cat >> Cargo.toml < + // point to "0". We use an intermediate constant here to work around a + // limitation of LLVM's Intel syntax parser which doesn't support 2 + // symbols in an expression. +- ".equ .Loffset_yield, 0f - 2b", ++ ".equ .Loffset_yield, 3f - 2b", + "add dword ptr [esp], offset .Loffset_yield", + + // Save our stack pointer to EDX, which is then returned out of +@@ -325,7 +325,7 @@ pub unsafe fn switch_yield(arg: EncodedValue, parent_link: *mut StackPointer) -> + // - EAX points to the top of our stack. + // - EDX points to the base of our stack. + // - ECX contains the argument passed from switch_and_link. +- "0:", ++ "3:", + + // Save the EBP of the parent context to the parent stack. + "push ebp", +@@ -402,7 +402,7 @@ pub unsafe fn switch_and_throw( + // about how this code works. + "call 2f", + "2:", +- ".equ .Loffset_throw, 0f - 2b", ++ ".equ .Loffset_throw, 3f - 2b", + "add dword ptr [esp], offset .Loffset_throw", + + // Save EBP of the parent context. +@@ -437,7 +437,7 @@ pub unsafe fn switch_and_throw( + + // Upon returning, our register state is just like a normal return into + // switch_and_link(). +- "0:", ++ "3:", + + // Restore registers just like the second half of switch_and_link. + "pop esi", +--- a/src/arch/x86_64.rs ++++ b/src/arch/x86_64.rs +@@ -345,7 +345,7 @@ pub unsafe fn switch_and_link( + // Push a return address onto our stack and then jump to the return + // address at the top of the coroutine stack. + // +- // From here on execution continues in stack_init_trampoline or the 0: ++ // From here on execution continues in stack_init_trampoline or the 2: + // label in switch_yield. + "call [rdx]", + +@@ -423,7 +423,7 @@ pub unsafe fn switch_yield(arg: EncodedValue, parent_link: *mut StackPointer) -> + + // Push a return address on the stack. This is the address that will be + // called by switch_and_link() the next time this context is resumed. +- "lea rax, [rip + 0f]", ++ "lea rax, [rip + 2f]", + "push rax", + + // Save our stack pointer to RSI, which is then returned out of +@@ -458,7 +458,7 @@ pub unsafe fn switch_yield(arg: EncodedValue, parent_link: *mut StackPointer) -> + // - RDX points to the top of our stack, including the return address. + // - RSI points to the base of our stack. + // - RDI contains the argument passed from switch_and_link. +- "0:", ++ "2:", + + // Save the RBP of the parent context to the parent stack. When combined + // with the return address this forms a valid frame record (RBP & RIP) +@@ -554,7 +554,7 @@ pub unsafe fn switch_and_throw( + "push rbx", + + // Push a return address to the stack. +- "lea rax, [rip + 0f]", ++ "lea rax, [rip + 2f]", + "push rax", + + // Save RBP of the parent context. +@@ -589,7 +589,7 @@ pub unsafe fn switch_and_throw( + + // Upon returning, our register state is just like a normal return into + // switch_and_link(). +- "0:", ++ "2:", + + // Restore registers just like the second half of switch_and_link. + "pop rbx", +--- a/src/arch/x86_64_windows.rs ++++ b/src/arch/x86_64_windows.rs +@@ -330,7 +330,7 @@ pub unsafe fn switch_and_link( + asm_may_unwind_root!( + // Set up a secondary copy of the return address. This is only used by + // the unwinder, not by actual returns. +- "lea rax, [rip + 0f]", ++ "lea rax, [rip + 2f]", + "push rax", + + // Save the TEB fields to the stack. +@@ -345,7 +345,7 @@ pub unsafe fn switch_and_link( + // Push a return address onto our stack and then jump to the return + // address at the top of the coroutine stack. + // +- // From here on execution continues in stack_init_trampoline or the 0: ++ // From here on execution continues in stack_init_trampoline or the 2: + // label in switch_yield. + "call [rdx]", + +@@ -354,7 +354,7 @@ pub unsafe fn switch_and_link( + // - RSI: The top of the coroutine stack, or 0 if coming from + // switch_and_reset. + // - RDI: The argument passed from the coroutine. +- "0:", ++ "2:", + + "pop rbx", + +@@ -405,7 +405,7 @@ pub unsafe fn switch_yield(arg: EncodedValue, parent_link: *mut StackPointer) -> + + // Push a return address on the stack. This is the address that will be + // called by switch_and_link() the next time this context is resumed. +- "lea rax, [rip + 0f]", ++ "lea rax, [rip + 2f]", + "push rax", + + // Save our stack pointer to RSI, which is then returned out of +@@ -429,7 +429,7 @@ pub unsafe fn switch_yield(arg: EncodedValue, parent_link: *mut StackPointer) -> + // - RDX points to the top of our stack, including the return address. + // - RSI points to the base of our stack. + // - RDI contains the argument passed from switch_and_link. +- "0:", ++ "2:", + + // Save RBP from the parent context last to create a valid frame record. + "push rbp", +@@ -513,7 +513,7 @@ pub unsafe fn switch_and_throw( + + asm_may_unwind_root!( + // Save state just like the first half of switch_and_link(). +- "lea rax, [rip + 0f]", ++ "lea rax, [rip + 2f]", + "push rax", + "push qword ptr gs:[0x1748]", // GuaranteedStackBytes + "push qword ptr gs:[0x1478]", // DeallocationStack +@@ -556,7 +556,7 @@ pub unsafe fn switch_and_throw( + + // Upon returning, our register state is just like a normal return into + // switch_and_link(). +- "0:", ++ "2", + + // This is copied from the second half of switch_and_link(). + "pop rbx", +--- a/src/arch/x86_windows.rs ++++ b/src/arch/x86_windows.rs +@@ -411,7 +411,7 @@ pub unsafe fn switch_and_link( + // Push a return address onto our stack and then jump to the return + // address at the top of the coroutine stack. + // +- // From here on execution continues in stack_init_trampoline or the 0: ++ // From here on execution continues in stack_init_trampoline or the 3: + // label in switch_yield. + "call [eax]", + +@@ -420,7 +420,6 @@ pub unsafe fn switch_and_link( + // - EDX: The top of the coroutine stack, or 0 if coming from + // switch_and_reset. + // - ECX: The argument passed from the coroutine. +- "0:", + + "pop esi", + +@@ -480,7 +479,7 @@ pub unsafe fn switch_yield(arg: EncodedValue, parent_link: *mut StackPointer) -> + // point to "0". We use an intermediate constant here to work around a + // limitation of LLVM's Intel syntax parser which doesn't support 2 + // symbols in an expression. +- ".equ .Loffset_yield, 0f - 2b", ++ ".equ .Loffset_yield, 3f - 2b", + "add dword ptr [esp], offset .Loffset_yield", + + // Save our stack pointer to EDX, which is then returned out of +@@ -514,7 +513,7 @@ pub unsafe fn switch_yield(arg: EncodedValue, parent_link: *mut StackPointer) -> + // - EAX points to the top of our stack. + // - EDX points to the base of our stack. + // - ECX contains the argument passed from switch_and_link. +- "0:", ++ "3:", + + // Save the EBP of the parent context to the parent stack. + "push ebp", +@@ -611,7 +610,7 @@ pub unsafe fn switch_and_throw( + // about how this code works. + "call 2f", + "2:", +- ".equ .Loffset_throw, 0f - 2b", ++ ".equ .Loffset_throw, 3f - 2b", + "add dword ptr [esp], offset .Loffset_throw", + + // Save EBP of the parent context. +@@ -645,7 +644,7 @@ pub unsafe fn switch_and_throw( + + // Upon returning, our register state is just like a normal return into + // switch_and_link(). +- "0:", ++ "3:", + + // This is copied from the second half of switch_and_link(). + "pop esi", diff --git a/mingw-w64-wasmer/tun-tap-update-tokio.patch b/mingw-w64-wasmer/tun-tap-update-tokio.patch index fdda285f19..92cd49f04f 100644 --- a/mingw-w64-wasmer/tun-tap-update-tokio.patch +++ b/mingw-w64-wasmer/tun-tap-update-tokio.patch @@ -24,7 +24,7 @@ libc = { version = "~0.2", optional = true } -mio = { version = "~0.6", optional = true } -tokio-core = { version = "~0.1", optional = true } -+tokio = { version = "~1.38", features = ["io-util", "net"], optional = true } ++tokio = { version = "~1.39", features = ["io-util", "net"], optional = true } [dev-dependencies] version-sync = "~0.9"