atgreen/libffi — pull request #34 by davidsch (2013-03-27 12:26:53+00:00)
Title: Fix ARM hard-float support for large numbers of VFP arguments

This PR fixes the support for the hard-float calling convention on ARM and refactors some common pieces of code to helper functions.

The included testcase (many_double.c) demonstrates the issue of calling a function that takes more VFP arguments than the number that can be passed using VFP registers.

The issue happens when calling a function that takes more arguments than can fit in the VFP registers, having to copy the remaining arguments to the stack. The previous implementation assumes that whatever is in the first 4 words on the stack goes into the core registers as arguments. In the case that the function takes less than 4 words of non-VFP arguments this can cause VFP arguments passed on the stack to be moved to core registers, leading to argument corruption in the called function.

The PR has been test on ARM hard- and soft-float systems:
* raspberry pi ARMv6l hard-float (Raspbian based on Debian GNU/Linux 7.0)
* BeagleBoard xM ARMv7l soft-float (Ubuntu 12.04.2)