[LLVMdev] Compiling natively vsftp with LLVM

Chris Lattner sabre at nondot.org
Fri Jun 2 10:37:35 PDT 2006


On Fri, 2 Jun 2006, Nai Xia wrote:
> And the command lines:
>
> llvm-gcc -c -o main.o main.c
> gcc -o foo.o foo.c
> ar rcs libfoo.a foo.o
> llvm-gcc -Wl,-native main.o -L. -lfoo
>
> It's *OK*
>
> Thanks in advance for solving my problem. :)
> And I personally think it may possiblely puzzle other users,
> maybe it deserves its place in FAQ or in man page for LLVM.

I agree that this is an ugly issue.  You've basically fallen into the 
"llvmgcc3 doesn't work the way a normal compiler does" problem.  If you 
use llvmgcc4, it is completely transparent, and works just like a native 
compiler, unless you provide the -emit-llvm switch.

If you'd like for this stuff to work, I'd suggest *not* using the gccld 
"-native*" switches.  They are really only built to work when the whole 
program is compiled with LLVM (ok, you can have native libraries, but no 
native .o files).  If you'd like to link native .o files together with 
LLVM .o files, you should run llc/as/ld directly on the LLVM code to do 
things manually.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list