|
1 | 1 | use genmc_sys::LogLevel;
|
| 2 | +use rustc_abi::Endian; |
| 3 | +use rustc_middle::ty::TyCtxt; |
2 | 4 |
|
3 | 5 | use super::GenmcParams;
|
4 | 6 | use crate::{IsolatedOp, MiriConfig, RejectOpWith};
|
@@ -32,8 +34,6 @@ impl GenmcConfig {
|
32 | 34 | genmc_config: &mut Option<GenmcConfig>,
|
33 | 35 | trimmed_arg: &str,
|
34 | 36 | ) -> Result<(), String> {
|
35 |
| - // FIXME(genmc): Ensure host == target somewhere. |
36 |
| - |
37 | 37 | if genmc_config.is_none() {
|
38 | 38 | *genmc_config = Some(Default::default());
|
39 | 39 | }
|
@@ -86,11 +86,16 @@ impl GenmcConfig {
|
86 | 86 | ///
|
87 | 87 | /// Unsupported configurations return an error.
|
88 | 88 | /// Adjusts Miri settings where required, printing a warnings if the change might be unexpected for the user.
|
89 |
| - pub fn validate_genmc_mode_settings(miri_config: &mut MiriConfig) -> Result<(), &'static str> { |
| 89 | + pub fn validate(miri_config: &mut MiriConfig, tcx: TyCtxt<'_>) -> Result<(), &'static str> { |
90 | 90 | let Some(genmc_config) = miri_config.genmc_config.as_mut() else {
|
91 | 91 | return Ok(());
|
92 | 92 | };
|
93 | 93 |
|
| 94 | + // Check for supported target. |
| 95 | + if tcx.data_layout.endian != Endian::Little || tcx.data_layout.pointer_size().bits() != 64 { |
| 96 | + return Err("GenMC only supports 64bit little-endian targets"); |
| 97 | + } |
| 98 | + |
94 | 99 | // Check for disallowed configurations.
|
95 | 100 | if !miri_config.data_race_detector {
|
96 | 101 | return Err("Cannot disable data race detection in GenMC mode");
|
|
0 commit comments