Re: [rfc] Use target descriptions for PowerPC

Daniel Jacobowitz
2007-10-05T23:59:11Z

On Fri, Oct 05, 2007 at 06:40:46PM -0300, Thiago Jung Bauermann wrote:
> Hi Daniel,
>
> On Fri, 2007-10-05 at 12:37 -0400, Daniel Jacobowitz wrote:
> > + /* If we have a 64-bit binary on a 32-bit target, complain. Also
> > + complain for a 32-bit binary on a 64-bit target; we do not yet
> > + support that. */
> > + if (tdesc_wordsize != -1 && tdesc_wordsize != wordsize)
> > + {
> > + tdesc_data_cleanup (tdesc_data);
> > + return NULL;
> > + }
>
> Sorry if I am confusing things here. This sounds like it affects 64 bit
> GDB debugging 32 bit binary. Is this the case? Or only for remote
> debugging?

Good noticing, it could be a problem, but it works out fine - we don't
have a supplied target description in this case, so we pick a default
based on the 32-bit binary, and get a 32-bit binary; everything
matches. Then the GNU/Linux native code handles the details. I've
just tested that.

The problem I'm trying to prevent is that we will always use registers
of the size described by the target description. And we don't support
implementing the 32-bit ABI on top of 64-bit GPRs; we'll copy
arguments into the high half of registers when calling functions, for
instance. Try connecting a GDB to a 64-bit gdbserver and it will go
wrong in a couple of ways. The native targets fake this by knowing
how to supply 32-bit registers when expected, even if you'd think
there ought to be 64-bit registers.