Clarify parameter save area requirements for variadic function calls
#77
Closed
opened 7 years ago by wschmidt-ibm
·
4 comments
Loading…
Reference in New Issue
There is no content yet.
Delete Branch '%!s(<nil>)'
Deleting a branch is permanent. It CANNOT be undone. Continue?
From the syssw-elfv2abi mailing list, Tulio Magno Machado writes:
Hi Florian,
Florian Weimer fweimer@redhat.com writes:
I'm Cc'ing Bill Schmidt and the syssw-elfv2abi mailing list [1].
That part has been elaborated previously in section 2.2.2.3 Optional Save
Areas, under "Parameter Save Area" [2]:
The Parameter Save Area shall be allocated by the caller for function
calls unless a prototype is provided for the callee indicating that all
parameters can be passed in registers. (This requires a Parameter Save
Area to be created for functions where the number and type of parameters
exceeds the registers available for parameter passing in registers, for
those functions where the prototype contains an ellipsis to indicate a
variadic function, and functions declared without a prototype.)
Do you think it clarifies what allocates the Parameter Save Area?
Maybe it's possible to reference the previous text from here?
I agree it's ambiguous with the previous text for prototyped functions with
variadic arguments that says:
Under these circumstances, a minimum of 8 doublewords are always reserved.
References:
[1] http://lists.mailinglist.openpowerfoundation.org/mailman/listinfo/syssw-elfv2abi
[2] http://openpowerfoundation.org/wp-content/uploads/resources/leabi/content/dbdoclet.50655240_15141.html
--
Tulio Magno
Florian Weimer responds:
On 10/10/2017 03:48 PM, Tulio Magno Quites Machado Filho wrote:
Thanks.
“unless a prototype […] indicating all parameters can be passed in registers” is still ambiguous because it could still be a decision for individual call sites.
The parenthetical remark is the place which comes closest to saying that a variadic functions are always called with a parameter save area. I think the ABI should say so explicitly, not just as an side remark.
Sure, if it's clarified a bit.
Thanks,
Florian
This language should be clarified in the next release of the ABI document.
Bill Schmidt notifications@github.com wrote on 10.10.2017 18:06:07:
This text in 2.2.4 seems both redundant and outdated. Possibly it's
best to just remove it? Section 2.2.2.3 has the details of when to
create the parameter save area already.
If we do need to keep it, the wording "when a function has unnamed
parameters" should be clarified to "when the function prototype contains
an ellipsis to indicate a variadic function".
Bye,
Ulrich
Bill Schmidt notifications@github.com wrote on 10.10.2017 18:08:29:
But it can be. If you have a non-variadic function, and one place
calls it with a correct prototype in scope, and another place calls
it without a prototype in scope, then the first caller will not
allocate the parameter save area, while the second will. This is
OK because the definition must then be non-varadic, and therefore
cannot assume the presence of the save area.
Basically, it is supported to call any function (variadic or not)
either without any prototype in scope, or with a correct prototype
in scope. It is not supported (and will not work) to call a function
with a wrong prototype in scope.
Bye,
Ulrich