<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Maybe the easiest workaround would be overriding symbol resolution
    for the function name and redirect it to your own version in static
    code (and hope it has no bad side effect on your use case).<br>
    <br>
    I think when running 3rd party code, the only way to definitely
    avoid this kind of trouble is to never deallocate any code or data
    sections. Doug Binks mentioned that too in his cppcast about Runtime
    Compiled C++ <a class="moz-txt-link-freetext" href="http://cppcast.com/2016/05/doug-binks/">http://cppcast.com/2016/05/doug-binks/</a><br>
    <br>
    <div class="moz-cite-prefix">Am 21.11.17 um 14:20 schrieb Nikodemus
      Siivola via llvm-dev:<br>
    </div>
    <blockquote type="cite"
cite="mid:CADow0CpEC8EZ+2-PUa=5J_Eyg-7GiY3cogrBA+2Le10DqO8mKw@mail.gmail.com">
      <div dir="ltr">Transform the atexit into equivalent code you can
        control, run it before the destructors of the JIT engine run?
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Tue, Nov 21, 2017 at 12:13 PM, Alex
          Denisov via llvm-dev <span dir="ltr"><<a
              href="mailto:llvm-dev@lists.llvm.org" target="_blank"
              moz-do-not-send="true">llvm-dev@lists.llvm.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex"><span
              class="">> It's not the job of the Orc engine.<br>
              <br>
            </span>I could argue about this, but I won’t :)<br>
            <span class=""><br>
              > Just don't use atexit.<br>
              <br>
            </span>The problem is that I run third-party programs. I
            cannot control them.<br>
            <div class="HOEnZb">
              <div class="h5"><br>
                > On 20. Nov 2017, at 01:04, Joerg Sonnenberger via
                llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org"
                  moz-do-not-send="true">llvm-dev@lists.llvm.org</a>>
                wrote:<br>
                ><br>
                > On Mon, Nov 20, 2017 at 12:22:49AM +0100, Alex
                Denisov via llvm-dev wrote:<br>
                >> JIT allocates and maps some memory for the
                execution. Some function X at address 0xdeadbeef is part
                of this memory.<br>
                >> JIT calls a code that passes the X to atexit.<br>
                >> JIT deallocates and unmaps the memory used for
                execution (either via objectLayer.removeObjectSet or by
                calling JIT's destructors)<br>
                >> atexit (cxa_finalize_ranges) calls the X at
                0xdeadbeef which does not belong to 'us' anymore, which
                leads to the crash.<br>
                ><br>
                > Sounds plausible.<br>
                ><br>
                >> Given that my assumption is correct what can we
                do about this? Is there<br>
                >> anything that can be done to cover this case
                inside of the Orc engine?<br>
                ><br>
                > It's not the job of the Orc engine. Just don't use
                atexit.<br>
                ><br>
                > Joerg<br>
                > ______________________________<wbr>_________________<br>
                > LLVM Developers mailing list<br>
                > <a href="mailto:llvm-dev@lists.llvm.org"
                  moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
                > <a
                  href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
                  rel="noreferrer" target="_blank"
                  moz-do-not-send="true">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
                <br>
              </div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            LLVM Developers mailing list<br>
            <a href="mailto:llvm-dev@lists.llvm.org"
              moz-do-not-send="true">llvm-dev@lists.llvm.org</a><br>
            <a
              href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"
              rel="noreferrer" target="_blank" moz-do-not-send="true">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="https://weliveindetail.github.io/blog/">https://weliveindetail.github.io/blog/</a>
<a class="moz-txt-link-freetext" href="https://cryptup.org/pub/stefan.graenitz@gmail.com">https://cryptup.org/pub/stefan.graenitz@gmail.com</a></pre>
  </body>
</html>