[RFA] Fix float argument passing in inferior function calls for ppc64

Thiago Jung Bauermann bauerman@br.ibm.com
Tue Jan 15 12:34:00 GMT 2008


Hi,

The 64-bit PowerPC ELF ABI version 1.9 says that "single precision
floating point values are mapped to the second word in a single
doubleword". The ppc64_sysv_abi_push_dummy_call function in
ppc-sysv-tdep.c, however, implements version 1.7 of the ABI which says
that they should go in the first doubleword.

Because of this, if you are calling a function with many arguments and
some need to be passed on the stack, GDB will get it wrong for 32-bit
floats. This is why in Linux/ppc64 GDB fails the "Call function with
many float arguments" test posted here:

http://sourceware.org/ml/gdb-patches/2008-01/msg00291.html

This patch fixes the test. It makes GDB pass 32-bit floats in the second
word when passing them in the stack as stated in the current ABI.

I didn't touch the code which writes the float to a general register in
the first word because I'm not sure how to test it. It is probably
related to soft-float, I guess.

Tested on Linux/ppc64 with no regressions. I believe this will also fix
other operating systems supported by GDB on ppc64 since they use the
same push_dummy_call implementation (assuming they also follow the
current SysV ABI), but I don't have the means to test them either.

Maybe someone could test the patch and the testcase in *BSD? Luis' patch
which has the testcases would also need this testing.
-- 
[]'s
Thiago Jung Bauermann
Software Engineer
IBM Linux Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ppc64-abi-float-fix.diff
Type: text/x-patch
Size: 8324 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20080115/ca9a5c33/attachment.bin>


More information about the Gdb-patches mailing list