[LLVMdev] Getting started (Windows)

Duncan Sands baldrick at free.fr
Sat May 30 01:31:44 PDT 2009


Hi,

> Copied it's output
> ; ModuleID = '/tmp/webcompile/_3997_0.bc'
> target datalayout =
> "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
> target triple = "i386-pc-linux-gnu"
> @.str = internal constant [12 x i8] c"hello world\00"		; <[12 x i8]*> [#uses=1]
> 
> define i32 @main() nounwind {
> entry:
> 	%0 = tail call i32 @puts(i8* getelementptr ([12 x i8]* @.str, i32 0,
> i32 0)) nounwind		; <i32> [#uses=0]
> 	ret i32 0
> }
> 
> declare i32 @puts(i8*)
> 
> into a bc file, and tried to run it with lli, but I get this error:
> 
> "lli: error loading program 'hello.bc': Bitcode stream should be a multiple of 4
> bytes in length"

lli and most other tools expect bitcode (.bc) and not LLVM human
readable assembler (.ll).  The demo page produces .ll because it's
for humans to read!  Copy the demo output into hello.ll, and then
do: llvm-as hello.ll
This will produce hello.bc, which you can run using lli.

Ciao,

Duncan.



More information about the llvm-dev mailing list