<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:marcus@mc.pp.se" title="Marcus Comstedt <marcus@mc.pp.se>"> <span class="fn">Marcus Comstedt</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - PPC32: Base pointer clobbered with -fPIC"
   href="http://llvm.org/bugs/show_bug.cgi?id=22115">bug 22115</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;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>FIXED
           </td>
           <td>---
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - PPC32: Base pointer clobbered with -fPIC"
   href="http://llvm.org/bugs/show_bug.cgi?id=22115#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - PPC32: Base pointer clobbered with -fPIC"
   href="http://llvm.org/bugs/show_bug.cgi?id=22115">bug 22115</a>
              from <span class="vcard"><a class="email" href="mailto:marcus@mc.pp.se" title="Marcus Comstedt <marcus@mc.pp.se>"> <span class="fn">Marcus Comstedt</span></a>
</span></b>
        <pre>Hi.

Thanks.  I tried the fix, but it doesn't seem quite correct yet.

r30 is now saved in the stack frame, but the size of the stack frame is not
increased, so the saved value now overlaps another value?!

The code generated for foo() is now:

foo:
    mflr 0
    stw 31, -4(1)
    stw 30, -8(1)
    stw 0, 4(1)
    stwu 1, -16(1)
    mr 31, 1
    bl .L0$pb
.L0$pb:
    mflr 30
    lwz 3, .L0$poff-.L0$pb(30)
    add 30, 3, 30
    lwz 3, .LC1-.L.TOC.(30)
    lwz 3, 0(3)
    lwz 4, .LC3-.L.TOC.(30)
    crxor 6, 6, 6
    bl fprintf@PLT
    li 4, 0
    stw 3, 8(31)
    mr 3, 4
    addi 1, 1, 16
    lwz 0, 4(1)
    lwz 31, -4(1)
    lwz 30, -8(1)
    mtlr 0
    blr

So r30 is saved at -8(1), which is 8(31).  But this is also where the return
value of fprintf() is stored!  So on return r30 will have the value 4 (giving
a segfault)...

Am I missing something here?  I was only able to apply the patch to
PPCFrameLowering.cpp because the change to PPCISelDAGToDAG.cpp concerns small
pic which is not included in 3.5.0...</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>