Skip to content

Commit

Permalink
Merge #2635
Browse files Browse the repository at this point in the history
2635: fix cross-compilation with singlepass compiler r=syrusakbary a=matklad

<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description

Fix cross-compilation with singlepass compiler

# Review

- [ ] Add a short description of the change to the CHANGELOG.md file

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
  • Loading branch information
2 people authored and Amanieu committed Nov 4, 2021
2 parents b75a0b6 + 2fe1b58 commit 5dde7f7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CHANGELOG.md merge=union
*.wast linguist-vendored
*.wat linguist-vendored
* -text
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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<Value<T>>` 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
Expand Down
19 changes: 12 additions & 7 deletions lib/compiler-singlepass/src/emitter_x64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
28 changes: 0 additions & 28 deletions tests/ignores.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,34 +125,6 @@ wasitests::unstable::mem_fs::poll_oneoff
### randomly failed, mainly on windows but also on macos, due to a race condition when concurently testing multiple compiler / engines
wasitests::snapshot1::host_fs::fd_rename_path

## Failing due to different line endings on Windows
## we need a better solution to this problem:

windows wasitests::snapshot1::host_fs::file_metadata
windows wasitests::snapshot1::host_fs::fseek
windows wasitests::snapshot1::host_fs::path_link
windows wasitests::snapshot1::host_fs::path_symlink
windows wasitests::snapshot1::host_fs::mapdir_with_leading_slash
windows wasitests::unstable::host_fs::fd_pread
windows wasitests::unstable::host_fs::fd_read
windows wasitests::unstable::host_fs::file_metadata
windows wasitests::unstable::host_fs::fseek
windows wasitests::unstable::host_fs::path_link
windows wasitests::unstable::host_fs::path_symlink
windows wasitests::unstable::host_fs::mapdir_with_leading_slash
windows wasitests::snapshot1::mem_fs::file_metadata
windows wasitests::snapshot1::mem_fs::fseek
windows wasitests::snapshot1::mem_fs::path_link
windows wasitests::snapshot1::mem_fs::path_symlink
windows wasitests::snapshot1::mem_fs::mapdir_with_leading_slash
windows wasitests::unstable::mem_fs::fd_pread
windows wasitests::unstable::mem_fs::fd_read
windows wasitests::unstable::mem_fs::file_metadata
windows wasitests::unstable::mem_fs::fseek
windows wasitests::unstable::mem_fs::path_link
windows wasitests::unstable::mem_fs::path_symlink
windows wasitests::unstable::mem_fs::mapdir_with_leading_slash

# This tests are disabled for now
wasitests::unstable::host_fs::unix_open_special_files
wasitests::snapshot1::host_fs::unix_open_special_files
Expand Down

0 comments on commit 5dde7f7

Please sign in to comment.