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

Support mutable globals during x86 verification #712

Merged
merged 5 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions intTests/test_llvm_x86_04/test.S
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
section .bss
global var
var: resq 1
section .text
global addvar
addvar:
mov rax, [rdi]
mov rbx, var
add rax, 1
mov [rdi], rax
ret
global _start
_start:
mov rax, 60
syscall
12 changes: 12 additions & 0 deletions intTests/test_llvm_x86_04/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <stdint.h>
#include <stdio.h>

extern uint64_t var;

extern void addvar(uint64_t *i);

void test() {
(void) var;
uint64_t i = 42;
addvar(&i);
};
19 changes: 19 additions & 0 deletions intTests/test_llvm_x86_04/test.saw
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
enable_experimental;

m <- llvm_load_module "test.bc";

let addvar_setup = do {
crucible_alloc_global "var";
var <- crucible_fresh_var "var" (llvm_int 64);
crucible_points_to (crucible_global "var") (crucible_term {{ 2 : [64] }});

ptr <- crucible_alloc (llvm_int 64);
val <- crucible_fresh_var "val" (llvm_int 64);
crucible_points_to ptr (crucible_term val);

crucible_execute_func [ptr];

valprime <- crucible_fresh_var "_val" (llvm_int 64);
crucible_points_to ptr (crucible_term valprime);
};
crucible_llvm_verify_x86 m "./test" "addvar" [] false addvar_setup;
6 changes: 6 additions & 0 deletions intTests/test_llvm_x86_04/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set -e

yasm -felf64 test.S
ld test.o -o test
clang -c -emit-llvm test.c
$SAW test.saw
Loading