problems with llc and hello world .

Hi ,

I've been giving the ARM port of LLVM a spin today and ran into this .

[ramana@venglathur builddir]$ cat hello.c && llvm-gcc hello.c -c
-emit-llvm -O3 -o - | llc -march=arm
#include <stdio.h>

int main(void)

printf ("hello world\n");
return 0;

llc: bytecode didn't read correctly.

llvm and the tools is today's CVS head while

llvm-gcc is llvm-gcc-4
gcc version 4.0.1 LLVM (Apple Computer, Inc. build 5421)

I get the same issue with -march=x86 so I am guessing its something wrong
I am doing.

Is there something I am missing ? Thanks in advance for the help.


This is because we're in the middle of the LLVM 2.0 process, and the .bc format is changing (your llvmgcc is producing something different than what the llvm tools expect). As a workaround, you can probably do something like this:

llvm-gcc x.c -S -emit-llvm -O3 -o - | llvm-upgrade | llvm-as | llc -march=arm

That may or may not work. llvm-upgrade is designed to work with the output of llvm 1.9. If your llvm-gcc produces some 2.0isms, it may not work.

In any case, rebuilding your llvm-gcc is the best way to go.