<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Petr,<div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I'd like to better understand the structure of the ORC runtime and its dependencies (both build and runtime). Does it use the C or C++ standard library? Does it depend on other parts of LLVM? Do you plan on reusing some of the existing compiler-rt libraries like sanitizer_common?</blockquote><div><br></div><div>The ORC runtime currently uses the C++ standard library.<br></div><div>Since the ORC runtime needs to communicate with the LLVM ORC library it also currently uses some header-only includes from LLVM. It does not depend on any LLVM libraries. We could duplicate this code, but I'd prefer to share it if possible.</div><div>I have not used sanitizer_common, but some parts of it look like they may be useful.<br></div><div><br></div><div>I gravitated towards implementing the ORC runtime in compiler-rt because I need to be able to write parts of it in platform-specific assembly (which compiler-rt supports), and because the runtime should be build for all targets, not just the host (which seems to be the standard way that compiler-rt is configured).</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">To give a bit more background on why I'm interested, compiler-rt has grown fairly organically this has been making the maintenance more and more difficult, at least from the build perspective. There are some runtimes that only use C, some that use C++, some that use C++ standard library. When building compiler-rt together with other runtimes like libc or libc++, it's difficult to pick up the right order which is why we have several entry points into compiler-rt's build system to build different subsets and that's been a maintenance headache.</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I've been thinking about this quite a bit recently and I repeatedly came to the conclusion that compiler-rt would ideally be broken up into several subprojects, but that should probably be discussed as a separate topic. However, understanding the build and runtimes dependencies of the ORC runtime could help us decide whether it should be a part of compiler-rt or be a separate subproject.</blockquote><div><br></div><div>That makes sense to me. I think of the ORC runtime as a compiler-rt-style runtime with a libc++ dependency. In that sense I think it's similar to libFuzzer, and whatever solution we come up with for libFuzzer would probably also be applicable to the ORC runtime too.</div><div><br></div><div>-- Lang.</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 12, 2021 at 2:36 PM Petr Hosek <<a href="mailto:phosek@google.com">phosek@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'd like to better understand the structure of the ORC runtime and its dependencies (both build and runtime). Does it use the C or C++ standard library? Does it depend on other parts of LLVM? Do you plan on reusing some of the existing compiler-rt libraries like sanitizer_common?</div><div><br></div><div>To give a bit more background on why I'm interested, compiler-rt has grown fairly organically this has been making the maintenance more and more difficult, at least from the build perspective. There are some runtimes that only use C, some that use C++, some that use C++ standard library. When building compiler-rt together with other runtimes like libc or libc++, it's difficult to pick up the right order which is why we have several entry points into compiler-rt's build system to build different subsets and that's been a maintenance headache.</div><div><br></div><div>I've been thinking about this quite a bit recently and I repeatedly came to the conclusion that compiler-rt would ideally be broken up into several subprojects, but that should probably be discussed as a separate topic. However, understanding the build and runtimes dependencies of the ORC runtime could help us decide whether it should be a part of compiler-rt or be a separate subproject.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 12, 2021 at 12:26 PM Lang Hames <<a href="mailto:lhames@gmail.com" target="_blank">lhames@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi All,<br><div><br></div><div>I'd like to add the ORC runtime library (preview available at <a href="https://github.com/lhames/llvm-project/tree/orc-runtime-preview" target="_blank">https://github.com/lhames/llvm-project/tree/orc-runtime-preview</a>) to compiler-rt.</div><div><br></div><div>Background:</div><div><br></div><div>ORC, like MCJIT, can link JIT'd code either into the current process ("in-process" mode) or into a remote executor process ("cross-process" mode). Some JIT features require support code in the executor process, but the existing ORC libraries are only linked into the JIT process. This has made cross-process mode support for those features (which include static initializers, thread local variables, exception handling, and others) awkward or impractical to implement. The ORC runtime library aims to provide the necessary support code in a form that is loadable by the JIT itself, which should allow these features to work uniformly in both modes.</div><div><br></div><div>My prototype branch of the ORC runtime (available at <a href="https://github.com/lhames/llvm-project/tree/orc-runtime-preview" target="_blank">https://github.com/lhames/llvm-project/tree/orc-runtime-preview</a>) has advanced to the point where it can provide uniform support for static initializers, destructors, exceptions, thread locals, and language registration for Objective C and Swift code. This support is all MachO/Darwin only so far, but should be easily adaptable for ELF/Linux/BSD support.</div><div><br></div><div>Proposal:</div><div><br></div><div>The proof of concept implementation has been very successful, so I would like to move future development to the LLVM main branch so that others can benefit from this.</div><div><br></div><div>Before I start posting patches, though:</div><div><br></div><div>Does anyone see any problems with including this in compiler-rt?</div><div><br></div><div>Does anyone think that there is a more reasonable home for the ORC runtime within the llvm-project? I considered LLVM itself, or a new top-level project, but neither seemed as natural a fit as compiler-rt.</div><div><br></div><div>Finally, if everyone is happy for it to be included in principle, are there any volunteers to review ORC runtime patches?</div><div><br></div><div>Regards,</div><div>Lang.</div></div></div></div></div>
</blockquote></div></div>
</blockquote></div>