<div dir="ltr">On Tue, May 21, 2013 at 2:44 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">> As an aside, can you guys explain to me why MCJIT uses an OS-specific linker<br>

> convention for doing JIT linking?  Wouldn't it be better for the LLVM JIT to<br>
> have its own internal linking convention that is unrelated to ELF or MachO?<br>
> It seems like this would be less error-prone than having RuntimeDyld try to<br>
> reimplement the system's own relocation logic.  It also seems highly<br>
> unorthodox for a JIT to masquerade as if you did an AOT compile and then ran<br>
> the dynamic linker; it would be much easier to architect the JIT so that the<br>
> information needed for linking is represented in an object-oriented way<br>
> rather than a blob of bits that pretends to be an on-disk object file.<br>
<br>
</div>When MCJIT was being designed there was some discussion about creating<br>
a MCJIT object format. I was not directly involved at the time, but<br>
Daniel might remember the rationale for going with native object<br>
formats.<br></blockquote><div><br></div><div style>Actually my original proposal was to use a custom object format. See:</div><div style>  <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-November/036279.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2010-November/036279.html</a></div>
<div style><br></div><div style> - Daniel</div><div style> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
One advantaged is that the MC side is a bit simpler. We have one<br>
object format less to worry about (and test) and I think only windows<br>
has two object file formats (there is ELF when using the JIT).<br>
<br>
An interesting idea might be to plug the JIT at the ObjectWriter<br>
interface. It would get a "parsed" representation of the required<br>
fixups, external symbols, etc. I am not sure how much re factoring<br>
would be needed to make this work.<br>
<br>
A somewhat crazy idea on the other direction would be to move some<br>
bits of lld to the llvm repo so that MCJIT would be given native<br>
.dylib/.so/.dll files, which should be a lot easier to handle.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>