linking share libraries when building whole-program bitcode file

Hi,all

I’m working on how to build a whole-program bitcode file for big projects with a general solution,and I met a problem

I simplify it as this:

llvm-gcc -c -emit-llvm test.c

llvm-ld test.o -lpthread //here llvm-ld tells me that “Cannot find library pthread”

then I do this:

llvm-ld test.o

lli -load=/usr/lib/libpthread.so a.out.bc //lli tells me the /usr/lib/libpthread.so has a invalid ELF header

What’s the problem,my platform is Fedora 11

Thank you

Nan Zhu <zhunansjtu@gmail.com> writes:

llvm-gcc -c -emit-llvm test.c

llvm-ld test.o -lpthread //here llvm-ld tells me that "Cannot find library
pthread"

$ llvm-gcc -c -emit-llvm test.c
$ llvm-ld test.o -lpthread
$ ./a.out
Error opening '/usr/lib/libpthread.a': /usr/lib/libpthread.a: invalid ELF header
  -load request ignored.
Hello world

my platform is Fedora 11 X86_64,

but I have found that llvm-ld will link libpthread as a default action

just run

llvm-ld test.o

and

lli test.bc will give the right result

2009/11/18 Timo Juhani Lindfors <timo.lindfors@iki.fi>