|
| 1 | +# Rust Model Checker (RMC) |
| 2 | +The Rust Model Checker (RMC) aims to be a bit-precise model-checker for Rust. |
| 3 | + |
| 4 | +## Disclaimer |
| 5 | +RMC is currently in the initial development phase. |
| 6 | +It **does not support all rust language features**. |
| 7 | +Some unsupported (or partially supported) features will cause panics when RMC runs. |
| 8 | +In other cases, RMC will "successfully" compile the rust code under test, but may inaccuratly give either false positives or false negatives. |
| 9 | +If you encounter either false positives, or false negatives, please report them as an issue on this repository. |
| 10 | + |
| 11 | + |
| 12 | +## Security |
| 13 | +See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information. |
| 14 | + |
| 15 | +## Architecture |
| 16 | +TODO |
| 17 | + |
| 18 | +## Developer guide |
| 19 | +TODO |
| 20 | + |
| 21 | +## License |
| 22 | +### Rust compiler |
| 23 | +RMC is a fork of the rust compiler, which is primarily primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses. |
| 24 | + |
| 25 | +See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and |
| 26 | +[UPSTREAM-COPYRIGHT](UPSTREAM-COPYRIGHT) for details. |
| 27 | + |
| 28 | +### RMC additions |
| 29 | +RMC is Rdistributed under the terms of both the MIT license and the Apache License (Version 2.0). |
| 30 | + |
| 31 | +See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT)for details. |
| 32 | + |
| 33 | +## Quickstart |
| 34 | + |
| 35 | +The following will build and test `rmc`: |
| 36 | + |
| 37 | +``` |
| 38 | +./scripts/rmc-regression.sh |
| 39 | +``` |
| 40 | + |
| 41 | +## Build frontend |
| 42 | + |
| 43 | +``` |
| 44 | +cd RustToCBMC |
| 45 | +cp config.toml.example config.toml |
| 46 | +sed -i "" \ |
| 47 | + -e "s/^#debug = .*/debug = true/" \ |
| 48 | + -e "s/^#debug-assertions-std = .*/debug-assertions-std = false/" \ |
| 49 | + -e "s/^#incremental = .*/incremental = true/" \ |
| 50 | + -e "s/^#deny-warnings = .*/deny-warnings = false/" \ |
| 51 | + config.toml |
| 52 | +./x.py build -i --stage 1 library/std |
| 53 | +export RMC_RUSTC=`find \`pwd\`/build -name "rustc" -print | grep stage1` |
| 54 | +export PATH=`pwd`/scripts:$PATH |
| 55 | +``` |
| 56 | + |
| 57 | +Note: You almost certainly want to use the local llvm installation instead |
| 58 | +of building llvm from scratch. You do this by setting llvm-config to the |
| 59 | +path of the local llvm-config tool in the target section of config.toml |
| 60 | +for the target you are building. For example, on MacOS, |
| 61 | +``` |
| 62 | +brew install llvm |
| 63 | +echo '' >> config.toml |
| 64 | +echo '[target.x86_64-apple-darwin]' >> config.toml |
| 65 | +echo 'llvm-config = "/usr/local/opt/llvm/bin/llvm-config"' >> config.toml |
| 66 | +``` |
| 67 | + |
| 68 | +Note: You almost certainly want full debug information for debugging |
| 69 | +under gdb or lldb. You do this by setting debuginfo-level-rustc to 2. |
| 70 | +``` |
| 71 | +sed -i "" \ |
| 72 | + -e "s/^#debuginfo-level-rustc = .*/debuginfo-level-rustc = 2/" \ |
| 73 | + config.toml |
| 74 | +``` |
| 75 | + |
| 76 | +## Install CBMC |
| 77 | + |
| 78 | +CBMC has prebuilt releases [available for major platforms](https://github.com/diffblue/cbmc/releases). |
| 79 | +RMC currently works with CBMC versions 5.26 or greater. |
| 80 | + |
| 81 | +### Building CBMC from source |
| 82 | + |
| 83 | +If you want to build CBMC from source, however, do |
| 84 | +``` |
| 85 | +git clone https://github.com/diffblue/cbmc.git |
| 86 | +cd cbmc |
| 87 | +cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DWITH_JBMC=OFF |
| 88 | +cd build |
| 89 | +make -j |
| 90 | +export PATH=$(pwd)/bin:$PATH |
| 91 | +``` |
0 commit comments