<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 9 February 2017 at 14:33, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div class="h5">
    <p>On 02/08/2017 07:21 PM, Chandler
      Carruth wrote:<br></p>
    <blockquote type="cite">
      
      <div dir="ltr">It's blast from the past time!<br>
        <br>
        <div class="gmail_quote">
          <div dir="ltr">On Tue, Sep 18, 2012 at 3:28 PM Hal Finkel <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author:
            hfinkel<br class="m_7099146614558825418gmail_msg">
            Date: Tue Sep 18 17:25:07 2012<br class="m_7099146614558825418gmail_msg">
            New Revision: 164177<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project?rev=164177&view=rev" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=164177&view=rev</a><br class="m_7099146614558825418gmail_msg">
            Log:<br class="m_7099146614558825418gmail_msg">
            Add C/C++ header locations for the Freescale SDK.<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            The Freescale SDK is based on OpenEmbedded, and this might
            be useful<br class="m_7099146614558825418gmail_msg">
            for other OpenEmbedded-based configurations as well.<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            With minor modifications, patch by Tobias von Koch!<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Added:<br class="m_7099146614558825418gmail_msg">
                cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/<br class="m_7099146614558825418gmail_msg">
                cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/lib/<br class="m_7099146614558825418gmail_msg">
               
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/lib/.keep<br class="m_7099146614558825418gmail_msg">
                cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/<br class="m_7099146614558825418gmail_msg">
                cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<br class="m_7099146614558825418gmail_msg">
               
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>crt1.o<br class="m_7099146614558825418gmail_msg">
               
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>crti.o<br class="m_7099146614558825418gmail_msg">
               
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>crtn.o<br class="m_7099146614558825418gmail_msg">
               
cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>powerpc-fsl-linux/<br class="m_7099146614558825418gmail_msg">
               
cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>powerpc-fsl-linux/4.6.2/<br class="m_7099146614558825418gmail_msg">
               
cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>powerpc-fsl-linux/4.6.2/<wbr>crtbegin.o<br class="m_7099146614558825418gmail_msg">
               
cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>powerpc-fsl-linux/4.6.2/<wbr>crtend.o<br class="m_7099146614558825418gmail_msg">
            Modified:<br class="m_7099146614558825418gmail_msg">
                cfe/trunk/lib/Driver/<wbr>ToolChains.cpp<br class="m_7099146614558825418gmail_msg">
                cfe/trunk/test/Driver/linux-<wbr>ld.c<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Modified: cfe/trunk/lib/Driver/<wbr>ToolChains.cpp<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=164177&r1=164176&r2=164177&view=diff" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/Driver/<wbr>ToolChains.cpp?rev=164177&r1=<wbr>164176&r2=164177&view=diff</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
            --- cfe/trunk/lib/Driver/<wbr>ToolChains.cpp (original)<br class="m_7099146614558825418gmail_msg">
            +++ cfe/trunk/lib/Driver/<wbr>ToolChains.cpp Tue Sep 18 17:25:07
            2012<br class="m_7099146614558825418gmail_msg">
            @@ -1291,6 +1291,10 @@<br class="m_7099146614558825418gmail_msg">
                 "/gcc/" + CandidateTriple.str(),<br class="m_7099146614558825418gmail_msg">
                 "/" + CandidateTriple.str() + "/gcc/" +
            CandidateTriple.str(),<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            +    // The Freescale PPC SDK has the gcc libraries in<br class="m_7099146614558825418gmail_msg">
            +    // <sysroot>/usr/lib/<triple>/x.<wbr>y.z so have
            a look there as well.<br class="m_7099146614558825418gmail_msg">
            +    "/" + CandidateTriple.str(),<br class="m_7099146614558825418gmail_msg">
          </blockquote>
          <div><br>
          </div>
          <div>So, this is really bad it turns out.</div>
          <div><br>
          </div>
          <div>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><br>
          </div>
          <div>It ends up stat'ing *every single file* in
            /usr/lib/<triple> .... =[ For the current Ubuntu LTS
            for example, this causes roughly 3900 spurrious stat
            syscalls for every invocation of the Clang driver.</div>
          <div><br>
          </div>
          <div>Can we do something different here?</div>
        </div>
      </div>
    </blockquote>
    <br></div></div>
    Wow. Hrmm, okay. Why are we stating every file?</div></blockquote><div><br></div><div>That mistake seems to be baked into the design of llvm's directory_iterator. =(</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">In any case, are we
    just searching for a directory with the right triple? Or are we
    searching for the version-number directory and doing that by looking
    at every entry?<br></div></blockquote><div><br></div><div>The latter.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000">
     -Hal<div><div class="h5"><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_quote">
          <div> </div>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            +<br class="m_7099146614558825418gmail_msg">
                 // Ubuntu has a strange mis-matched pair of triples
            that this happens to<br class="m_7099146614558825418gmail_msg">
                 // match.<br class="m_7099146614558825418gmail_msg">
                 // FIXME: It may be worthwhile to generalize this and
            look for a second<br class="m_7099146614558825418gmail_msg">
            @@ -1300,6 +1304,7 @@<br class="m_7099146614558825418gmail_msg">
               const std::string InstallSuffixes[] = {<br class="m_7099146614558825418gmail_msg">
                 "/../../..",<br class="m_7099146614558825418gmail_msg">
                 "/../../../..",<br class="m_7099146614558825418gmail_msg">
            +    "/../..",<br class="m_7099146614558825418gmail_msg">
                 "/../../../.."<br class="m_7099146614558825418gmail_msg">
               };<br class="m_7099146614558825418gmail_msg">
               // Only look at the final, weird Ubuntu suffix for
            i386-linux-gnu.<br class="m_7099146614558825418gmail_msg">
            @@ -2374,6 +2379,9 @@<br class="m_7099146614558825418gmail_msg">
                 InstallDir.str() + "/include/g++-v4",<br class="m_7099146614558825418gmail_msg">
                 // Android standalone toolchain has C++ headers in yet
            another place.<br class="m_7099146614558825418gmail_msg">
                 LibDir.str() + "/../" + TripleStr.str() +
            "/include/c++/" + Version.str(),<br class="m_7099146614558825418gmail_msg">
            +    // Freescale SDK C++ headers are directly in
            <sysroot>/usr/include/c++,<br class="m_7099146614558825418gmail_msg">
            +    // without a subdirectory corresponding to the gcc
            version.<br class="m_7099146614558825418gmail_msg">
            +    LibDir.str() + "/../include/c++",<br class="m_7099146614558825418gmail_msg">
               };<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
               for (unsigned i = 0; i <
            llvm::array_lengthof(<wbr>IncludePathCandidates); ++i) {<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Added:
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/lib/.keep<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/lib/.keep?rev=164177&view=auto" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/freescale_ppc_tree/lib/<wbr>.keep?rev=164177&view=auto</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
                (empty)<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Added:
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>crt1.o<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crt1.o?rev=164177&view=auto" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/freescale_ppc_tree/usr/<wbr>lib/crt1.o?rev=164177&view=<wbr>auto</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
                (empty)<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Added:
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>crti.o<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crti.o?rev=164177&view=auto" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/freescale_ppc_tree/usr/<wbr>lib/crti.o?rev=164177&view=<wbr>auto</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
                (empty)<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Added:
            cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>crtn.o<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/crtn.o?rev=164177&view=auto" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/freescale_ppc_tree/usr/<wbr>lib/crtn.o?rev=164177&view=<wbr>auto</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
                (empty)<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Added:
cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>powerpc-fsl-linux/4.6.2/<wbr>crtbegin.o<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtbegin.o?rev=164177&view=auto" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/freescale_ppc_tree/usr/<wbr>lib/powerpc-fsl-linux/4.6.2/<wbr>crtbegin.o?rev=164177&view=<wbr>auto</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
                (empty)<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Added:
cfe/trunk/test/Driver/Inputs/<wbr>freescale_ppc_tree/usr/lib/<wbr>powerpc-fsl-linux/4.6.2/<wbr>crtend.o<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/freescale_ppc_tree/usr/lib/powerpc-fsl-linux/4.6.2/crtend.o?rev=164177&view=auto" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>Inputs/freescale_ppc_tree/usr/<wbr>lib/powerpc-fsl-linux/4.6.2/<wbr>crtend.o?rev=164177&view=auto</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
                (empty)<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            Modified: cfe/trunk/test/Driver/linux-<wbr>ld.c<br class="m_7099146614558825418gmail_msg">
            URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/linux-ld.c?rev=164177&r1=164176&r2=164177&view=diff" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/Driver/<wbr>linux-ld.c?rev=164177&r1=<wbr>164176&r2=164177&view=diff</a><br class="m_7099146614558825418gmail_msg">
==============================<wbr>==============================<wbr>==================<br class="m_7099146614558825418gmail_msg">
            --- cfe/trunk/test/Driver/linux-<wbr>ld.c (original)<br class="m_7099146614558825418gmail_msg">
            +++ cfe/trunk/test/Driver/linux-<wbr>ld.c Tue Sep 18 17:25:07
            2012<br class="m_7099146614558825418gmail_msg">
            @@ -462,3 +462,23 @@<br class="m_7099146614558825418gmail_msg">
             // CHECK-DEBIAN-ML-MIPS64EL:
            "-L[[SYSROOT]]/usr/lib/gcc/<wbr>mipsel-linux-gnu/4.4/../../.."<br class="m_7099146614558825418gmail_msg">
             // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/lib"<br class="m_7099146614558825418gmail_msg">
             // CHECK-DEBIAN-ML-MIPS64EL: "-L[[SYSROOT]]/usr/lib"<br class="m_7099146614558825418gmail_msg">
            +//<br class="m_7099146614558825418gmail_msg">
            +// Test linker invocation for Freescale SDK (OpenEmbedded).<br class="m_7099146614558825418gmail_msg">
            +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o
            2>&1 \<br class="m_7099146614558825418gmail_msg">
            +// RUN:     -target powerpc-fsl-linux \<br class="m_7099146614558825418gmail_msg">
            +// RUN:     --sysroot=%S/Inputs/<wbr>freescale_ppc_tree \<br class="m_7099146614558825418gmail_msg">
            +// RUN:   | FileCheck --check-prefix=CHECK-FSL-PPC %s<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC: "{{.*}}ld{{(.exe)?}}"
            "--sysroot=[[SYSROOT:[^"]+]]"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC: "-m" "elf32ppclinux"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC: "{{.*}}/crt1.o"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC: "{{.*}}/crtbegin.o"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC: "-L[[SYSROOT]]/usr/lib"<br class="m_7099146614558825418gmail_msg">
            +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o
            2>&1 \<br class="m_7099146614558825418gmail_msg">
            +// RUN:     -target powerpc64-fsl-linux \<br class="m_7099146614558825418gmail_msg">
            +// RUN:     --sysroot=%S/Inputs/<wbr>freescale_ppc64_tree \<br class="m_7099146614558825418gmail_msg">
            +// RUN:   | FileCheck --check-prefix=CHECK-FSL-PPC64 %s<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC64: "{{.*}}ld{{(.exe)?}}"
            "--sysroot=[[SYSROOT:[^"]+]]"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC64: "-m" "elf64ppc"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC64: "{{.*}}/crt1.o"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC64: "{{.*}}/crtbegin.o"<br class="m_7099146614558825418gmail_msg">
            +// CHECK-FSL-PPC64:
            "-L[[SYSROOT]]/usr/lib64/<wbr>powerpc64-fsl-linux/4.6.2/../.<wbr>."<br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            <br class="m_7099146614558825418gmail_msg">
            ______________________________<wbr>_________________<br class="m_7099146614558825418gmail_msg">
            cfe-commits mailing list<br class="m_7099146614558825418gmail_msg">
            <a href="mailto:cfe-commits@cs.uiuc.edu" class="m_7099146614558825418gmail_msg" target="_blank">cfe-commits@cs.uiuc.edu</a><br class="m_7099146614558825418gmail_msg">
            <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" rel="noreferrer" class="m_7099146614558825418gmail_msg" target="_blank">http://lists.cs.uiuc.edu/<wbr>mailman/listinfo/cfe-commits</a><br class="m_7099146614558825418gmail_msg">
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
    </div></div><span class="HOEnZb"><font color="#888888"><pre class="m_7099146614558825418moz-signature" cols="72">-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
  </font></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>