Closed h-mole closed 1 hour ago
Unfortunately, we run Clang only on the first provided .c file without linking any code.
There are two possible workarounds for now:
(1) You avoid extern
and just explicitly include all files into main.c
and invoke Dartagnan on it. This is the easiest option if possible.
(2) You generate a single, linked LLVM file for Dartagnan. AFAIK, this requires two steps:
First, you manually run clang
on the source files and let it generate LLVM files via
clang <ListOfCSources.c> -Xclang -disable-O0-optnone -S -emit-llvm -g -gcolumn-info
-S -emit-llvm
is to generate LLVM code rather than object files, and -g -gcolumn-info
is to generate debug metadata so we can report better errors. I think -Xclang -disable-O0-optnone
is obsolete nowadays, but it shouldn't hurt to have it in there.
Now you invoke the linker llvm-link
to link them into a single file:
llvm-link <ListOfLLVMSources.ll> -o <linkedFile.ll>
Finally you can invoke Dartagnan on the linked LLVM file.
@hernanponcedeleon Maybe we should let Dartagnan take multiple files and invoke the linker automatically if needed.
Thanks for this solution, really solved my problem!
Thanks for this impressively awesome high-performance formal verification tool! However, I had a problem and wondering if it can be solved.
I have two C files in one project to be analysed: // test1.c
// main.c
When I call
gcc/clang -o main main.c test1.c
,the compiler could find symbols and then compile these two files into one executable. Besides, for some formal tools I have tried, they could find external symbols from other source files.When I am trying to use Dat3M, I got this problem that Dat3M cannot get symbol
f
:command (all files are placed in /src/source):
output:
I think I might not be using the right command, to add different sourcefiles into it. Could you please figure out what I am doing wrong, or what I should do to solve it? Thanks for helping me!