Skip to content

Commit 029ad88

Browse files
authored
Remove symtab json support (#3695)
I believe the plan was to keep this in case of a regression for about a year. The time has long gone, so I think it's time to get rid of it. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
1 parent 9b2bbd3 commit 029ad88

File tree

6 files changed

+7
-76
lines changed

6 files changed

+7
-76
lines changed

.github/workflows/kani.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,6 @@ jobs:
3131
- name: Execute Kani regression
3232
run: ./scripts/kani-regression.sh
3333

34-
write-json-symtab-regression:
35-
runs-on: ubuntu-20.04
36-
steps:
37-
- name: Checkout Kani
38-
uses: actions/checkout@v4
39-
40-
- name: Setup Kani Dependencies
41-
uses: ./.github/actions/setup
42-
with:
43-
os: ubuntu-20.04
44-
45-
- name: Build Kani
46-
run: cargo build-dev -- --features write_json_symtab
47-
48-
- name: Run tests
49-
run: |
50-
cargo run -p compiletest --quiet -- --suite kani --mode kani --quiet --no-fail-fast
51-
cargo run -p compiletest --quiet -- --suite expected --mode expected --quiet --no-fail-fast
52-
cargo run -p compiletest --quiet -- --suite cargo-kani --mode cargo-kani --quiet --no-fail-fast
53-
54-
5534
benchcomp-tests:
5635
runs-on: ubuntu-20.04
5736
steps:

kani-compiler/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ tracing-tree = "0.4.0"
3434
default = ['cprover', 'llbc']
3535
llbc = ['charon']
3636
cprover = ['cbmc', 'num', 'serde']
37-
write_json_symtab = []
3837

3938
[package.metadata.rust-analyzer]
4039
# This package uses rustc crates.

kani-compiler/src/args.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ pub struct Arguments {
5151
/// Option used for suppressing global ASM error.
5252
#[clap(long)]
5353
pub ignore_global_asm: bool,
54-
#[clap(long)]
55-
/// Option used to write JSON symbol tables instead of GOTO binaries.
56-
///
57-
/// When set, instructs the compiler to produce the symbol table for CBMC in JSON format and use symtab2gb.
58-
pub write_json_symtab: bool,
5954
/// Option name used to select which reachability analysis to perform.
6055
#[clap(long = "reachability", default_value = "none")]
6156
pub reachability_analysis: ReachabilityType,

kani-compiler/src/codegen_cprover_gotoc/compiler_interface.rs

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ use stable_mir::mir::mono::{Instance, MonoItem};
4646
use stable_mir::{CrateDef, DefId};
4747
use std::any::Any;
4848
use std::collections::BTreeMap;
49-
use std::ffi::OsString;
5049
use std::fmt::Write;
5150
use std::fs::File;
5251
use std::io::BufWriter;
53-
use std::path::{Path, PathBuf};
54-
use std::process::Command;
52+
use std::path::Path;
5553
use std::sync::{Arc, Mutex};
5654
use std::time::Instant;
57-
use tracing::{debug, error, info};
55+
use tracing::{debug, info};
5856

5957
pub type UnsupportedConstructs = FxHashMap<InternedString, Vec<Location>>;
6058

@@ -204,12 +202,7 @@ impl GotocCodegenBackend {
204202
if !tcx.sess.opts.unstable_opts.no_codegen && tcx.sess.opts.output_types.should_codegen() {
205203
let pretty = self.queries.lock().unwrap().args().output_pretty_json;
206204
write_file(&symtab_goto, ArtifactType::PrettyNameMap, &pretty_name_map, pretty);
207-
if gcx.queries.args().write_json_symtab {
208-
write_file(&symtab_goto, ArtifactType::SymTab, &gcx.symbol_table, pretty);
209-
symbol_table_to_gotoc(&tcx, &symtab_goto);
210-
} else {
211-
write_goto_binary_file(symtab_goto, &gcx.symbol_table);
212-
}
205+
write_goto_binary_file(symtab_goto, &gcx.symbol_table);
213206
write_file(&symtab_goto, ArtifactType::TypeMap, &type_map, pretty);
214207
// If they exist, write out vtable virtual call function pointer restrictions
215208
if let Some(restrictions) = vtable_restrictions {
@@ -538,40 +531,6 @@ fn codegen_results(
538531
))
539532
}
540533

541-
fn symbol_table_to_gotoc(tcx: &TyCtxt, base_path: &Path) -> PathBuf {
542-
let output_filename = base_path.to_path_buf();
543-
let input_filename = convert_type(base_path, ArtifactType::SymTabGoto, ArtifactType::SymTab);
544-
545-
let args = vec![
546-
input_filename.clone().into_os_string(),
547-
"--out".into(),
548-
OsString::from(output_filename.as_os_str()),
549-
];
550-
// TODO get symtab2gb path from self
551-
let mut cmd = Command::new("symtab2gb");
552-
cmd.args(args);
553-
info!("[Kani] Running: `{:?} {:?}`", cmd.get_program(), cmd.get_args());
554-
555-
let result = with_timer(
556-
|| {
557-
cmd.output()
558-
.expect(&format!("Failed to generate goto model for {}", input_filename.display()))
559-
},
560-
"symtab2gb",
561-
);
562-
if !result.status.success() {
563-
error!("Symtab error output:\n{}", String::from_utf8_lossy(&result.stderr));
564-
error!("Symtab output:\n{}", String::from_utf8_lossy(&result.stdout));
565-
let err_msg = format!(
566-
"Failed to generate goto model:\n\tsymtab2gb failed on file {}.",
567-
input_filename.display()
568-
);
569-
tcx.dcx().err(err_msg);
570-
tcx.dcx().abort_if_errors();
571-
};
572-
output_filename
573-
}
574-
575534
pub fn write_file<T>(base_path: &Path, file_type: ArtifactType, source: &T, pretty: bool)
576535
where
577536
T: serde::Serialize,

kani-driver/src/args/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,10 @@ impl ValidateArgs for VerificationArgs {
573573
);
574574
}
575575

576+
if self.write_json_symtab {
577+
print_obsolete(&self.common_args, "--write-json-symtab");
578+
}
579+
576580
if self.visualize {
577581
if !self.common_args.enable_unstable {
578582
return Err(Error::raw(

kani-driver/src/call_single_file.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ impl KaniSession {
129129
flags.push("--ignore-global-asm".into());
130130
}
131131

132-
// Users activate it via the command line switch
133-
if self.args.write_json_symtab {
134-
flags.push("--write-json-symtab".into());
135-
}
136-
137132
if self.args.is_stubbing_enabled() {
138133
flags.push("--enable-stubbing".into());
139134
}

0 commit comments

Comments
 (0)