How to link .bc files and produce executable?


I use llvm-link to link some bitcode files : llvm-link a.bc b.bc c.bc -o test.bc

And then I use llc to produce object file : llc -filetype=obj test.bc -o ./test.o

And then I use clang to produce executable : clang test.o -o test
but there are some error message like this:

In function _do_handshake': llvm-link:(.text+0x3c3ba): undefined reference to rpl_fcntl’
llvm-link:(.text+0x3c3e6): undefined reference to rpl_fcntl' llvm-link:(.text+0x3c404): undefined reference to gnutls_handshake’

It seems like that it cannot find functions in library.

What command options I should use so that I can get a executable successfully?

I am not familiar with clang/llvm’s toolchain.

Thank you!