aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/powerpc/powerpc64/power7/strncpy.S23
2 files changed, 19 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 5d45da1d8c..444b63981f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-10-23 Alan Modra <amodra@gmail.com>
+
+ * sysdeps/powerpc/powerpc64/power7/strncpy.S: Decrease FRAMESIZE.
+ Move LR save and frame setup/teardown and LR restore to
+ immediately around memset call. Provide cfi.
+
2017-10-22 H.J. Lu <hongjiu.lu@intel.com>
* sysdeps/i386/fpu/e_powf.S: Removed.
diff --git a/sysdeps/powerpc/powerpc64/power7/strncpy.S b/sysdeps/powerpc/powerpc64/power7/strncpy.S
index b2833b8a50..0ae65a0fc5 100644
--- a/sysdeps/powerpc/powerpc64/power7/strncpy.S
+++ b/sysdeps/powerpc/powerpc64/power7/strncpy.S
@@ -53,7 +53,7 @@
# endif
#endif /* !USE_AS_STPNCPY */
-#define FRAMESIZE (FRAME_MIN_SIZE+32)
+#define FRAMESIZE (FRAME_MIN_SIZE+16)
#ifndef MEMSET
/* For builds with no IFUNC support, local calls should be made to internal
@@ -74,14 +74,13 @@ ENTRY (FUNC_NAME, 4)
#endif
CALL_MCOUNT 3
- mflr r0 /* load link register LR to r0 */
or r10, r3, r4 /* to verify source and destination */
rldicl. r8, r10, 0, 61 /* is double word aligned .. ? */
std r19, -8(r1) /* save callers register , r19 */
std r18, -16(r1) /* save callers register , r18 */
- std r0, 16(r1) /* store the link register */
- stdu r1, -FRAMESIZE(r1) /* create the stack frame */
+ cfi_offset(r19, -8)
+ cfi_offset(r18, -16)
mr r9, r3 /* save r3 into r9 for use */
mr r18, r3 /* save r3 for retCode of strncpy */
@@ -224,6 +223,11 @@ L(zeroFill):
cmpdi cr7, r8, 0 /* compare if length is zero */
beq cr7, L(update3return)
+ mflr r0 /* load link register LR to r0 */
+ std r0, 16(r1) /* store the link register */
+ stdu r1, -FRAMESIZE(r1) /* create the stack frame */
+ cfi_adjust_cfa_offset(FRAMESIZE)
+ cfi_offset(lr, 16)
mr r3, r19 /* fill buffer with */
li r4, 0 /* zero fill buffer */
mr r5, r8 /* how many bytes to fill buffer with */
@@ -231,6 +235,11 @@ L(zeroFill):
#ifndef MEMSET_is_local
nop
#endif
+ ld r0, FRAMESIZE+16(r1) /* read the saved link register */
+ addi r1, r1, FRAMESIZE /* restore stack pointer */
+ cfi_adjust_cfa_offset(-FRAMESIZE)
+ mtlr r0
+ cfi_restore(lr)
L(update3return):
#ifdef USE_AS_STPNCPY
@@ -241,11 +250,8 @@ L(hop2return):
#ifndef USE_AS_STPNCPY
mr r3, r18 /* set return value */
#endif
- addi r1, r1, FRAMESIZE /* restore stack pointer */
- ld r0, 16(r1) /* read the saved link register */
ld r18, -16(r1) /* restore callers save register, r18 */
ld r19, -8(r1) /* restore callers save register, r19 */
- mtlr r0 /* branch to link register */
blr /* return */
.p2align 4
@@ -279,16 +285,13 @@ L(oneBYone):
.p2align 4
L(done):
- addi r1, r1, FRAMESIZE /* restore stack pointer */
#ifdef USE_AS_STPNCPY
mr r3, r19 /* set the return value */
#else
mr r3, r18 /* set the return value */
#endif
- ld r0, 16(r1) /* read the saved link register */
ld r18, -16(r1) /* restore callers save register, r18 */
ld r19, -8(r1) /* restore callers save register, r19 */
- mtlr r0 /* branch to link register */
blr /* return */
L(update1):