Re: C aggregate passing (Rust kernel policy)
From: Willy Tarreau
Date: Sat Feb 22 2025 - 04:12:03 EST
On Sat, Feb 22, 2025 at 08:41:12AM +0000, David Laight wrote:
> On Sat, 22 Feb 2025 07:37:30 +0100
> Willy Tarreau <w@xxxxxx> wrote:
>
> ...
> > Update: I found in my code a comment suggesting that it works when using
> > -freg-struct (which is in fact -freg-struct-return) which works both on
> > i386 and ARM.
>
> The problem is that you need it to be an __attribute__(()) so it can
> be per-function without breaking ABI.
Yes I agree that it would be better.
> > I just didn't remember about this and couldn't find it when
> > looking at gcc docs.
>
> I can never find anything in there either.
> And then I wish they say when it was introduced.
Same here. At least on gcc-2.95 it was already recognized and worked fine:
- without:
fct:
movl 4(%esp),%ecx
movl $5,%eax
movl $100,%edx
movl %eax,(%ecx)
movl %edx,4(%ecx)
movl %ecx,%eax
ret $4
- with:
fct:
movl $5,%eax
movl $100,%edx
ret
Willy