[LLVMdev] llvmc doesn't work for compilation nor linking
Holger Schurig
hs4233 at mail.mn-solutions.de
Fri Aug 24 13:52:32 PDT 2007
Is llvmc meant for compilation?
$ llvmc -c a.c -o a.o
/usr/src/llvm/dist/etc/llvm/c:55: Error: Expecting output type value
/usr/src/llvm/dist/etc/llvm/c had 1 errors. Terminating.
The offending line contains:
optimizer.output = bytecode
which doesn't seem to be understood by llvmc. If I uncomment this
line, I get another error message:
$ llvmc -c a.c -o a.o
llvmc: Can't find program '%llvmcc1%'
However, I can use it for linking:
$ llvm-gcc --emit-llvm -c a.c -o a.o
$ llvm-gcc -c main.c -o main.o
$ llvmc a.o main.o -o main
Wow, nice. Unfortunately, the result doesn't run:
$ ./main
'main' function not found in module.
That seems true, because llvm-dis doesn't find a main either:
$ llvm-dis main.bc -o -
; ModuleID = 'main.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 = "i686-pc-linux-gnu"
@i.b = internal global i1 false ; <i1*> [#uses=2]
define void @foo2() {
entry:
store i1 true, i1* @i.b, align 1
ret void
}
declare void @foo4()
define i32 @foo1() {
entry:
%tmp1.b = load i1* @i.b, align 1 ; <i1> [#uses=1]
br i1 %tmp1.b, label %cond_true, label %return
cond_true: ; preds = %entry
call void @foo4( )
ret i32 52
return: ; preds = %entry
ret i32 42
}
More information about the llvm-dev
mailing list