<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hey all,<br>
    <br>
    For LinkModules, <i><b>dest</b></i> is a fully materialized module,
    <i><b>src</b></i> is a lazily loaded module.<br>
    <br>
    From what I understood, getLinkedToGlobal() is finding the function
    in <i><b>src</b></i> that matches some function declaration in <i><b>dest</b></i>,
    and given that <i><b>src</b></i> is lazily loaded it could be
    un-materialized.<br>
    <br>
    The functions I need brought in from <i><b>src</b></i><i><b></b></i>
    into <i><b>dest</b></i> are always declarations in <i><b>dest</b></i>.
    The problem is that (for some reason) the combination of
    Linker::LinkOnlyNeeded and a function that is not materialized will
    not copy the function body from <i><b>src</b></i> into <i><b>dest</b></i>.<br>
    <br>
    Cheers,<br>
    -Neil.<br>
    <br>
    <div class="moz-cite-prefix">On 20/04/16 20:39, Teresa Johnson
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAAe5K+U2gvv5Qnak0b_==Jp1x1fcNUuiJC_8ttVoko8viiOnMQ@mail.gmail.com"
      type="cite">
      <div dir="ltr"><br>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Wed, Apr 20, 2016 at 12:28 PM,
            Rafael Espíndola <span dir="ltr"><<a
                moz-do-not-send="true"
                href="mailto:rafael.espindola@gmail.com"><a class="moz-txt-link-abbreviated" href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a></a>></span>
            wrote:<br>
            <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 dir="ltr">
                <div class="gmail_extra">
                  <div class="gmail_quote"><span class="gmail-">
                      <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 style="word-wrap:break-word">
                          <div>
                            <div>
                              <div>
                                <div><br>
                                </div>
                              </div>
                            </div>
                            <div>I understood from his description that
                              he reversed the destination and source so
                              that destination is the user code.</div>
                            <div>I assumed it was not lazy loaded, but
                              that would explain the question then :)</div>
                            <div><br>
                            </div>
                            <div>Neil: can you clarify? If Teresa is
                              right, why aren't you materializing the
                              destination module entirely?</div>
                            <span>
                              <div><br>
                              </div>
                            </span></div>
                        </div>
                      </blockquote>
                      <div><br>
                      </div>
                      <div><br>
                      </div>
                    </span>
                    <div>I don't think it has ever been tried to use a
                      lazy destination. Having said that, I don't think
                      isMaterializable should return true for a
                      declaration.</div>
                  </div>
                </div>
              </div>
            </blockquote>
            <div><br>
            </div>
            <div>Looking at isMaterializable, I'm now a little confused
              about Neil's case - the materializable bit is set to true
              only when the MODULE_CODE_FUNCTION indicated that it was
              !isproto, which means it should have a definition in that
              module. So I agree with you that isMaterializable
              shouldn't be returning true when the symbol is only
              available as a declaration. <br>
            </div>
            <div><br>
            </div>
            <div>Neil - what case are you trying to handle here? If
              there is a materializable definition in the dest module,
              wouldn't you want to use that instead of linking one in
              from the source module?</div>
            <div><br>
            </div>
            <div>Teresa</div>
            <div><br>
            </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">
              <div dir="ltr">
                <div class="gmail_extra">
                  <div class="gmail_quote"><span class="gmail-">
                      <div><br>
                      </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">
                        <div style="word-wrap:break-word">
                          <div><span>
                              <div><br>
                              </div>
                            </span>
                            <div>Even materializing functions from the
                              source module on the fly isn't supported
                              right now, is it?</div>
                            <span><font color="#888888">
                                <div><br>
                                </div>
                              </font></span></div>
                        </div>
                      </blockquote>
                      <div> </div>
                    </span>
                    <div>It is.</div>
                    <div><br>
                    </div>
                    <div>Neil, the flag is linked to
                      llvm-link's -only-needed command line option. At
                      least for simple cases it seems to be working.
                      Given</div>
                    <div><br>
                    </div>
                    <div>
                      <div>declare void @g()</div>
                      <div>define void @f() {</div>
                      <div>  call void @g()</div>
                      <div>  ret void</div>
                      <div>}</div>
                    </div>
                    <div><br>
                    </div>
                    <div>and</div>
                    <div><br>
                    </div>
                    <div>
                      <div>define void @g() {</div>
                      <div>  ret void</div>
                      <div>}</div>
                      <div>define void @h() {</div>
                      <div>  ret void</div>
                      <div>}</div>
                    </div>
                    <div><br>
                    </div>
                    <div><br>
                    </div>
                    <div>linking with "llvm-link -only-needed test1.bc
                      test2.bc" will bring in g, but not h. Can you
                      write a testcase showing what you were expecting
                      it to do but it is not?</div>
                    <div><br>
                    </div>
                    <div>Cheers,</div>
                    <div>Rafael</div>
                    <div><br>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
          -- <br>
          <div class="gmail_signature"><span
              style="font-family:times;font-size:medium">
              <table cellpadding="0" cellspacing="0">
                <tbody>
                  <tr
                    style="color:rgb(85,85,85);font-family:sans-serif;font-size:small">
                    <td
style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px"
                      nowrap="nowrap">Teresa Johnson |</td>
                    <td
style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"
                      nowrap="nowrap"> Software Engineer |</td>
                    <td
style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"
                      nowrap="nowrap"> <a moz-do-not-send="true"
                        href="mailto:tejohnson@google.com">tejohnson@google.com</a> |</td>
                    <td
style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"
                      nowrap="nowrap"> 408-460-2413</td>
                  </tr>
                </tbody>
              </table>
            </span></div>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>