Q: missing -fPIC in llvmc?

Hello All,

On a Debian/AMD64 host I am surprised that there is apparently no way to generate position independent code in shared object (i.e. to output files which are easy dlopen-able without pain)?

I probably missed something obvious, but what?

I want to compile LLVM assembly source code -suitably generated- into .so as directly as possible...


You're missing the fact that llvmc is highly experimental, and is not really usable yet. Please use llvm-gcc directly, thanks!


Chris Lattner wrote:

No, use llc in that case.

From llc --help:

-relocation-model - Choose relocation model
=default - Target default relocation model
=static - Non-relocatable code
=pic - Fully relocatable, position independent code
=dynamic-no-pic - Relocatable external references, non-relocatable code

— Gordon

In that case, you should use low-level tools like llc directly. llc takes a -relocation-model=pic option.