Doug Kwan (關振德) <[email protected]> wrote on 08.05.2014 10:43:14:
On Thu, May 8, 2014 at 1:36 AM, Alexander Graf <[email protected]> wrote: >> - _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias; >> - infop->entry = ldq_raw(infop->entry) + infop->load_bias; >> + if (get_ppc64_abi(infop) < 2) { >> + _regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_bias; >> + infop->entry = ldq_raw(infop->entry) + infop->load_bias; >> + } else { >> + _regs->gpr[12] = infop->entry; /* r12 set to global entry address */ >> >> Uli, is this correct? Also, why don't w need to adjust for the >> load_bias with ELFv2 anymore? > > No. This is a bug. It was not caught by testing because load_bias > is 0 I guess. Actually, it looks correct to me. The value of infop->entry itself was presumably already adjusted for the load bias by common code. However, on ELFv1, that value points to the descriptor, but the values we *load* from that descriptor *also* need to be adjusted by the load bias, since the image has not yet been relocated at this stage. With ELFv2, the (already adjusted) infop->entry value points directly to the code, so no further adjustment is required. Bye, Ulrich
