<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;"><div>Shankar,</div><div><br></div><div>I think your proposal and mine are pretty much the same.  The difference is passing back info to the InputGraph as a parameter in nextFile() vs as a separate method call.    My original draft email had a parameter in nextFile(), but it seemed a little confusing because the information was referring to the previous file.  That is, if the current resolver state has newDefinedAtoms, that really means the last file (returned by nextFile()) caused new atoms to be added.  </div><div><br></div><div>In your ResolverState you have bits for all the kinds of atoms added.  Is all that needed?  I think all the InputGraph needs to know is if the last file was used.  A group is scanned repeatedly until there is one complete pass in which no new files were used.  </div><div><br></div><div>Also, is nextFile() going to be in InputGraph and directly accessed by the Resolver?  Or is nextFile in LinkingContext (which forwards it to the InputGraph)?  I assume the later.</div><div><br></div><div>Currently, the Resolver has buildInitialAtomList() and resolveUndefines() which matches the way darwin links.  I assume part of this change is to unify those two methods by just have one loop that uses nextFile().</div><div><br></div><div>Given that nextFile() is basically an iteration mechanism, perhaps we can make it conform to C++11 iterators.  The one issue is the feedback of whether the file was used or not.  A separate notifyFileAddedContent() method (instead of a parameter to nextFile()) could fix that.  And if Resolver::doFile() called linkingContext.notifyFileAddedContent() for every file used (even object files), then the Resolver algorithm would look like:</div><div><br></div><div>     for (File *file : linkingContext) {</div><div>        if (file.kind() == object) {</div><div>          // add</div><div>        }</div><div>        else if (file.kind() == archive) {</div><div><span class="Apple-tab-span" style="white-space:pre">   </span>    if (resolvesSomeUndefs(file)) {</div><div><span class="Apple-tab-span" style="white-space: pre;">      </span>       // add </div><div><span class="Apple-tab-span" style="white-space:pre">      </span>    }</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>}</div><div>     }</div><div><br></div><div>-Nick</div><div><br></div><br><div><div>On Sep 20, 2013, at 5:56 PM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>> wrote:</div><blockquote type="cite">
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Nick,<br>
      <br>
      Read this along with this example extract:<br>
      <br>
      ld -flavor gnu main.o thread.o --start-group libc.a libpthread.a
      --end-group function.o <br>
      <br>
      main.o has atoms <br>
      ------------------------ <br>
      main (defined) <br>
      printf(undefined) <br>
      fn(undefined) <br>
      <br>
      thread.o has atoms <br>
      ----------------------------- <br>
      pthread_create (undefined) <br>
      <br>
      libc.a(printf.o) has atoms <br>
      ------------------------------------ <br>
      printf(defined) <br>
      <br>
      libc.a(exit.o) has atoms <br>
      ---------------------------------- <br>
      exit(defined) <br>
      <br>
      libpthread.a has atoms <br>
      --------------------------------- <br>
      pthread_create(defined) <br>
      exit(undefined) <br>
      <br>
      function.o has atoms <br>
      ------------------------------- <br>
      fn(defined) <br>
      <br>
      Thanks<br>
      <br>
      Shankar Easwaran<br>
      <br>
      On 9/20/2013 7:42 PM, Shankar Easwaran wrote:<br>
    </div>
    <blockquote cite="mid:523CEB6F.8040304@codeaurora.org" type="cite">
      <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
      <div class="moz-cite-prefix">Hi,<br>
        <br>
        Attached is the pdf of the operation to make things easier to
        read.<br>
        <br>
        Thanks<br>
        <br>
        Shankar Easwaran<br>
        <br>
        On 9/20/2013 7:04 PM, Shankar Easwaran wrote:<br>
      </div>
      <blockquote cite="mid:523CE29D.8020900@codeaurora.org" type="cite">
        <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
        <div class="moz-cite-prefix">My email client spoilt the whole
          email, will create a pdf and send it.<br>
          <br>
          On 9/20/2013 7:00 PM, Shankar Easwaran wrote:<br>
        </div>
        <blockquote cite="mid:523CE195.601@codeaurora.org" type="cite">Hi

          Nick, <br>
          <br>
          On 9/20/2013 5:59 PM, Nick Kledzik wrote: <br>
          <blockquote type="cite">On Sep 20, 2013, at 3:42 PM, Shankar
            Easwaran <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:shankare@codeaurora.org"><shankare@codeaurora.org></a>
            wrote: <br>
            <blockquote type="cite">nextFile could pass the current
              resolver state at the time when its called, the
              linkingcontext can return the next file to be processed as
              below :- <br>
              <br>
              nextFile(currentResolverState) :- <br>
              <br>
              a) Returns the next file if the current node is not a
              group node <br>
              b) Returns the next file in the group node, if the current
              node is a group node and the resolver state states
              undefined /weak / shared library atoms were added. <br>
              c) Returns the start file in the group node, if the
              resolver state states undefined/weak/shared library atoms
              were added <br>
              d) If the state is unchanged, no symbols were added exit
              the group and move to the next node. <br>
            </blockquote>
            What causes the Resolver state to change?   I understand the
            state of “there are undefines remaining”, but the “something
            was added” is a transient state.  Each last file, changes
            it. <br>
          </blockquote>
          <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
        </blockquote>
        <br>
        <br>
      </blockquote>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation</pre>
  </div>

<span><design.pdf></span></blockquote></div><br></body></html>