<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<div class="moz-cite-prefix">On 02/09/2017 04:58 PM, Chandler
Carruth wrote:<br>
</div>
<blockquote
cite="mid:CAAwGriFwiXLGOk=fEri9Agte4Su4kMEhuVtsb3pZfS2Nei=VBw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">On Thu, Feb 9, 2017 at 2:46 PM Tobias von Koch
<<a moz-do-not-send="true"
href="mailto:tobias.von.koch@gmail.com">tobias.von.koch@gmail.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr" class="gmail_msg">
<div class="gmail_extra gmail_msg">
<div class="gmail_quote gmail_msg">On Wed, Feb 8, 2017
at 7:21 PM, Chandler Carruth <span dir="ltr"
class="gmail_msg"><<a moz-do-not-send="true"
href="mailto:chandlerc@gmail.com"
class="gmail_msg" target="_blank">chandlerc@gmail.com</a>></span>
wrote:<br class="gmail_msg">
<blockquote class="gmail_quote gmail_msg"
style="margin:0 0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div dir="ltr" class="gmail_msg">
<div class="gmail_quote gmail_msg">
<blockquote class="gmail_quote gmail_msg"
style="margin:0 0 0 .8ex;border-left:1px #ccc
solid;padding-left:1ex"><br
class="m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg
gmail_msg">
+ // The Freescale PPC SDK has the gcc
libraries in<br
class="m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg
gmail_msg">
+ //
<sysroot>/usr/lib/<triple>/x.y.z
so have a look there as well.<br
class="m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg
gmail_msg">
+ "/" + CandidateTriple.str(),<br
class="m_7017874239008837365m_9143901571256477510m_-1562929267360893657gmail_msg
gmail_msg">
</blockquote>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">So, this is really bad it
turns out.</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_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_msg"><br class="gmail_msg">
</div>
</div>
</div>
</div>
<div dir="ltr" class="gmail_msg">
<div class="gmail_extra gmail_msg">
<div class="gmail_quote gmail_msg">
<div class="gmail_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>
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?<br>
<br>
<blockquote
cite="mid:CAAwGriFwiXLGOk=fEri9Agte4Su4kMEhuVtsb3pZfS2Nei=VBw@mail.gmail.com"
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">
<div dir="ltr" class="gmail_msg">
<div class="gmail_extra gmail_msg">
<div class="gmail_quote gmail_msg">
<div class="gmail_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>
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>
<br>
-Hal<br>
<br>
<blockquote
cite="mid:CAAwGriFwiXLGOk=fEri9Agte4Su4kMEhuVtsb3pZfS2Nei=VBw@mail.gmail.com"
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>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>