Skip to content

Instantly share code, notes, and snippets.

@disruptek
Created July 6, 2019 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save disruptek/bb875a27a1024e642bfc8e4827c67015 to your computer and use it in GitHub Desktop.
Save disruptek/bb875a27a1024e642bfc8e4827c67015 to your computer and use it in GitHub Desktop.
steps to generate some klee test results
#!/bin/fish
# set some locations
set --local root /root
set --local temp $root/temp
set --local output $root/linked.bc
set --local cache $root/cache
pushd $root
if test -f $output
rm $output
end
if test -d $temp
rm -rf $temp
end
mkdir --parents $temp
# clear the cache so we can iterate over all c files
rm -rf $cache
# compile our nim code
nim --nimCache:$cache --debuginfo:on --opt:none --lineTrace:on --threads:off --checks:on --assertions:on --embedsrc:on --compileOnly:on --lineDir:on --forceBuild:on $argv; or exit 1
# compile c to bc
for n in $cache/*.c
set --local out (basename $n)
clang -I /klee/klee/include -I /root/Nim/lib -emit-llvm -c -g -O0 -Xclang -disable-O0-optnone $n -o $temp/$out.bc; or exit 1
end
# link the bytecode to a single output file
llvm-link -S $temp/*.bc -o $output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment