[LLVMdev] Cross compilation question

Rafal Rusin rafal.rusin at gmail.com
Sat Jun 18 16:10:52 PDT 2011


Hello,

I wonder if it's possible to cross compile regular linux packages
(autotools based) into llvm bitcode.
Such bitcode could run on multiple target platforms using lli.
So for example if we take 'tar' sources and compile them, we have
'tar' bitcode.
We can run it using 'lli tar'.

If it was possible in general, then probably building lots of linux
packages could be easy
using for example openembedded distribution.

BTW. This question is more theoretical than actually needed for
something particular.

So I tried to do something like this or 'tar' sources:
./configure --host none-llvm --target none-llvm

I had to rename llvm-gcc etc into none-llvm-*, because autotools complained on
non recognized architecture when I used 'llvm'.

But I got an error later:
  GEN    rmt-command.h
make  all-am
make[3]: Entering directory `/home/joker/tar-1.23/lib'
  CC     rtapelib.o
  AR     libtar.a
make[3]: Leaving directory `/home/joker/tar-1.23/lib'
make[2]: Leaving directory `/home/joker/tar-1.23/lib'
Making all in rmt
make[2]: Entering directory `/home/joker/tar-1.23/rmt'
  CCLD   rmt
../gnu/libgnu.a: could not read symbols: Malformed archive
collect2: ld returned 1 exit status
make[2]: *** [rmt] Error 1
make[2]: Leaving directory `/home/joker/tar-1.23/rmt'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/joker/tar-1.23'
make: *** [all] Error 2


The other problem is that probably linker (llvm-ld) generates
platform specific executable instead of bitcode in this case.

So if you had any clues how I could fix this, then
it would be great.

BTW. I'm not sure also if that would work for technical reasons, like
binary compatibility.

-- 
Regards,
RafaƂ Rusin




More information about the llvm-dev mailing list