<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 - Handle out-of-order PT_LOADs better"
   href="https://bugs.llvm.org/show_bug.cgi?id=45698">45698</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Handle out-of-order PT_LOADs better
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>llvm-readobj
          </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>jh7370.2008@my.bristol.ac.uk, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The gABI requires loadable segments to be in ascending address order. The LLVM
Object library relies on this when looking up addresses (see "toMappedAddr",
specifically the std::upper_bound call for at least one example). If the order
is wrong, it can result in "virtual address is not in any segment" warnings,
which is confusing and not strictly correct, but rather is the result of the
std::upper_bound call not working well for unsorted program headers.

We have two options:
1) Sort the program headers up front before the lookup mentioned in the
example. This would solve the issue in this one place, but there may well be
various others which this doesn't handle.
2) Add a warning if the program headers are out-of-order in the tool. This
should be more clearly understandable than the current warning, and would
hopefully stop people relying on out-of-order segments.

One of our users recently ran into some confusion because of this after using a
linker script which did something wrong. We might also want to consider adding
a warning to LLD for this situation - see <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Warn if PT_LOAD segments are out-of-order"
   href="show_bug.cgi?id=45697">bug 45697</a>.</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>