On 1/13/25 1:08 PM, Keith Packard wrote:

In doing picolibc testing for lm32, I discovered that varargs handling
had an issue when the set of anonymous arguments spanned register
arguments and stack arguments.

On lm32, FIRST_PARM_OFFSET is '4', meaning there are four bytes
between the stack top and the first non-register parameter. When a
varargs function runs, the anonymous parameters in registers get
pushed to the stack below this gap. To process the args, this gap
needs to be skipped at the right time.

This series converts va_list into a struct to add a pointer to the gap
and code is added to va_arg to see when an argument spans the gap.

While developing this series, I identified a few other related issues
which affected this change by comparing the lm32 code to arc, which
has a similar implementation for saving the register parameters. Those
changes are first in the series with the gap skipping code provided in
the final patch.
Just a couple notes.

lm32 is currently scheduled to be deprecated as it hasn't been converted to use LRA instead of reload. Deprecation would happen with the gcc-15 release and removal in gcc-16 if nobody steps forward to do the conversion.

The last real change to the lm32 port that wasn't stuff like copyright dates, or other system-wide adjustments was back in 2018, a trivial fix from me. Prior to that 2014. Point being I think it's unlikely anyone will step forward to fix this port.

Second, we're in regression bugfixing mode only right now. Essentially all changes should be fixing regressions against prior releases. But given the nature of this change and its narrow potential impact in terms of getting the release made, I'll go ahead and push it through.

Thanks,
jeff



Reply via email to