How does JIT/lli work with bc file?

Dear all,
I hope you enjoy your christmas! Recently I started to play lli with bc. I found that the lli only calls the main() function in bc file and then does nothing before the main() function returns, which means that the JIT::runFunction() function is involved only once with the main() function in bc file. If this was true, then lli does not have any control to the execution of program. Is this the case?
What I was thinking lli would do is fetching each LLVM IR instruction and “execute” it with some tricks. Is there any option for JIT/lli to work like this?

Dear all,
I hope you enjoy your christmas! Recently I started to play lli with
bc. I found that the lli only calls the main() function in bc file and then
does nothing before the main() function returns, which means that the
JIT::runFunction() function is involved only once with the main() function
in bc file. If this was true, then lli does not have any control
to the execution of program. Is this the case?

In JIT mode, yes.

 What I was thinking lli would do is fetching each LLVM IR instruction

and "execute" it with some tricks. Is there any option for JIT/lli to work
like this?

If you pass -force-interpreter to lli, you should get something closer
to what you're looking for.

-Eli

Hi Eli,
Thanks for your reply. If I add -force-interpreter to lli, then it seems that it can not run external function like printf or malloc. Is there any easy way to solve this problem?

Does the LLVM configure find libffi?

-Eli

Dear all,
Actually, the thing I am concerned is: can “-force-interpreter” handle the clone() libc call in a program? Since the clone() libc call is written in assembly language (in clone.S in glibc), as a result, when the CLONE_VM flag is added to clone(), the child thread will call the sub routine (the first argument in the clone() libc call) directly via assembly language in clone.S, then the LLVM intepreter might lose control to the execution of the sub routine? Is this the case?

Hi Eli,
I think the llvm configure has already configured with ffi.

…/llvm-2.6/configure -help | grep ffi
–enable-libffi Check for the presence of libffi (default is YES)

In addition, the printf() can work in program, reflecting that libffi is working, right?
How can I make Interpreter work with getpid(), fork(), and clone()?

Hi Eli,
I think the llvm configure has already configured with ffi.

../llvm-2.6/configure -help | grep ffi
--enable-libffi Check for the presence of libffi (default is YES)

Umm, that just means it checks; if you don't have the headers
installed, it doesn't use it.

In addition, the printf\(\) can work in program, reflecting that libffi is

working, right?
How can I make Interpreter work with getpid(), fork(), and clone()?

I believe printf() is special-cased; I forget exactly where.

-Eli