[LLVMdev] Getting LLVM bit-code for programs using a couple of libraries
Sandeep K Chaudhary
babbusandy2006 at gmail.com
Mon May 26 18:58:10 PDT 2014
Hi guys,
I am compiling some programs with clang which use a couple of
libraries. When I compile with the command - "clang -O2 -I. -o hello
-ldl -llttng-ust hello.c tp.c", it goes successful.
My aim is to get the bitcode for these programs but if I try to
generate the bitcode with -emit-llvm option, it produces linking
issues as follows : (also at - http://pastebin.com/zkmL2SAH)
sandeep at ubuntu:~/lttng-git/lttng-ust/tests/hello2$ clang -emit-llvm
-O2 -I. -o hello -ldl -llttng-ust hello.c tp.c
/usr/bin/ld: error: /tmp/hello-u3dmcq.o:1:3: invalid character
/usr/bin/ld: error: /tmp/hello-u3dmcq.o:1:3: syntax error, unexpected $end
/usr/bin/ld: error: /tmp/hello-u3dmcq.o: not an object or archive
/usr/bin/ld: error: /tmp/tp-1CR8ta.o:1:3: invalid character
/usr/bin/ld: error: /tmp/tp-1CR8ta.o:1:3: syntax error, unexpected $end
/usr/bin/ld: error: /tmp/tp-1CR8ta.o: not an object or archive
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../x86_64-linux-gnu/crt1.o(.text+0x20):
error: undefined reference to 'main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What is a way to go around these linking issues?
Also, I can successfully generate bitcode for a simple hello-world
program using the -emit-llvm program so I installation of clang/llvm
on my system is good.
PS: I hope that I am not mistaken in posting this query here. But if
I'am, please excuse me.
Thanks and regards,
Sandeep.
More information about the llvm-dev
mailing list