Change in libffi behaviour -- large struct args

Anthony Green green@moxielogic.com
Tue May 31 18:59:03 GMT 2022


On Tue, May 31, 2022 at 11:53 AM DJ Delorie <dj@redhat.com> wrote:
> While this is technically an ABI change, if the "old" ABI never worked,
> I can't see how this would break anything by changing.

I wouldn't even call this an ABI change.   The new implementation will
be ABI compatible.  This is really a bug fix.   In fact, some ports
have always done the right thing.

> I will add that passing structs is likely more complex than you think ;-)

The rules about passing small structs in registers can be complex, but
libffi always did that right.  AFAICT, the only complexity around
passing large structs in memory has to do with structure alignment,
but we have all of the info needed to do that right.

I really think this is worth fixing, even after all of these years.
Users currently need to know the threshold size for structures to pass
in memory vs registers, and this varies per target, and per ABI.
It's an abstraction leak that we can easily fix without causing too
much pain (if any).

AG


More information about the Libffi-discuss mailing list