You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+64-1Lines changed: 64 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ If you encounter issues when using RMC we encourage you to
47
47
48
48
## Running RMC
49
49
RMC currently supports command-line invocation on single files.
50
-
We are actively working to integrate RMC into `cargo`.
50
+
We are actively working to integrate RMC into `cargo` (see [experimental Cargo integration](#experimental-cargo-integration)).
51
51
Until then, the easiest way to use RMC is as follows
52
52
53
53
@@ -116,6 +116,69 @@ For example, consider the `CopyIntrinsics` regression test:
116
116
This generates a file `main.c` which contains a "C" like formatting of the CBMC IR.
117
117
1. You can also view the raw CBMC internal representation using the `--keep-temps` option.
118
118
119
+
### Experimental Cargo integration
120
+
121
+
We are actively working to improve RMC's integration with Rust's Cargo package and build system. Currently, you can build projects with Cargo via a multi-step process.
122
+
123
+
For example, we will describe using RMC as a backend to build the [`rand-core` crate](https://crates.io/crates/rand_core). These instructions have been tested on Ubuntu Linux with the `x86_64-unknown-linux-gnu` target.
124
+
125
+
1. Build RMC
126
+
```
127
+
./x.py build -i --stage 1 library/std
128
+
```
129
+
130
+
2. Clone `rand` and navigate to the `rand-core` directory:
3. Next, we need to add an entry-point for CBMC to the crate's source. For now, we will just pick an existing unit test. Open `src/le.rs` and find the `test_read` function at the bottom of the file. Add the following attribute to keep the function name unmangled, so we can later pass it to CBMC.
4. Now, we can run Cargo and specify that RMC should be the backend. We also pass a location for the build artifacts (`rand-core-demo`) and a target (`x86_64-unknown-linux-gnu`).
To sanity-check that verification is working, try changing ` assert_eq!(buf[0], 0x04030201);` to a different value and rerun these commands.
176
+
177
+
For crates with multiple JSON files in the `deps` folder, we suggest running the first command in this step with [`parallel`](https://www.gnu.org/software/parallel/):
178
+
```
179
+
ls *.json | parallel -j 16 symtab2gb {} --out {.}.out // Convert from JSON to Gotoc
180
+
```
181
+
119
182
## Security
120
183
See [SECURITY](https://github.com/model-checking/rmc/security/policy) for more information.
0 commit comments