Hi Hemanth,
In this case you don't want the -load option, because that links native
code. Use the program llvm-ld instead. For the most part, it works like
ld; read the ld man page for more info. You can also run
$ llvm-ld --help
for the other options (there are many).
Brady J. Garvin
> 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
> _______________________________________________
> klee-dev mailing list
> klee-dev at keeda.stanford.edu
> http://keeda.Stanford.EDU/mailman/listinfo/klee-dev
>