diff --git a/CHANGELOG.md b/CHANGELOG.md index d55570a776d..927ccc82199 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C - [#2479](https://github.com/wasmerio/wasmer/pull/2479) Improved `wasmer validate` error message on non-wasm inputs. - [#2454](https://github.com/wasmerio/wasmer/issues/2454) Won't set `WASMER_CACHE_DIR` for Windows. - [#2426](https://github.com/wasmerio/wasmer/pull/2426) Fix the `wax` script generation. +- [#2635](https://github.com/wasmerio/wasmer/pull/2635) Fix cross-compilation for singlepass. ## 2.0.0 - 2021/06/16 @@ -193,9 +194,9 @@ This change is unlikely to affect any users of `wasmer`, but if it does please c ## 1.0.0-beta2 - 2020-12-16 ### Added - + * [#1916](https://github.com/wasmerio/wasmer/pull/1916) Add the `WASMER_VERSION*` constants with the `wasmer_version*` functions in the Wasmer C API -* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` +* [#1867](https://github.com/wasmerio/wasmer/pull/1867) Added `Metering::get_remaining_points` and `Metering::set_remaining_points` * [#1881](https://github.com/wasmerio/wasmer/pull/1881) Added `UnsupportedTarget` error to `CompileError` * [#1908](https://github.com/wasmerio/wasmer/pull/1908) Implemented `TryFrom>` for `i32`/`u32`/`i64`/`u64`/`f32`/`f64` * [#1927](https://github.com/wasmerio/wasmer/pull/1927) Added mmap support in `Engine::deserialize_from_file` to speed up artifact loading diff --git a/lib/compiler-singlepass/src/emitter_x64.rs b/lib/compiler-singlepass/src/emitter_x64.rs index 04601febef3..7bd3d77927a 100644 --- a/lib/compiler-singlepass/src/emitter_x64.rs +++ b/lib/compiler-singlepass/src/emitter_x64.rs @@ -2,13 +2,18 @@ pub use crate::x64_decl::{GPR, XMM}; use dynasm::dynasm; use dynasmrt::{x64::Assembler, AssemblyOffset, DynamicLabel, DynasmApi, DynasmLabelApi}; -/// Dynasm proc-macro checks for an `.arch` expression in a source file to -/// determine the architecture it should use. -fn _dummy(_a: &Assembler) { - dynasm!( - _a - ; .arch x64 - ); +/// Force `dynasm!` to use the correct arch (x64) when cross-compiling. +/// `dynasm!` proc-macro tries to auto-detect it by default by looking at the +/// `target_arch`, but it sees the `target_arch` of the proc-macro itself, which +/// is always equal to host, even when cross-compiling. +macro_rules! dynasm { + ($a:expr ; $($tt:tt)*) => { + dynasm::dynasm!( + $a + ; .arch x64 + ; $($tt)* + ) + }; } #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]