I’m trying to add static code generation capabilities to my MCJIT compiler on LLVM 3.4. To that extent I have:
targetMachine = engineBuilder.selectTarget();
// …
targetMachine->addPassesToEmitFile(<…>);
At first glance this appears to work, but when linking the object file I get the warning:
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in <…>. To fix this warning, don’t compile with -mdynamic-no-pic or link with -Wl,-no_pie
This novice developer thought that the solution would be:
engineBuilder.setRelocationModel(Reloc::PIC_);
However this has no diff in the resulting object file. Have I overlooked something simple? Is this feature not supported and I need to link with -Wl,-no_pie?
Thanks in advance!
v/r
Josh
TL;DR: engineBuilder.setRelocationModel(Reloc::PIC_) appears to have no effect when generating object file