[m68k] return values

Nathan Sidwell nathan@codesourcery.com
Mon Jun 19 15:28:00 GMT 2006


Mark Kettenis wrote:

> Well, I fear you've managed to confuse yourself.  The current m68k
> default target uses m68k_extract_return_value(), which reads all
> return values from %d0.

you're right.  ok, the whole problem I'm trying to solve is to get the function 
return working for m68k-elf.  That appears to be a mixture of original and svr4 
features.  Namely:

a) returns always go in %d0 (original)
b) small structures can be passed in registers (svr4)
c) structure return values use the struct_return convention (svr4?)

What approach do you think would be best in tackling this?  The way I'd gone at 
it was to treat the m68k-elf as a variant of svr4 (i.e. #a was the exceptional 
behaviour).  It would be possible to organize it as original ABI, but with #b & 
#c as the exceptions.

Do you think the default should be compatible with m68k-elf, or should the user 
explicitly set the abi in that case?

As you may be aware, #b is implemented by GCC in a horrible way that is 
dependent on internal implementation details -- it's not just that the structure 
is 'small' or even 2^n bytes.  I have a patch that emulate's GCC's behaviour, 
and I was going to post that after this patch was resolved.

It certainly is an adventure trying to figure out what's meant to happen :)

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gdb-patches mailing list