[LLVMdev] How to run vmjc created .bc files?

nicolas geoffray nicolas.geoffray at gmail.com
Tue Dec 8 09:35:14 PST 2009


Hi Michael,


On Tue, Dec 8, 2009 at 6:26 PM, Michael Wu <mmwu at princeton.edu> wrote:

> Hi,
>
>   Thanks a lot for the help! I am getting some errors though:
>
> I am on a 32 bit chroot on a x86_64 system. Thus llc guesses the wrong
> architecture from the module bitcode and spits out x86_64 assembly. I fixed
> this by adding "-march=x86" to the llc options in llcj.
>

OK.


>
> gcc doesn't know what -lgc is. I'm guessing it is the garbage collection
> library. How can I get it or point gcc to the right library?
>

-lgc is for the boehmgc in case you configured vmkit to use it. Since you
don't need it (vmkit uses its own gc by default), you should change the
tools/llcj/llcj.cpp file, remove the line with "-lgc" and recompile it. Yes,
it's _that_ of a new feature yet :)


> llcj -mem2reg MemberVar.class
> /usr/bin/ld: cannot find -lgc
>
> collect2: ld returned 1 exit status
>
> If I have class files that depends on other class files, will llcj be able
> to find those and compile them into the executable as well?
>
>
No, but you can create a big .jar file containing all the class files you
need.


> Also, I have an addition to the Java standard library backported from Java
> 7, which is necessary for my project. JSR166:
> http://gee.cs.oswego.edu/dl/concurrency-interest/
>
>
Add it to the big .jar file.


> Of course, I'm not sure JnJvm supports multiple cores, but this is more a
> proof of concept than anything.
>
>
OK, if it has native functions, chances are jnjvm does not implement them.


> Should I just insert the necessary classes into glibj.zip and recompile
> libvmjc.so?
>
>
You can do that, or just insert them to your .jar file.

Cheers,
Nicolas


> Thanks,
> Michael
>
> nicolas geoffray wrote:
>
>> Hi Michael,
>>
>> Currently, you can run vmjc created .bc files by statically linking them
>> with all the .o needed files. For that, you can use the llcj tool, which
>> works more or less like GCC's gcj tool.
>>
>> Note that you also need to create the libvmjc.so file, which contains the
>> standard library in native form. Do a make in the tools/vmjc/libvmjc
>> directory. Once this is done, update the LD_LIBRARY_PATH shell variable to
>> contain this file, and update PATH to contain the llvm tools and the vmkit
>> tools. You will then be able to use llcj.
>>
>> Let me know if that helped. I will write a more detailed howto on vmkit's
>> website in a few days.
>>
>> Nicolas
>>
>> On Sun, Dec 6, 2009 at 10:07 PM, Michael Wu <mmwu at princeton.edu <mailto:
>> mmwu at princeton.edu>> wrote:
>>
>>    Hi,
>>
>>       What do I need to link with vmjc created .bc files to actually run
>>    the .bc file? I tried running with lli but only got:
>>    LLVM ERROR: Program used external function 'StartJnjvmWithoutJIT'
>>    which
>>    could not be resolved!
>>
>>    Thanks,
>>    Michael
>>    _______________________________________________
>>    LLVM Developers mailing list
>>    LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu>
>> http://llvm.cs.uiuc.edu
>>
>>    http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091208/58ee4bd6/attachment.html>


More information about the llvm-dev mailing list