<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Don't add symbol name strings to non-alloc string table in program header"
   href="https://bugs.llvm.org/show_bug.cgi?id=43936">43936</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Don't add symbol name strings to non-alloc string table in program header
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llvm-objcopy/strip
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jh7370.2008@my.bristol.ac.uk
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>alexander.v.shaposhnikov@gmail.com, jake.h.ehrlich@gmail.com, jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org, rupprecht@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is closely related to <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - --add-symbol produces invalid symbol table for ELF with program headers and no symbol table"
   href="show_bug.cgi?id=43935">bug 43935</a> and <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Stop clearing all non-alloc string tables"
   href="show_bug.cgi?id=43931">bug 43931</a>, but is somewhat separate.

If --add-symbol is run on an ELF with no symbol table, a symbol table is
created. The names of symbols in that symbol table are placed in the first
non-alloc string table section that can be found that is not the section header
string table, falling back to the section header string table if no such
section can be found. It is possible that a string table could be found that is
contained within a program header. If this table is used, the strings will be
"added" to that table, but not actually appear in the output, because within
segments, the program header contents are preserved. It does however change the
section header size (but see also <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Stop clearing all non-alloc string tables"
   href="show_bug.cgi?id=43931">bug 43931</a>). Additionally, if the strings
added are long enough, the names could extend past the end of the program
header, and be written in space after it. I haven't checked exactly what will
happen, but either these strings will be overwritten by something later, or
they themselves will overwrite this data later. Either is bad. The change in
the section header size could also cause layout to be messed up.

We shouldn't pick sections within segments as candidates for the new symbol
table's string table.

Note that <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - --add-symbol produces invalid symbol table for ELF with program headers and no symbol table"
   href="show_bug.cgi?id=43935">bug 43935</a> means the output file will be invalid, even if this is
fixed.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>