Help with an ABI peculiarity
Florian Weimer
fweimer@redhat.com
Mon Jan 10 13:46:40 GMT 2022
* Iain Sandoe:
> In the case that a call is built and no prototype is available, the
> assumption is that all parms are named. The promotion is then done
> according to the C promotion rules.
>
> [for the number of args that can be passed in int regs] the callee
> will happen to observe the same rules in this case.
>
> It will, however, break once we overflow the number of int regs.. :/
Exactly.
> The case that is fundamentally broken from scratch is of a variadic function
> called without a prototype - since the aarch64-darwin ABI places unnamed
> parms differently.
That part is true for powerpc64le as well, due to the caller-provided
saved parameter area which only exists with variadic calls. This
already happens in very simple cases, like the POSIX open function. The
corruption is quite difficult to diagnose, too. 8-( But it's also
quite rare to see such bugs.
> Given we have 8 int regs available, probably many calls will work ..
Oh, I didn't know that so many registers were available. Maybe that's
enough to paper over the lack of ABI compatibility for now. Presumably
you could count the number of arguments and emit a warning at least?
C++ metaprogramming involving many parameters tends to use variadic
templates of non-variadic functions, so that shouldn't be a problem.
Thanks,
Florian
More information about the Gcc
mailing list