[LLVMdev] clang -emit-llvm uses system ld

Gregory Malecha gmalecha at gmail.com
Tue Jun 28 19:45:23 PDT 2011


Hello,

I've been trying to build some normal linux applications with clang and I
keep running into a snag in configure scripts. Perhaps these scripts are not
written very well, but the current clang behavior seems strange. When I run
clang with the -emit-llvm option, it still uses /usr/bin/ld as the linker
which fails to compile llvm bitcode on linux (though it works on mac).
Here's a simple example:

$ cat > test.c
int main(void) { return 0; }
$ clang -emit-llvm test.c
/tmp/cc-pDfs56.o: file not recognized: File format not recognized
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
$ clang -emit-llvm test.c -c
$

It seems to me that clang should call llvm-ld when it generates llvm code
and ld otherwise, but maybe there's something that I have configured
incorrectly. What is the appropriate way to address this?

Thanks.

-- 
gregory malecha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110628/d84efb0c/attachment.html>


More information about the llvm-dev mailing list