Skip to content

Commit

Permalink
Don't infer host flags for cross-compiled targets (bytecodealliance#7991
Browse files Browse the repository at this point in the history
)

This commit fixes an accidental regression from bytecodealliance#7766 where
`infer_native_flags` is called even if a target is explicitly specified
to a `Config`. Now inference only happens if a target isn't specified
meaning that the host is selected.
  • Loading branch information
alexcrichton authored and saulecabrera committed Mar 12, 2024
1 parent 90db6e9 commit 379bbe9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
--------------------------------------------------------------------------------

## 18.0.3

### Fixed

* Fix inferring native flags when a compilation target is specified.
https://github.com/bytecodealliance/wasmtime/pull/7991

--------------------------------------------------------------------------------

## 18.0.2

Released 2024-02-28.
Expand Down
5 changes: 4 additions & 1 deletion crates/cranelift-shared/src/isa_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ impl<T> IsaBuilder<T> {
.set("enable_probestack", "false")
.expect("should be valid flag");

let triple_specified = triple.is_some();
let triple = triple.unwrap_or_else(Triple::host);
let mut isa_flags = lookup(triple)?;
cranelift_native::infer_native_flags(&mut isa_flags).unwrap();
if !triple_specified {
cranelift_native::infer_native_flags(&mut isa_flags).unwrap();
}

Ok(Self {
shared_flags: flags,
Expand Down

0 comments on commit 379bbe9

Please sign in to comment.