This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix -fpic/-fPIC virtual thunks on s390 -m31


Hi Jakub,

> > s390 31-bit .plt slots require %r12 to be loaded with .plt's shared library
> > _GLOBAL_OFFSET_TABLE_. As we cannot load that (%r12 is call-saved and we
> > don't return back into the thunk (we would have to copy arguments otherwise
> > and we don't know how many there are), we cannot use .plt.
> 
> I had thought that in this case, the call to the thunk would count as
> call to a non-local function and thus the caller would have to set up
> the GOT pointer.  Is this not the case?  (If not, can it be arranged?
> That would certainly be the best solution.)

Actually, this was probably nonsense.  If I recall correctly, the thunks
are generated next to the *callee*, not the caller.  This means that
going from the thunk to the target function need not involve either
GOT or PLT.

Therefore, simply removing those lines:

  if (flag_pic && !SYMBOL_REF_FLAG (op[0]))
    {
      op[0] = gen_rtx_UNSPEC (Pmode, gen_rtvec (1, op[0]), 113);
      op[0] = gen_rtx_CONST (Pmode, op[0]);
    }

should really fix the problem ...  (The target function is then
accessed pc-relative by the current thunk code, so it should be
fine for -fpic.)

(Unfortunately I don't have access to a s390 right now, so I can't
test it.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]