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. -- Vladimir Prus Mentor Graphics +7 (812) 677-68-40