Message ID | 20211124132912.175073-1-msc@linux.ibm.com |
---|---|
State | New |
Headers | show |
Series | [v2] powerpc64[le]: Fix CFI and LR save address for asm syscalls [BZ #28532] | expand |
On Nov 24 2021, Matheus Castanho via Libc-alpha wrote: > diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h > index 589f7c8d18..c751bc76f9 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_offset(r31,-(SCV_FRAME_SIZE-SCV_FRAME_NVOLREG_SAVE)); Perhaps use cfi_rel_offset instead. Andreas.
Andreas Schwab <schwab@linux-m68k.org> writes: > On Nov 24 2021, Matheus Castanho via Libc-alpha wrote: > >> diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h >> index 589f7c8d18..c751bc76f9 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_offset(r31,-(SCV_FRAME_SIZE-SCV_FRAME_NVOLREG_SAVE)); > > Perhaps use cfi_rel_offset instead. Thanks, that's much cleaner. I included that on v3 [1] [1] https://sourceware.org/pipermail/libc-alpha/2021-November/133491.html -- Matheus Castanho
diff --git a/sysdeps/powerpc/powerpc64/sysdep.h b/sysdeps/powerpc/powerpc64/sysdep.h index 589f7c8d18..c751bc76f9 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_offset(r31,-(SCV_FRAME_SIZE-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);