<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 30, 2012, at 7:12 AM, Shankar Easwaran wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
  
    <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi Nick,<br>
      <br>
      I had a few questions :-<br>
      <br>
      1) Is there a way to validate that the input file is of a valid
      format, thats defined by the YAML Reader ? <br></div></div></blockquote><div>Do you mean different than if the yaml reader accepts it?   Tons of files will be valid yaml syntactically.  It is the semantic level checking that is hard, and that is what YAML I/O does. </div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix">
      2) How are you plannning to represent section groups in the YAML ?<br></div></div></blockquote><div>You mean the ELF concept of section groups in YAML encoded ELF?   The YAML encoding of ELF (or COFF or mach-o) does not know anything deeper about the meaning of the files.  It is just the bytes from each section and the entries in the symbol table.  If a section group is a section of bytes which are interpreted as an array of symbol/section indexes, then the ELF encoded YAML just has the raw bytes for the section.</div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix">
      3) How are you planning to support Atom specific flags ? Is there
      a way already ?<br>
          (This would be needed to group similiar atoms together)<br></div></div></blockquote><div>It is still an open question how to support platform specific Atom attributes.  As much as possible we'd like to expand the Atom model to be a superset of all the platform specific flags.  But there are some attributes that are very much tied to one platform.  One idea is to just add a new Reference which has no target but its kind (and maybe addend) encode the platform specific attributes.  The Reference kind is already platform specific.</div><div><br></div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix">
      4) Are you planning to support representing shared libraries too
      in this model ?<br></div></div></blockquote><div>Yes, we already support shared library atoms in yaml.</div><div><br></div><br><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix">
      5) are you planning to support dwarf information too ?<br></div></div></blockquote><div>Debugging information is another big open question.  The dwarf format is very much tied to the section model.  Not only is the debug information put is sections with special names, but the dwarf debug into references code by its address in the .o files (the Atom model does not model addresses).    I'm sure the lldb guys have some ideas on direction of where they would like debug information to go.  It may be that the Atom model has a different representation for debug info.  And when generating a final linked image you can choose the debug format you want.  A Writer could convert the debug info to dwarf if requested.  </div><div><br></div><div>-Nick</div><div><br></div><blockquote type="cite"><div bgcolor="#FFFFFF" text="#000000"><div class="moz-cite-prefix"><br>
      On 10/29/2012 9:26 PM, Nick Kledzik wrote:<br>
    </div>
    <blockquote cite="mid:C8612530-20B0-4AB9-BA81-268566A682E0@apple.com" type="cite">
      <div>Michael,</div>
      <div><br>
      </div>
      <div>To validate the refactor of YAML Reader/Writer using YAML
        I/O.  I updated all the test cases to be compatible with YAML
        I/O.  One issue that was a gnarly was how to handle the test
        cases with archives.  Currently, we have test cases like:</div>
      <div><br>
      </div>
      <div><font class="Apple-style-span" face="Monaco" size="2">---</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">atoms:</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">    -
          name: foo</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">     #
          more stuff</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">---</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">archive:</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">   -
          name bar.o </font></div>
      <div><span class="Apple-style-span" style="font-family: Monaco;
          font-size: small; ">     atoms:</span></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">     
           - name:  bar</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">
          <div style="font-family: Helvetica; font-size: medium; "><font class="Apple-style-span" face="Monaco" size="2">        #
              more stuff</font></div>
          <div><font class="Apple-style-span" face="Monaco" size="2"><br>
            </font></div>
        </font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2"><br>
        </font></div>
      <div>This sort of weak/dynamic typing is hard to using with YAML
        I/O which enforces stronger typing which helps it do better
        error checking.   The core of the problem is when a new document
        is started, we don't know what kind of file it is going to be,
        to know what keys are legal.   I first looked into used tags to
        specify the document type.  For example:</div>
      <div><br>
      </div>
      <div>
        <div><font class="Apple-style-span" face="Monaco" size="2">---
            !archive</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">members:</font></div>
      </div>
      <div><font class="Apple-style-span" face="Monaco" size="2">   -
          name: bar.o</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">
          <div style="font-family: Helvetica; font-size: medium; "><font class="Apple-style-span" face="Monaco" size="2">   # more
              stuff</font></div>
          <div><br>
          </div>
        </font></div>
      <div>But after modifying YAMLParser to make that the tag
        available, then trying to figure out how to make the tag
        actionable in the trait, I realized that for maps, the tag is
        just like another key.  So, if every client agreed that the
        first key/value was a particular key name (e.g. tag:  type)
        which YAML I/O already supports, then there is no need for tags
        and no need for an additional mechanism in YAML I/O.</div>
      <div><br>
      </div>
      <div>So, I know have the traits set up to support archives
        assuming the first (option) key of each document type read by
        lld will be "kind:".  The archive-basic.objctxt case now looks
        like:</div>
      <div><br>
      </div>
      <div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            RUN: lld-core %s | FileCheck %s</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            Tests archives in YAML. Tests that an undefined in a regular
            file will load</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"># all
            atoms in select archive members.</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">---</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">defined-atoms:</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">    -
            name:              foo</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
            type:              code</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">undefined-atoms:</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">    -
            name:              bar</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">---</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">kind:
                              archive</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">members:</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">  -
            name:               bar.o</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">   
            content:</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
            defined-atoms:</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
              - name:              bar</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
                scope:             global</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
                type:              code</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
              - name:              bar2</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
                type:              code</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">  -
            name:               baz.o</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">   
            content: </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
            defined-atoms:</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
              - name:              baz</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
                scope:             global</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
                type:              code</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
              - name:              baz2</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">     
                type:              code</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">...</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2"><br>
          </font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            CHECK:       name:       foo</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            CHECK-NOT:  undefined-atoms:</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            CHECK:       name:       bar</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            CHECK:       name:       bar2</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            CHECK-NOT:   name:       baz</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">#
            CHECK:       ...</font></div>
      </div>
      <div><br>
      </div>
      <div>My thinking is that we can extend this to support embedded
        COFF/ELF/MachO in yaml by using new kind values.  For example:</div>
      <div><br>
      </div>
      <div>
        <div><font class="Apple-style-span" face="Monaco" size="2">---</font></div>
        <div><font class="Apple-style-span" face="Monaco" size="2">kind:
                              object-coff</font></div>
      </div>
      <div><font class="Apple-style-span" face="Monaco" size="2">header:</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">   #
          stuff </font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">sections:</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">   #
          stuff </font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">symbols:</font></div>
      <div><font class="Apple-style-span" face="Monaco" size="2">
          <div style="font-family: Helvetica; font-size: medium; "><font class="Apple-style-span" face="Monaco" size="2">   #
              stuff </font></div>
          <div><font class="Apple-style-span" face="Monaco" size="2">...</font></div>
        </font></div>
      <div><br>
      </div>
      <div>The MappingTrait<const ld::File*> will look at the kind
        value and switch off it.   We just need an external function
        (per file format) which can be called with the same mapping()
        parameters which will do the io.map*() calls and have traits for
        platform specific types,  which turns the yaml into an in-memory
        binary object, then runs the Reader to return a File*.  I'll be
        prototyping this approach for mach-o.</div>
      <div><br>
      </div>
      <div>-Nick</div>
      <div><br>
      </div>
      <br>
      <div>
        <div>On Oct 25, 2012, at 9:59 AM, Sean Silva wrote:</div>
        <blockquote type="cite">
          <div>
            <blockquote type="cite">To better understand how a client
              would use YAML I/O.  I've completely rewritten the
              ReaderYAML and WriterYAML in lld to use YAML I/O.  The
              source code is now about half the size.  But more
              importantly,  the error checking is much, much better and
              any time an attribute (e.g. of an Atom) is changed or
              added, there is just one place to update the yaml code
              instead of two places (the reader and writer).<br>
            </blockquote>
            <br>
            Fantastic!<br>
          </div>
        </blockquote>
      </div>
      <br>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation</pre>
  </div>

</blockquote></div><br></body></html>