<div dir="ltr">I'm trying to add static code generation capabilities to my MCJIT compiler on LLVM 3.4. To that extent I have:<div><br></div><div>    targetMachine = engineBuilder.selectTarget();<br></div><div>    // ...</div>
<div>    targetMachine->addPassesToEmitFile(<...>);<br></div><div><br></div><div>At first glance this appears to work, but when linking the object file I get the warning:</div><div><br></div><div>    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</div>
<div><br></div><div>This novice developer thought that the solution would be:</div><div><br></div><div>    engineBuilder.setRelocationModel(Reloc::PIC_);</div><div><br></div><div>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?</div>
<div><br></div><div>Thanks in advance!</div><div><br></div><div>v/r</div><div>Josh</div><div><br></div><div>TL;DR: engineBuilder.setRelocationModel(Reloc::PIC_) appears to have no effect when generating object file</div></div>