[LLVMdev] Error using llcj

Shyam Patro shyampatro at hotmail.com
Thu Jun 28 23:02:16 PDT 2012


I tried to compile helloworld program using llcj to native but i got the following error

shyam at shyam:~$ cat hello.javaclass hello {
  public static final String str = "Hello Word";
  public static void main(String[] args) {    System.out.println(str);  }}shyam at shyam:~$ llcj --main=hello hello.class -o hellollc: Unknown command line argument '-f'.  Try: '/home/shyam/llvmbuild/Release+Debug+Asserts/bin/llc -help'llc: Did you mean '-O'?
I edited the vmkit/tools/llcj/llcj.cpp file
line number ---- code188    const char* llcArgv[8];189    int i = 0;190    llcArgv[i++] = Prog.c_str();191    llcArgv[i++] = Out.c_str();192    if (shared) llcArgv[i++] = "-relocation-model=pic";193    llcArgv[i++] = "-disable-fp-elim";194   // llcArgv[i++] = "-f";                                     //Commented this line as there is no "-f" option for llc195    llcArgv[i++] = "-o";196    llcArgv[i++] = LlcOut.c_str();197    llcArgv[i++] = 0;	
and i added few more lines of code to print the commands being executed inside llcj.cpp
shyam at shyam:~$ llcj --main=hello hello.class -o hello
vmjc /home/shyam/classpath-0.97.2/lib/vmkit/Release+Debug+Asserts/bin/vmjc --main=hello hello.class -f -o /tmp/llvm_WbIrdX/hello.bc 
llc /home/shyam/llvmbuild/Release+Debug+Asserts/bin/llc /tmp/llvm_WbIrdX/hello.bc -disable-fp-elim -o /tmp/llvm_WbIrdX/hello.s (null) 
unsupported GC: vmkitUNREACHABLE executed at /home/shyam/llvm-3.1.src/lib/CodeGen/GCMetadata.cpp:99!0  llc 0x08c83b58Stack dump:0.	Program arguments: /home/shyam/llvmbuild/Release+Debug+Asserts/bin/llc /tmp/llvm_WbIrdX/hello.bc -disable-fp-elim -o /tmp/llvm_WbIrdX/hello.s 1.	Running pass 'Function Pass Manager' on module '/tmp/llvm_WbIrdX/hello.bc'.
After observing the makefile of vmkit/tools/precompiler/trainer/Makefile i added the code to load the shared library StaticGCPrinter.so
shyam at shyam:~$ llcj --main=hello hello.class -o hello
vmjc /home/shyam/classpath-0.97.2/lib/vmkit/Release+Debug+Asserts/bin/vmjc --main=hello hello.class -f -o /tmp/llvm_Wa4yw2/hello.bc 
llc /home/shyam/llvmbuild/Release+Debug+Asserts/bin/llc /tmp/llvm_Wa4yw2/hello.bc -disable-fp-elim -disable-branch-fold -disable-cfi -disable-debug-info-print -load=/home/shyam/classpath-0.97.2/lib/vmkit/Release+Debug+Asserts/lib/StaticGCPrinter.so -o /tmp/llvm_Wa4yw2/hello.s (null) 
llc: VmkitGCPrinter.cpp:283: llvm::Constant* FindMetadata(const llvm::Function&): Assertion `0 && "Should have found a JavaMethod"' failed.0  llc 0x08c83b58Stack dump:0.	Program arguments: /home/shyam/llvmbuild/Release+Debug+Asserts/bin/llc /tmp/llvm_Wa4yw2/hello.bc -disable-fp-elim -disable-branch-fold -disable-cfi -disable-debug-info-print -load=/home/shyam/classpath-0.97.2/lib/vmkit/Release+Debug+Asserts/lib/StaticGCPrinter.so -o /tmp/llvm_Wa4yw2/hello.s 1.	Running pass 'Function Pass Manager' on module '/tmp/llvm_Wa4yw2/hello.bc'.shyam at shyam:~$ 
After checking the code of VmkitGcPrinter.cpp the function Constant* FindMetadata(const Function& F) cannot identify JnJVM_hello_main___3Ljava_lang_String_2 (a function from hello.ll)
Can anyone tell me what went wrong 		 	   		   		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120629/a4aae241/attachment.html>


More information about the llvm-dev mailing list