<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:rafael@espindo.la" title="Rafael Ávila de Espíndola <rafael@espindo.la>"> <span class="fn">Rafael Ávila de Espíndola</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - _GLOBAL_OFFSET_TABLE_ does not point to the beginning of .got.plt"
   href="https://bugs.llvm.org/show_bug.cgi?id=36555">bug 36555</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>WONTFIX
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - _GLOBAL_OFFSET_TABLE_ does not point to the beginning of .got.plt"
   href="https://bugs.llvm.org/show_bug.cgi?id=36555#c9">Comment # 9</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - _GLOBAL_OFFSET_TABLE_ does not point to the beginning of .got.plt"
   href="https://bugs.llvm.org/show_bug.cgi?id=36555">bug 36555</a>
              from <span class="vcard"><a class="email" href="mailto:rafael@espindo.la" title="Rafael Ávila de Espíndola <rafael@espindo.la>"> <span class="fn">Rafael Ávila de Espíndola</span></a>
</span></b>
        <pre>(In reply to Rafael Ávila de Espíndola from <a href="show_bug.cgi?id=36555#c8">comment #8</a>)
<span class="quote">> > With this in mind I think our best course of action is:
> > - Extend writeGotPltHeader() to more targets.
> > - Either adjust the default section sorting to make sure .got.plt follows
> > .got or change _GLOBAL_OFFSET_TABLE_ to the start of the .got.plt.

> Interesting. This would mean flipping relro to the start of the RW program
> header since .got is RELRO and .got.plt is not.

> I will dig at the history a bit to see why we have the current order.</span >

Found it.

The reason is that we need to have a single RelRO area covering nobits and non
nobits sections. Since bss has to go at the end, so has RelRo:

  // We place nobits RelRo sections before plain r/w ones, and non-nobits RelRo 
  // sections after r/w ones, so that the RelRo sections are contiguous.        
  bool IsRelRo = isRelroSection(Sec);
  if (IsNonTlsNoBits && !IsRelRo)
    Rank |= RF_NON_TLS_BSS_RO;
  if (!IsNonTlsNoBits && IsRelRo)
    Rank |= RF_NON_TLS_BSS_RO;

My understanding is that gnu linker just never use a RelRO nobits sections.

It seems we have to make the section _GLOBAL_OFFSET_TABLE_ points to
architecture dependent or change glibc (not sure how realistic that is).</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>