Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --mir-linker flag and wire it up to the compiler #1652

Merged
merged 6 commits into from
Sep 13, 2022

Conversation

celinval
Copy link
Contributor

@celinval celinval commented Sep 8, 2022

Description of changes:

This change adds the --mir-linker option to kani-driver and --reachability=[none | legacy | harnesses] to the compiler. I also changed cargo kani to invoke cargo rustc instead of cargo [build | tests] so the reachability flag is passed at the right moment.

Resolved issues:

Resolves #1617

Related RFC:

#1600

Call-outs:

  1. Since the MIR linker hasn't been hooked up yet, the compiler will fail if this option is selected as shown by the new tests.
  2. cargo rustc -- --reachability=harnesses will inject the argument --reachability=harness in the middle of the compiler flags. Thus, it has to be extracted from rustc args. :(

Testing:

  • How is this change tested?

  • Is this a refactor change?

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

Since the MIR linker hasn't been hooked up yet, the compiler will fail
if this option is selected as shown by the new tests.
@celinval celinval requested a review from a team as a code owner September 8, 2022 06:18
@celinval celinval changed the title Add --mir-linker and wire it up to the compiler Add --mir-linker flag and wire it up to the compiler Sep 8, 2022
rand = "0.8.4"

[package.metadata.kani]
flags = { mir-linker=true, enable-unstable=true }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No expected file for this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops. Thanks for the call out.

.env("RUSTFLAGS", "--kani-flags")
.env("KANIFLAGS", flag_env);
// Only joing them at the end. All kani flags must come first.
kani_args.append(&mut rustc_args);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&mut? oh, wait this says append not extend. IMO extend is cleaner because it avoids needing the mut

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. I'll use extend_from_slice().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --mir-linker option to kani-driver
2 participants