Skip to content

Commit

Permalink
Fix pool (mis)compile on AArch64
Browse files Browse the repository at this point in the history
The LLSC probe in `build.rs` checks for the presence of the
`clrex` instruction and assumes the target also has both `ldrex`
and `strex`.

In AArch64 `clrex` is a known mnemonic but `ldrex` and `strex`
are not. This caused the `arm_llsc` feature (and subsequently the
oiik module) to be included in the crate for AArc64 which is invalid.
  • Loading branch information
rjsberry committed Feb 27, 2023
1 parent 644653b commit 519eb9d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

- Fixed LLSC probe on AArc64 causing `pool` module to mistakenly be included in crate

### Removed

- [breaking-change] this crate no longer has a Minimum Supported Rust Version (MSRV) guarantee and
Expand Down
10 changes: 7 additions & 3 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ fn main() -> Result<(), Box<dyn Error>> {
println!("cargo:rustc-cfg=unstable_channel");
}

match compile_probe(ARM_LLSC_PROBE) {
Some(status) if status.success() => println!("cargo:rustc-cfg=arm_llsc"),
_ => {}
// AArch64 instruction set contains `clrex` but not `ldrex` or `strex`; the
// probe will succeed when we already know to deny this target from LLSC.
if !target.starts_with("aarch64") {
match compile_probe(ARM_LLSC_PROBE) {
Some(status) if status.success() => println!("cargo:rustc-cfg=arm_llsc"),
_ => {}
}
}

Ok(())
Expand Down

0 comments on commit 519eb9d

Please sign in to comment.