<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <blockquote type="cite">Thanks for that, Stefan. I built the main
      branch of LLVM (I have been using the 11.1 release branch) and
      tried again with --jit-kind=orc. That does indeed fix the crash.</blockquote>
    Nice, so this issue originated from module splitting in orc-lazy
    mode. Your options are:<br>
    (1) Keep the --jit-kind=orc greedy mode, which materializes all
    reachable code upfront and can be fine if you deal with small
    amounts only.<br>
    (2) Go lazy but compile modules as a whole with --jit-kind=orc-lazy
    --per-module-lazy; it's the most performant lazy flavor in my
    experience and it hopefully avoids the CodeGen error as well.<br>
    (3) Or go lazy and supply your own partitioning function. Then you
    could tune everything yourself in detail.<br>
    <br>
    <blockquote type="cite">But lli fails with unresolved symbols:
      <div><br>
      </div>
      <div>    Symbols not found: [ __emutls_v._Init_thread_epoch,
        __emutls_get_address, _Init_thread_header, _Init_thread_footer,
        ??3@YAXPEAX_K@Z, ??_7type_info@@6B@,
        ?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z ]</div>
    </blockquote>
    I think these are all Windows-specific issues that are not currently
    supported in RuntimeDyld and, honestly, I don't know if it's
    realistic to still expect it to happen. My understanding is that
    someone will have to write a COFF backend for JITLink to have a
    chance at solving all the Windows mysteries eventually.<br>
    <br>
    In the meantime, you can try to compile with exceptions disabled and
    fake/provide a delete from the host process. The TLS ones you
    probably know. I guess the std::locale::facet one indicates you are
    missing a library, libcmt.lib or libcpmt.lib maybe?<br>
    <br>
    Good luck.<br>
    <br>
    <div class="moz-cite-prefix">On 06/04/2021 12:19, Geoff Levner
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAHMBa1sYeX6zcJOsvvgKaJ+Zpk6sHf3kg084e7mvFG40-9t3gw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>Thanks for that, Stefan. I built the main branch of LLVM (I
          have been using the 11.1 release branch) and tried again with
          --jit-kind=orc. That does indeed fix the crash. But lli fails
          with unresolved symbols:</div>
        <div><br>
        </div>
        <div>    Symbols not found: [ __emutls_v._Init_thread_epoch,
          __emutls_get_address, _Init_thread_header,
          _Init_thread_footer, ??3@YAXPEAX_K@Z, ??_7type_info@@6B@,
          ?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z ]</div>
        <div><br>
        </div>
        <div>Geoff<br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Sat, Apr 3, 2021 at 1:53 PM
          Stefan Gränitz <<a href="mailto:stefan.graenitz@gmail.com"
            moz-do-not-send="true">stefan.graenitz@gmail.com</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
          <div> Hi Geoff<br>
            <br>
            <blockquote type="cite">LLVM ERROR: Associative COMDAT
              symbol 'GVName' is not a key for its COMDAT.</blockquote>
            This is in CodeGen TargetLoweringObjectFileCOFF so this
            isn't necessarily JIT specific. Maybe a backtrace would be
            helpful?<br>
            <br>
            <blockquote type="cite">lli --jit-end=orc-lazy hello.bc</blockquote>
            Greedy Orc mode recently landed in lli: <a
              href="https://reviews.llvm.org/rGe1579894d2051db8"
              target="_blank" moz-do-not-send="true">https://reviews.llvm.org/rGe1579894d2051db8</a><br>
            You might want to retry with that in order to rule out the
            lazy-JIT-infrastructure as a cause for the error.<br>
            <br>
            <blockquote type="cite">should I just give up now on porting
              our Orc-based application to Windows?</blockquote>
            I am not aware of anyone actively working on improved Orc
            Windows support right now.<br>
            <br>
            <div>On 02/04/2021 12:40, Geoff Levner via llvm-dev wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Sorry, there is a typo in my previous
                message: read "jit-kind" where I typed "jit-end".<br>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Fri, Apr 2, 2021 at
                  12:37 PM Geoff Levner <<a
                    href="mailto:glevner@gmail.com" target="_blank"
                    moz-do-not-send="true">glevner@gmail.com</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">
                  <div dir="ltr">
                    <div>Given this C++ code (hello.cpp):</div>
                    <div><br>
                    </div>
                    <div><span style="font-family:monospace">   
                        #include <iostream><br>
                            int main()<br>
                            {<br>
                                std::cout << "Hi, mom." <<
                        std::endl;<br>
                                return 0;<br>
                            }</span></div>
                    <div><br>
                    </div>
                    <div>On Linux (CentOS 7), no problem:</div>
                    <div><br>
                    </div>
                    <div><span style="font-family:monospace">    >
                        clang++ -c -emit-llvm hello.cpp</span></div>
                    <div><span style="font-family:monospace">    >
                        lli --jit-end=orc-lazy hello.bc</span></div>
                    <div><span style="font-family:monospace">    Hi,
                        mom.</span></div>
                    <div><span style="font-family:monospace">    ></span></div>
                    <div><br>
                    </div>
                    <div>But on Windows (7):</div>
                    <div>
                      <div><br>
                      </div>
                      <div><span style="font-family:monospace">    >
                          clang++ -c -emit-llvm hello.cpp</span></div>
                      <div><span style="font-family:monospace">    >
                          lli --jit-end=orc-lazy hello.bc</span></div>
                    </div>
                    <div><span style="font-family:monospace">    LLVM
                        ERROR: Associative COMDAT symbol
                        '??_7_Iostream_error_category2@std@@6B@' is not
                        a key for its COMDAT.<br>
                        PLEASE submit a bug report to <a
                          href="https://bugs.llvm.org/" target="_blank"
                          moz-do-not-send="true">https://bugs.llvm.org/</a>
                        and include the crash backtrace.</span></div>
                    <div><br>
                    </div>
                    <div>I know Orc JIT lacks COMDAT support, but I
                      thought that just caused duplicate symbols
                      sometimes. Am I doing something stupid here? Or
                      should I just give up now on porting our Orc-based
                      application to Windows? (The application
                      JIT-compiles C++ modules which rely heavily on
                      STL.)<br>
                    </div>
                    <div><br>
                    </div>
                    <div>Geoff</div>
                    <div><br>
                    </div>
                  </div>
                </blockquote>
              </div>
              <br>
              <fieldset></fieldset>
              <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" moz-do-not-send="true">llvm-dev@lists.llvm.org</a>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank" moz-do-not-send="true">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
            </blockquote>
            <pre cols="72">-- 
<a href="https://flowcrypt.com/pub/stefan.graenitz@gmail.com" target="_blank" moz-do-not-send="true">https://flowcrypt.com/pub/stefan.graenitz@gmail.com</a></pre>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="https://flowcrypt.com/pub/stefan.graenitz@gmail.com">https://flowcrypt.com/pub/stefan.graenitz@gmail.com</a></pre>
  </body>
</html>