<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">The really short version is that a JIT infrastructure for LLVM is going to need to be able to interact with the surrounding platform environment in a lot of ways. The platform’s native object file format is already tailored to do exactly that, in exactly the places the MCJIT needs, so rather than reinvent the wheel, we just used what we already have. The debugger and profiler interfaces are great examples of the sort of the sorts of things I mean.<div><br></div><div>Now, it would probably be even better to go all the way to the shared library format instead of stopping at the object file, but that’s a problem that hasn’t yet been tackled. Eventually I’d like there to be stronger cooperation with the platform shared library manager, when such exists, on the target.<br><div><br></div><div>-Jim<br><div><br><div><div>On May 21, 2013, at 5:08 PM, "Kaylor, Andrew" <<a href="mailto:andrew.kaylor@intel.com">andrew.kaylor@intel.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">The decision to use ELF and MachO predates my involvement, but I can tell you that having those formats makes cooperation with other tools (such as debuggers and profilers) a lot easier.<br><br>-Andy<br><br>-----Original Message-----<br>From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a> [<a href="mailto:llvm-commits-bounces@cs.uiuc.edu">mailto:llvm-commits-bounces@cs.uiuc.edu</a>] On Behalf Of Rafael Espíndola<br>Sent: Tuesday, May 21, 2013 2:44 PM<br>To: Filip Pizlo<br>Cc: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>Subject: Re: [PATCH] RuntimeDyldMachO should handle RIP-relative relocations correctly, and the corresponding tests should have coverage for this<br><br><blockquote type="cite">As an aside, can you guys explain to me why MCJIT uses an OS-specific<span class="Apple-converted-space"> </span><br>linker convention for doing JIT linking?  Wouldn't it be better for<span class="Apple-converted-space"> </span><br>the LLVM JIT to 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<span class="Apple-converted-space"> </span><br>try to reimplement the system's own relocation logic.  It also seems<span class="Apple-converted-space"> </span><br>highly unorthodox for a JIT to masquerade as if you did an AOT compile<span class="Apple-converted-space"> </span><br>and then ran the dynamic linker; it would be much easier to architect<span class="Apple-converted-space"> </span><br>the JIT so that the information needed for linking is represented in<span class="Apple-converted-space"> </span><br>an object-oriented way rather than a blob of bits that pretends to be an on-disk object file.<br></blockquote><br>When MCJIT was being designed there was some discussion about creating a MCJIT object format. I was not directly involved at the time, but Daniel might remember the rationale for going with native object formats.<br><br>One advantaged is that the MC side is a bit simpler. We have one object format less to worry about (and test) and I think only windows 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 interface. It would get a "parsed" representation of the required fixups, external symbols, etc. I am not sure how much re factoring would be needed to make this work.<br><br>A somewhat crazy idea on the other direction would be to move some bits of lld to the llvm repo so that MCJIT would be given native .dylib/.so/.dll files, which should be a lot easier to handle.<br><br>Cheers,<br>Rafael<br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a></div></blockquote></div><br></div></div></div></body></html>