Skip to content
Snippets Groups Projects
Commit 599194b9 authored by Henrik Tjäder's avatar Henrik Tjäder
Browse files

Merge branch 'klee' of gitlab.henriktjader.com:KLEE/cortex-m-rtfm-klee into klee

parents 2791081e 28b88b09
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ rustflags = [
"-C", "link-arg=-Tlink.x",
"-C", "linker=arm-none-eabi-ld",
"-Z", "linker-flavor=ld",
"-Z", "thinlto=no",
]
# used when building for klee
......@@ -35,7 +36,8 @@ rustflags = [
[target.x86_64-unknown-linux-gnu]
rustflags = [
"--emit=llvm-bc,llvm-ir",
"-C", "linker=true"
"-C", "linker=true",
"-Z", "thinlto=no",
]
# default build target (for m3)
......
......@@ -7,7 +7,7 @@ extern crate cstr_core;
extern crate cty;
// mod lang_items;
mod ll;
pub mod ll;
use core::mem;
......@@ -42,7 +42,7 @@ pub fn k_mk_symbol<T>(t: &mut T, name: &CStr) {
}
}
#[inline(never)]
#[inline(always)]
pub fn k_abort() -> ! {
unsafe {
ll::abort();
......@@ -50,7 +50,7 @@ pub fn k_abort() -> ! {
}
/// assume a condition involving symbolic variables
#[inline(never)]
#[inline(always)]
pub fn k_assume(cond: bool) {
unsafe {
ll::klee_assume(cond);
......@@ -58,10 +58,12 @@ pub fn k_assume(cond: bool) {
}
/// assert a condition involving symbolic variables
#[inline(never)]
#[inline(always)]
pub fn k_assert(e: bool) {
if !e {
k_abort();
unsafe {
ll::abort();
}
}
}
......@@ -80,6 +82,21 @@ macro_rules! k_symbol {
}
}
/// assertion
#[macro_export]
macro_rules! k_assert {
($e: expr) => {
{
use klee::ll;
if !$e {
unsafe {
ll::abort();
}
}
}
}
}
#[macro_export]
macro_rules! k_visit {
()=> {
......
......@@ -8,12 +8,15 @@ extern "C" {
}
#[cfg(not(feature = "klee_mode"))]
#[inline(always)]
pub unsafe fn abort() -> ! {
loop {}
}
#[cfg(not(feature = "klee_mode"))]
#[inline(always)]
pub unsafe fn klee_assume(_cond: bool) {}
#[cfg(not(feature = "klee_mode"))]
#[inline(always)]
pub unsafe fn klee_make_symbolic(_ptr: *mut c_void, _size: usize, _name: *const c_char) {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment