<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Sep 29, 2015 at 8:14 PM, Rafael Ávila de Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">rafael added inline comments.<br>
<br>
================<br>
Comment at: ELF/DriverUtils.cpp:202<br>
@@ +201,3 @@<br>
+// Returns true if Path seems to be a linker script.<br>
+bool isLinkerScript(llvm::StringRef Path) {<br>
+  // Because the linker script is just a text file that has no magic bytes,<br>
----------------<br>
This opens a file, mmaps it, calls identify_magic and then drops everything and returns a bool :-(<br></blockquote><div><br></div><div>Opening file a few times is probably not too that bad unless you are using peculiar file system or anti-virus software or whatever. But yeah, I actually felt the same when I was writing this code. I'll try to fix that.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Could this be reorganized into something like<br>
<br>
addInptsForArg(StringRef Arg) {<br>
  open file<br>
  check type<br>
   if (archiver or elf) {<br>
      add it.<br>
      return;<br>
  }<br>
  parse linker script.<br>
}<br>
<br>
That way we only open, mmap and identify each file once.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D13232" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13232</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>