Hello Everyone,

I am a newbie to klee and started using recently. I am trying to understand
how a shared library can be linked using -load option. I came across some
posts which showed how to link a .so file. But my problem is different.

I have 2 files

/* main.c */
#include <stdio.h>

int main() {
     printf("Inside main... \n");

     /* Call foo from foo.c */
     foo();
}

/* foo.c */
#include <stdio.h>

int foo() {
     printf("Inside foo... \n");
}

I compile foo.c like this
$llvm-gcc -emit-llvm -c foo.c -o foo.bc

Then I compile main.c like this
$llvm-gcc -emit-llvm -c main.c -o main.bc

Now, I run main.bc with klee as follows:
$klee main.bc --load=<lib_path>/foo.bc

I get a lot of debug statements along with this o/p towards the end:

KLEE: WARNING: calling __user_main with extra arguments.

KLEE: ERROR: /home/hemanth/Desktop/proj/samples/main.c:5: failed external
call: foo

KLEE: NOTE: now ignoring this error at this location

However, if I compile foo.c into a .so using gcc and run klee like this:
$klee main.bc -load=<lib_path>/foo.so

I can see the printf statements in main.c and foo.c


Any help on how to link a .bc file using klee would be greatly appreciated!

-- 

Regards,
Hemanth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://keeda.Stanford.EDU/pipermail/klee-dev/attachments/20100619/11c1dc54/attachment.html
 

Reply via email to