[LLVMdev] Bitcode not portable from linux to solaris?

Török Edwin edwintorok at gmail.com
Mon Jan 31 08:04:01 PST 2011


On 2011-01-31 17:56, Lally Singh wrote:
> Hi all.
> 
>   I made some early experiments --- namely a llvm program that
> printf'd "hello world" -- that seemed to indicate that a bitcode file
> I generate on linux would work on my solaris box.  Well, they're
> actually the same machine, an amd opteron sun box with a linux vm
> running.   My generating program doesn't run on solaris, but I was
> hoping to generate bitcode for it from linux.  lli crashes pretty
> quick (although the same use on linux has been debugged pretty well,
> and it's a pretty simple program!).  llvmc -clang complains quite a
> bit about invalid directives (sorry, couldn't get on the machine
> before my commute to work, so this is from memory only).
> 
> I read something quite some time ago that perhaps the bitcode wasn't
> portable if the machines had different pointer sizes.  Solaris is
> 64bit (almost exclusively).  I tried generating from both 32 and 64
> bit linux VMs, but perhaps I just didn't configure it properly to
> generate 64-bit code?
> 
> I thought it was supposed to be portable?  Am I wrong?  llvm-dis works
> on it fine.  Perhaps a llvm-dis -> llvm-as cycle would do the trick?
> 
> I can post the (small) bitcode file and the errors tonight, if that helps.
> 
> Any help is really appreciated.  Thanks in advance!

It is probably an ABI issue, your bitcode specifies the Linux ABI, and
trying to use that on Solaris won't work.
Try deleting the triple from the module, or editing it to be the proper
one for Solaris.
Also you'll probably need to use the Solaris headers when
cross-compiling your bitcode, but that shouldn't matter for just calling
printf.

Best regards,
--Edwin

> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list