Accessing non-existing varargs argument

Florian Weimer fweimer@redhat.com
Mon Dec 15 11:44:00 GMT 2014


On 12/15/2014 12:39 PM, Richard Earnshaw wrote:
> On 12/12/14 23:50, Florian Weimer wrote:
>> On 12/12/2014 08:02 PM, Jeff Law wrote:
>>
>>> It'd probably work for the specific cases Florian wants to tackle, but
>>> I'd consider it highly non-portable.
>>
>> I agree, that's why I asked for something “GCC-portable”.
>>
>
> Don't go this way.  Seriously, you can't assume that a future platform
> ABI won't break if you do.  ABI's at this level really aren't controlled
> by GCC, which just has to conform to whatever the platform ABI requires.
>   We were very close in AArch64 to defining the ABI for variadics to push
> all variadic (from the ... onwards) arguments onto the stack - it leads
> to a very simple ABI from an implementation viewpoint and eliminates
> much of the grotty code around reconstructing the parameter list.

This would still work except in a very pathological corner case which 
cannot happen with glibc (the stack cannot be empty when the open 
function is called because all user code runs with a non-empty stack).

Did you shy away from the simple implementation because of too many 
interop failures?

-- 
Florian Weimer / Red Hat Product Security



More information about the Gcc-help mailing list