Skip to content

Commit 71e0e59

Browse files
committed
README: make our cross-interpretation feature stand out more
1 parent 9d4c80e commit 71e0e59

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,6 @@ can pass arguments to Miri via `MIRIFLAGS`. For example,
8787
`MIRIFLAGS="-Zmiri-disable-stacked-borrows" cargo miri run` runs the program
8888
without checking the aliasing of references.
8989

90-
Miri supports cross-execution: if you want to run the program as if it was a
91-
Linux program, you can do `cargo miri run --target x86_64-unknown-linux-gnu`.
92-
This is particularly useful if you are using Windows, as the Linux target is
93-
much better supported than Windows targets.
94-
9590
When compiling code via `cargo miri`, the `cfg(miri)` config flag is set. You
9691
can use this to ignore test cases that fail under Miri because they do things
9792
Miri does not support:
@@ -116,6 +111,19 @@ error: unsupported operation: can't call foreign function: bind
116111
performed an operation that the interpreter does not support
117112
```
118113

114+
### Cross-interpretation: running for different targets
115+
116+
Miri cannot just run a binary or test suite for your host target, it can also
117+
perform cross-interpretation for arbitrary foreign targets: `cargo miri run
118+
--target x86_64-unknown-linux-gnu` will run your program as if it was a Linux
119+
program, no matter your host OS. This is particularly useful if you are using
120+
Windows, as the Linux target is much better supported than Windows targets.
121+
122+
You can also use this to test platforms with different properties than your host
123+
platform. For example `cargo miri test --target mips64-unknown-linux-gnuabi64`
124+
will run your test suite on a big-endian target, which is useful for testing
125+
endian-sensitive code.
126+
119127
### Running Miri on CI
120128

121129
To run Miri on CI, make sure that you handle the case where the latest nightly

0 commit comments

Comments
 (0)