Skip to content

Commit

Permalink
Merge #1044
Browse files Browse the repository at this point in the history
1044: Initial commit for support of AArch64 in the llvm backend. r=nlewycky a=nlewycky

# Description
Enables AArch64 in the llvm backend, and inkwell when the target_arch is aarch64. Adds relevant failing spectests to the excludes.txt.

# Review

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


Co-authored-by: Nick Lewycky <nick@wasmer.io>
  • Loading branch information
bors[bot] and nlewycky authored Dec 7, 2019
2 parents a180721 + 4f39102 commit 13f1eb9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## **[Unreleased]**

- [#1033](https://github.com/wasmerio/wasmer/pull/1033) Set cranelift backend as default compiler backend again, require at least one backend to be enabled for Wasmer CLI
- [#1044](https://github.com/wasmerio/wasmer/pull/1044) Enable AArch64 support in the LLVM backend.
- [#1030](https://github.com/wasmerio/wasmer/pull/1030) Ability to generate `ImportObject` for a specific version WASI version with the C API.
- [#1028](https://github.com/wasmerio/wasmer/pull/1028) Introduce strict/non-strict modes for `get_wasi_version`
- [#1029](https://github.com/wasmerio/wasmer/pull/1029) Add the “floating” `WasiVersion::Latest` version.
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ wasitests: wasitests-unit wasitests-singlepass wasitests-cranelift wasitests-llv
# Backends
singlepass: spectests-singlepass emtests-singlepass middleware-singlepass wasitests-singlepass
cargo test -p wasmer-singlepass-backend --release
cargo test -p wasmer-runtime-core-tests --release --no-default-features --features backend-singlepass
cargo test --manifest-path lib/runtime-core-tests/Cargo.toml --release --no-default-features --features backend-singlepass

cranelift: spectests-cranelift emtests-cranelift middleware-cranelift wasitests-cranelift
cargo test -p wasmer-clif-backend --release
Expand All @@ -98,7 +98,7 @@ cranelift: spectests-cranelift emtests-cranelift middleware-cranelift wasitests-
llvm: spectests-llvm emtests-llvm wasitests-llvm
cargo test -p wasmer-llvm-backend --release
cargo test -p wasmer-llvm-backend-tests --release
cargo test -p wasmer-runtime-core-tests --release --no-default-features --features backend-llvm
cargo test --manifest-path lib/runtime-core-tests/Cargo.toml --release --no-default-features --features backend-llvm


# All tests
Expand Down
8 changes: 7 additions & 1 deletion lib/llvm-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@ goblin = "0.0.24"
libc = "0.2.60"
byteorder = "1"

[dependencies.inkwell]
[target.'cfg(target_arch = "x86_64")'.dependencies.inkwell]
git = "https://github.com/TheDan64/inkwell"
rev = "781620e9fa30e51a6e03bd0d49b5f5bb7a782520"
default-features = false
features = ["llvm8-0", "target-x86"]

[target.'cfg(target_arch = "aarch64")'.dependencies.inkwell]
git = "https://github.com/TheDan64/inkwell"
rev = "781620e9fa30e51a6e03bd0d49b5f5bb7a782520"
default-features = false
features = ["llvm8-0", "target-aarch64"]

[target.'cfg(unix)'.dependencies]
nix = "0.15"

Expand Down
12 changes: 11 additions & 1 deletion lib/llvm-backend/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8472,7 +8472,17 @@ impl<'ctx> ModuleCodeGenerator<LLVMFunctionCodeGenerator<'ctx>, LLVMBackend, Cod
info: true,
machine_code: true,
}),
_ => unimplemented!("compile to target other than x86-64 is not supported"),
_ if triple.starts_with("aarch64") => {
Target::initialize_aarch64(&InitializationConfig {
asm_parser: true,
asm_printer: true,
base: true,
disassembler: true,
info: true,
machine_code: true,
})
}
_ => unimplemented!("target {} not supported", triple),
}

let target = Target::from_triple(&triple).unwrap();
Expand Down
5 changes: 4 additions & 1 deletion lib/llvm-backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
unused_unsafe,
unreachable_patterns
)]
#![cfg_attr(not(target_os = "windows"), deny(dead_code))]
#![cfg_attr(
all(not(target_os = "windows"), not(target_arch = "aarch64")),
deny(dead_code)
)]
#![cfg_attr(nightly, feature(unwind_attributes))]
#![doc(html_favicon_url = "https://wasmer.io/static/icons/favicon.ico")]
#![doc(html_logo_url = "https://avatars3.githubusercontent.com/u/44205449?s=200&v=4")]
Expand Down
5 changes: 5 additions & 0 deletions lib/spectests/tests/excludes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@ llvm:fail:f64.wast:1621 # AssertReturn - result F64(0) ("0x0") does not match ex
llvm:fail:f64.wast:2020 # AssertReturn - result F64(9223372036854775808) ("0x8000000000000000") does not match expected F64(0) ("0x0")
llvm:fail:linking.wast:388 # AssertReturn - Call failed RuntimeError: WebAssembly trap occurred during runtime: incorrect `call_indirect` signature

# LLVM AArch64
llvm:skip:atomic.wast:*:*:aarch64 # Out of range relocations.
llvm:skip:skip-stack-guard-page.wast:2275:*:aarch64 # Uncaught SIGSEGV only in release builds
llvm:skip:skip-stack-guard-page.wast:2282:*:aarch64 # Uncaught SIGSEGV only in release builds

# LLVM Windows
llvm:skip:address.wast:*:windows
llvm:skip:align.wast:*:windows
Expand Down

0 comments on commit 13f1eb9

Please sign in to comment.