<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 9 February 2017 at 16:15, Hal Finkel via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF"><span class="gmail-">
    <p>On 02/09/2017 04:58 PM, Chandler
      Carruth wrote:<br></p>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div class="gmail_quote">
          <div dir="ltr">On Thu, Feb 9, 2017 at 2:46 PM Tobias von Koch
            <<a href="mailto:tobias.von.koch@gmail.com" target="_blank">tobias.von.koch@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" class="gmail-m_-7877134710072158855gmail_msg">
              <div class="gmail_extra gmail-m_-7877134710072158855gmail_msg">
                <div class="gmail_quote gmail-m_-7877134710072158855gmail_msg">On Wed, Feb 8, 2017
                  at 7:21 PM, Chandler Carruth <span dir="ltr" class="gmail-m_-7877134710072158855gmail_msg"><<a href="mailto:chandlerc@gmail.com" class="gmail-m_-7877134710072158855gmail_msg" target="_blank">chandlerc@gmail.com</a>></span>
                  wrote:<br class="gmail-m_-7877134710072158855gmail_msg">
                  <blockquote class="gmail_quote gmail-m_-7877134710072158855gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
                    <div dir="ltr" class="gmail-m_-7877134710072158855gmail_msg">
                      <div class="gmail_quote gmail-m_-7877134710072158855gmail_msg">
                        <blockquote class="gmail_quote gmail-m_-7877134710072158855gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br class="gmail-m_-7877134710072158855m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg gmail-m_-7877134710072158855gmail_msg">
                          +    // The Freescale PPC SDK has the gcc
                          libraries in<br class="gmail-m_-7877134710072158855m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg gmail-m_-7877134710072158855gmail_msg">
                          +    //
                          <sysroot>/usr/lib/<triple>/x.<wbr>y.z
                          so have a look there as well.<br class="gmail-m_-7877134710072158855m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg gmail-m_-7877134710072158855gmail_msg">
                          +    "/" + CandidateTriple.str(),<br class="gmail-m_-7877134710072158855m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg gmail-m_-7877134710072158855gmail_msg">
                        </blockquote>
                        <div class="gmail-m_-7877134710072158855gmail_msg"><br class="gmail-m_-7877134710072158855gmail_msg">
                        </div>
                        <div class="gmail-m_-7877134710072158855gmail_msg">So, this is really bad it
                          turns out.</div>
                        <div class="gmail-m_-7877134710072158855gmail_msg"><br class="gmail-m_-7877134710072158855gmail_msg">
                        </div>
                        <div class="gmail-m_-7877134710072158855gmail_msg">We use this directory to
                          walk every installed GCC version. But because
                          this is just a normal lib directory on many
                          systems (ever Debian and Ubuntu system for
                          example) this goes very badly. It goes even
                          more badly because of the (questionable)
                          design of LLVM's directory iterator:</div>
                      </div>
                    </div>
                  </blockquote>
                  <div class="gmail-m_-7877134710072158855gmail_msg"><br class="gmail-m_-7877134710072158855gmail_msg">
                  </div>
                </div>
              </div>
            </div>
            <div dir="ltr" class="gmail-m_-7877134710072158855gmail_msg">
              <div class="gmail_extra gmail-m_-7877134710072158855gmail_msg">
                <div class="gmail_quote gmail-m_-7877134710072158855gmail_msg">
                  <div class="gmail-m_-7877134710072158855gmail_msg">Wow, this is pretty bad, but it
                    really sounds like the iterator should be fixed
                    rather than trying to hack around it.</div>
                </div>
              </div>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>I mean, we should.</div>
          <div><br>
          </div>
          <div>But even then, walking the entire directory seems bad
            too... See below.</div>
        </div>
      </div>
    </blockquote>
    <br></span>
    Agreed. FWIW, it looks like LLVM's directory iterators stat lazily
    (although doing an equality comparison will cause them to stat). Is
    going through Clang's VFS layer causing the eager stating somehow?<span class="gmail-"><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div> </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" class="gmail-m_-7877134710072158855gmail_msg">
              <div class="gmail_extra gmail-m_-7877134710072158855gmail_msg">
                <div class="gmail_quote gmail-m_-7877134710072158855gmail_msg">
                  <div class="gmail-m_-7877134710072158855gmail_msg"> Doesn't this happen for the
                    other directories as well (which, admittedly, will
                    have less entries)?</div>
                </div>
              </div>
            </div>
          </blockquote>
          <div><br>
          </div>
          <div>The *only* entries in the other directories are the
            actual installed GCC toolchains though, so walking them
            makes a lot of sense. The tricky thing is that this isn't a
            gcc-specific directory.</div>
          <div><br>
          </div>
          <div>I suspect the fix should be to not use this base path as
            part of the walk to discover GCC toolchains, and instead to
            hard code the specific toolchain patterns on this specific
            platform.</div>
          <div><br>
          </div>
          <div>Or we could do the walk, but only when actually on the
            NXP/Freescale Power platform where this is necessary to find
            GCC installations.</div>
        </div>
      </div>
    </blockquote>
    <br></span>
    Given that we don't have a platform on which to test right now, I
    think that this second option sounds best. Only add those
    directories to the search path when -fsl- is in the triple (or
    something like that).<br></div></blockquote><div><br></div><div>Done in r295139.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
     -Hal<span class="gmail-"><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div><br>
          </div>
          <div>Both of those would seem reasonable. Fixing the directory
            iterator would be icing on the cake IMO. =D</div>
        </div>
      </div>
    </blockquote>
    <br>
    </span><span class="gmail-"><pre class="gmail-m_-7877134710072158855moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </span></div>

<br>______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div>