[LLVMdev] Compile C files to one .bc file

Vincent De Bruyne vincent_de_bruyne at hotmail.com
Wed Mar 2 07:44:56 PST 2011


Hi

I'm trying to compile the "bh" C program from the Olden benchmark to one bc file.

# compile source files into an LLVM bitcode file
llvm-gcc -emit-llvm -c args.c -o args.bc -w -DTORONTO
llvm-gcc -emit-llvm -c newbh.c -o newbh.bc -w -DTORONTO
llvm-gcc -emit-llvm -c util.c -o util.bc -w -DTORONTO
llvm-gcc -emit-llvm -c walksub.c -o walksub.bc -w -DTORONTO

# To link files together using llvm-ld
llvm-ld -o bh.bc newbh.bc args.bc util.bc walksub.bc -lm

But when I try to run my pass over bh.bc file or just compile it to native code
llc bh.bc -o bh.s

I get the following error.
llc: bh.bc:1:1: error: expected top-level entity

Do you need to do some special stuff when you want to compile a C program with different files to one bc file.

Thx,
Vincent

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110302/b65c52a3/attachment.html>


More information about the llvm-dev mailing list