<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Oct 9, 2013 at 4:09 PM, Nick Kledzik <span dir="ltr"><<a href="mailto:kledzik@apple.com" target="_blank">kledzik@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Oct 9, 2013, at 11:23 AM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org">shankare@codeaurora.org</a>> wrote:<br>
> We have a whole bunch of readers(we would have some more too), and was thinking if we should have a vector of Readers, and have a function isMyFormat in each of them.<br>
><br>
> Any reader that knows to handle, goes ahead and parses the file.<br>
><br>
> On a side note, we currently use .objtxt as an figure out if the file is a YAML file or not. I have added FIXME's in the code, if we could some kind of magic (or) a better way to figure out if the file is YAML ?<br>
<br>
</div>On this topic, we should come up with standard file extension names. I made up .objtxt for atoms-in-yaml when writing the first test cases. We will soon need extensions for other kinds of yaml files (such as mach-o in yaml). With linker scripts we are stuck with there being no magic at the start and no standard file extension. For new yaml files that we are inventing we should define a standard file extension.<br>
</blockquote><div><br></div><div>There are a handful of common ones. Checking if the name contains `.lds` or `.ldscript` would probably cover most of the use cases. On the other hand, GNU ld's behavior is to assume that anything that isn't recognized as a binary object file (which are presumably identified by magic) is a linker script, and we probably want to emulate that behavior (certainly we don't want to assume that something passed to a GNU ld driver is YAML, unless explicitly told so via a flag not present in GNU ld).</div>
<div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
I agree with Rui that we should not be calling identify_magic() in every reader. Another approach is to just call each reader to try to parse until one succeeds. The first reader should be the native reader (e.g. ELF or mach-o), so that in the real world there is no time wasted looking at test case formats.<br>
<span class="HOEnZb"><font color="#888888"><br>
-Nick<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div></div>