This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: m68k-elf return value registers


> From: Vladimir Prus <vladimir@codesourcery.com>
> Date: Fri, 14 Jan 2011 01:57:38 +0300
> 
> This patch, originally written by Nathan Sidwel, makes m68k-tdep.c use right 
> registrers for returning values from functions on bare metal. There are 
> actually 3 parts:
> 
> 1. Right now, it's assumed that pointer values are returned in %a0. However,
> for m68k-elf, they are returned in %d0. So, this patch makes %a0 the default,
> and then makes OSABI sniffers set %a0 again.
> 
> 2. Structures can be returned in either %a0 or %a1. This was discussed 
> previously at:
> 
> 	http://thread.gmane.org/gmane.comp.gdb.devel/20117
> 
> I have now put together a table listing what register gcc uses, and how
> gdb does the same with this patch. See:
> 
> 	http://tinyurl.com/5r2j5x6
> 
> As you see, in the end we have only uclinuxoldeabi using wrong register
> (just as now). I am not sure whether (i) this can be fixed, and (ii) anybody
> care, given that this target was proposed for deprecation in gcc 4.6. Anyway,
> if somebody cares, it can be done with a separate patch.
> 
> 3. This patch also updates the logic that decides whether structure is 
> returned in memory or registers. This is a black magic written by Nathan
> that I don't pretend to understand.
> 
> Is this OK? I have tests still running, but they will only cover elf and 
> linux, so it would be great to have somebody check behaviour for other
> targets.

Sorry, but this doesn't make an awful lot of sense to me.  For one
thing, there is no such thing as an OpenBSD ELF platform.
OpenBSD/m68k still uses a.out as its executable format.

Second, there is a formal System V ABI for the Motorola 68000.  I
think GCC has never properly implemented that ABI.  But it seems that
GCC has diverged even more from it in the last couple of years.
Probably the point has been reached that you shouldn't call this the
System V ABI anymore.  So it'd make more sense to implement the GCC
ABI in its own set of functions, and leave the SVR4 variants (largely)
alone.

Then, m68k_reg_struct_return_r() is a nonsensical name.  That function
should probably be renamed in something like
m68k_gcc_reg_struct_return_p().  The comment isn't really helpful,
since it uses GCC-specific terminology.  Can the rules be formulated
in a more GDB-centric way?  I never quite understood what BLKmode is,
and I always have to look up what QI mode, SF mode, etc. etc. are.

Also, you should make sure that that code doesn't get used for
OpenBSD/m68k a.out, since it will be wrong.

Also, I think you're trying to fix too many issues in a single diff,
which makes it hard to review.  Can you split this up in seperate
diffs each addressing a seperate issue?  That should allow me to give
a bit more constructive feedback.  I probably won't be able to do so
until the 2nd half of February though.


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