[LLVMdev] fPIC in llvm 2.6

Anton Korobeynikov anton at korobeynikov.info
Sun Oct 3 11:13:45 PDT 2010


> Is fPIC broken on x86_64 in LLVM 2.6?
No, it works w/o any problems

> -------------------
>  > llvm-gcc -Iinclude -emit-llvm -fPIC -O3 -c -o file.opt.bc  file.c
>  > llvm-ld -native -Xlinker=-shared -Xlinker=-Wl,-soname,libtest.so -o
> file.so file.opt.bc
> -------------------
PIC-ness is a backend option. So, passing -fPIC to llvm-gcc does not
make any sense, it is not saved into the bytecode.
Try passing -relocation-model=pic to llvm-ld, or just compile
everything via llvm-gcc which known how to pass necessary options to
backend :)

-- 
With best regards, Anton Korobeynikov
Faculty of Mathematics and Mechanics, Saint Petersburg State University




More information about the llvm-dev mailing list