Message ID | 20211126212925.72831-1-msc@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | [v3] powerpc64[le]: Fix CFI and LR save address for asm syscalls [BZ #28532] | expand |
On 11/26/21 3:29 PM, Matheus Castanho wrote: > diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h > index 589f7c8d18..ebc61897aa 100644 > --- a/sysdeps/powerpc/powerpc64/sysdep.h > +++ b/sysdeps/powerpc/powerpc64/sysdep.h > @@ -275,12 +275,14 @@ LT_LABELSUFFIX(name,_name_end): ; \ > /* Allocate frame and save register */ > #define NVOLREG_SAVE \ > stdu r1,-SCV_FRAME_SIZE(r1); \ > + cfi_adjust_cfa_offset(SCV_FRAME_SIZE); \ > std r31,SCV_FRAME_NVOLREG_SAVE(r1); \ > - cfi_adjust_cfa_offset(SCV_FRAME_SIZE); > + cfi_rel_offset(r31,SCV_FRAME_NVOLREG_SAVE); > > /* Restore register and destroy frame */ > #define NVOLREG_RESTORE \ > ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \ > + cfi_restore(r31); \ > addi r1,r1,SCV_FRAME_SIZE; \ > cfi_adjust_cfa_offset(-SCV_FRAME_SIZE); > > @@ -331,13 +333,13 @@ LT_LABELSUFFIX(name,_name_end): ; \ > > #define DO_CALL_SCV \ > mflr r9; \ > - std r9,FRAME_LR_SAVE(r1); \ > + std r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \ > cfi_offset(lr,FRAME_LR_SAVE); \ LGTM. The above line generates correct looking debuginfo. I wonder if it should also be updated to a cfi_rel_offset too (for the consistent readability alongside the store op, as suggested by cfi_rel_offset documentation). > .machine "push"; \ > .machine "power9"; \ > scv 0; \ > .machine "pop"; \ > - ld r9,FRAME_LR_SAVE(r1); \ > + ld r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \ > mtlr r9; \ > cfi_restore(lr); > >
Paul E Murphy <murphyp@linux.ibm.com> writes: > On 11/26/21 3:29 PM, Matheus Castanho wrote: >> diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h >> index 589f7c8d18..ebc61897aa 100644 >> --- a/sysdeps/powerpc/powerpc64/sysdep.h >> +++ b/sysdeps/powerpc/powerpc64/sysdep.h >> @@ -275,12 +275,14 @@ LT_LABELSUFFIX(name,_name_end): ; \ >> /* Allocate frame and save register */ >> #define NVOLREG_SAVE \ >> stdu r1,-SCV_FRAME_SIZE(r1); \ >> + cfi_adjust_cfa_offset(SCV_FRAME_SIZE); \ >> std r31,SCV_FRAME_NVOLREG_SAVE(r1); \ >> - cfi_adjust_cfa_offset(SCV_FRAME_SIZE); >> + cfi_rel_offset(r31,SCV_FRAME_NVOLREG_SAVE); >> /* Restore register and destroy frame */ >> #define NVOLREG_RESTORE \ >> ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \ >> + cfi_restore(r31); \ >> addi r1,r1,SCV_FRAME_SIZE; \ >> cfi_adjust_cfa_offset(-SCV_FRAME_SIZE); >> @@ -331,13 +333,13 @@ LT_LABELSUFFIX(name,_name_end): ; \ >> #define DO_CALL_SCV \ >> mflr r9; \ >> - std r9,FRAME_LR_SAVE(r1); \ >> + std r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \ >> cfi_offset(lr,FRAME_LR_SAVE); \ > > LGTM. The above line generates correct looking debuginfo. I wonder > if it should also be updated to a cfi_rel_offset too (for the consistent > readability alongside the store op, as suggested by cfi_rel_offset > documentation). Ok, changed on v4 [1] [1] https://sourceware.org/pipermail/libc-alpha/2021-November/133510.html -- Matheus Castanho
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index 589f7c8d18..ebc61897aa 100644 --- a/sysdeps/powerpc/powerpc64/sysdep.h +++ b/sysdeps/powerpc/powerpc64/sysdep.h @@ -275,12 +275,14 @@ LT_LABELSUFFIX(name,_name_end): ; \ /* Allocate frame and save register */ #define NVOLREG_SAVE \ stdu r1,-SCV_FRAME_SIZE(r1); \ + cfi_adjust_cfa_offset(SCV_FRAME_SIZE); \ std r31,SCV_FRAME_NVOLREG_SAVE(r1); \ - cfi_adjust_cfa_offset(SCV_FRAME_SIZE); + cfi_rel_offset(r31,SCV_FRAME_NVOLREG_SAVE); /* Restore register and destroy frame */ #define NVOLREG_RESTORE \ ld r31,SCV_FRAME_NVOLREG_SAVE(r1); \ + cfi_restore(r31); \ addi r1,r1,SCV_FRAME_SIZE; \ cfi_adjust_cfa_offset(-SCV_FRAME_SIZE); @@ -331,13 +333,13 @@ LT_LABELSUFFIX(name,_name_end): ; \ #define DO_CALL_SCV \ mflr r9; \ - std r9,FRAME_LR_SAVE(r1); \ + std r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \ cfi_offset(lr,FRAME_LR_SAVE); \ .machine "push"; \ .machine "power9"; \ scv 0; \ .machine "pop"; \ - ld r9,FRAME_LR_SAVE(r1); \ + ld r9,SCV_FRAME_SIZE+FRAME_LR_SAVE(r1); \ mtlr r9; \ cfi_restore(lr);