<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 - Sections with linker-script added contents are treated as zero-size for RELRO processing"
   href="https://bugs.llvm.org/show_bug.cgi?id=35478">35478</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Sections with linker-script added contents are treated as zero-size for RELRO processing
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>ELF
          </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>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is a problem with r318924, which I discovered when I was trying to rebase
<a href="https://reviews.llvm.org/D38361">https://reviews.llvm.org/D38361</a>.

The change added isOutputSectionZeroSize(), which is called during the loop for
assigning segments to relro. By this point, the section Size (both for regular
and synthetic sections) field is not final. They are only final once
assignAddresses() has been called. If a linker script contains a section
assignment with BYTE-style commands, or Dot assignments, such as either of the
two below, it will still be treated as empty, and consequently could end up
being allocated to the relro segment.

Example directives:
.foo : { . += 1; *(.foo) }
.bar : { BYTE(1); *(.bar) }

To reproduce, modify the test in ELF/relro-non-contiguous-zerosize.s such that
the ".zero_size" section in the linker script has one of the above, then
observe that it is still in the RELRO segment in the output.

This does not affect all SyntheticSections, because some do not use Size in
their empty() function, but some do. It does affect all other sections.</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>