[PATCH] powerpc/vdso: Fix incorrect CFI in gettimeofday.S

Segher Boessenkool segher at kernel.crashing.org
Thu May 5 00:08:29 AEST 2022


Hi!

On Wed, May 04, 2022 at 10:27:54PM +1000, Michael Ellerman wrote:
> Segher Boessenkool <segher at kernel.crashing.org> writes:
> > Note that r1 is not the same as the CFA: r1 is the stack pointer, while
> > the CFA is a DWARF concept.  Often (but not always) they point to the
> > same thing, for us.  "When we change the stack pointer we should change
> > the DWARF CFA as well"?
>  
> Thanks, I reworded it a bit:
> 
>     DWARF has a concept called the CFA (Canonical Frame Address), which on
>     powerpc is calculated as an offset from the stack pointer (r1). That
>     means when the stack pointer is changed there must be a corresponding
>     CFI directive to update the calculation of the CFA.

The CFA only uses r1 if it does not have a separate frame pointer, in
which case that is used.  "... is usually calculated ..." maybe?  A bit
of handwaving is better than giving the impression you are stating
something exact, if you don't.

> >>   2) If a function changes LR or any non-volatile register, the save
> >>      location for those regs must be given. The cfi can be at any
> >>      instruction after the saves up to the point that the reg is
> >>      changed. (Exception: LR save should be described before a bl.)
> >
> > That isn't an exception?  bl changes the current LR after all :-)
>  
> As Alan mentioned the exception is the the CFI has to appear before the
> bl not after, I noted that in the change log.

You have a bit of freedom where you place your CFI statements, but you
cannot place them too late (or too early).  This is true for all CFI
statements.  I suppose the final consequence of that can be a bit
surprising here :-)


Segher


More information about the Linuxppc-dev mailing list