<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 - llvm-objcopy adds incorrect padding between sections"
   href="https://bugs.llvm.org/show_bug.cgi?id=35708">35708</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-objcopy adds incorrect padding between sections
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>llvm@owenpshaw.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=19582" name="attach_19582" title="Align segment using physical instead of virtual address">attachment 19582</a> <a href="attachment.cgi?id=19582&action=edit" title="Align segment using physical instead of virtual address">[details]</a></span>
Align segment using physical instead of virtual address

On a bare metal ARM project, llvm-objcopy creates a binary file that has a lot
of extra zero padding before the .data section.  GNU objcopy does not add this
padding.

It appears to be related to the LayoutSegments function and its use of
alignToAddr.  The alignment is based off the segment's virtual address, which
in my .data case is different from its physical address.

Changing LayoutSegments to align using the physical address works like a charm
(see attached patch).

Does anyone agree/disagree that using the physical address correct?  It doesn't
break any tests, but none of the tests used different virtual and physical
addresses.</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>