mirror of git://sourceware.org/git/glibc.git
PowerPC64 strncpy, stpncpy and strstr fixes
Makes __stpncpy_power8 call __memset_power8 directly rather than via an IFUNC. Fixes a missing _mcount, and removes some redundant NOPS. The *_is_local defines are also used in a followup patch. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Define MEMSET_is_local. * sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise. * sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise. Define MEMSET. * sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define STRLEN_is_local, STRNLEN_is_local, and STRCHR_is_local. * sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise. Don't add nop after local calls. * sysdeps/powerpc/powerpc64/power7/strncpy.S: Define MEMSET_is_local. Don't add nop after local call. * sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise. Add missing CALL_MCOUNT.
This commit is contained in:
parent
4b6e7667db
commit
de7ee73d6f
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
||||||
|
2017-06-14 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* sysdeps/powerpc/powerpc64/multiarch/strncpy-power7.S: Define
|
||||||
|
MEMSET_is_local.
|
||||||
|
* sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S: Likewise.
|
||||||
|
* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power7.S: Likewise.
|
||||||
|
* sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S: Likewise.
|
||||||
|
Define MEMSET.
|
||||||
|
* sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define
|
||||||
|
STRLEN_is_local, STRNLEN_is_local, and STRCHR_is_local.
|
||||||
|
* sysdeps/powerpc/powerpc64/power7/strstr.S: Likewise. Don't add
|
||||||
|
nop after local calls.
|
||||||
|
* sysdeps/powerpc/powerpc64/power7/strncpy.S: Define MEMSET_is_local.
|
||||||
|
Don't add nop after local call.
|
||||||
|
* sysdeps/powerpc/powerpc64/power8/strncpy.S: Likewise. Add missing
|
||||||
|
CALL_MCOUNT.
|
||||||
|
|
||||||
2017-06-14 Alan Modra <amodra@gmail.com>
|
2017-06-14 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
|
* sysdeps/powerpc/powerpc64/sysdep.h: Formatting.
|
||||||
|
|
|
@ -26,5 +26,8 @@
|
||||||
#define libc_hidden_builtin_def(name)
|
#define libc_hidden_builtin_def(name)
|
||||||
|
|
||||||
#define MEMSET __memset_power7
|
#define MEMSET __memset_power7
|
||||||
|
#ifdef SHARED
|
||||||
|
#define MEMSET_is_local
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sysdeps/powerpc/powerpc64/power7/stpncpy.S>
|
#include <sysdeps/powerpc/powerpc64/power7/stpncpy.S>
|
||||||
|
|
|
@ -25,4 +25,9 @@
|
||||||
#undef libc_hidden_builtin_def
|
#undef libc_hidden_builtin_def
|
||||||
#define libc_hidden_builtin_def(name)
|
#define libc_hidden_builtin_def(name)
|
||||||
|
|
||||||
|
#define MEMSET __memset_power8
|
||||||
|
#ifdef SHARED
|
||||||
|
#define MEMSET_is_local
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sysdeps/powerpc/powerpc64/power8/stpncpy.S>
|
#include <sysdeps/powerpc/powerpc64/power8/stpncpy.S>
|
||||||
|
|
|
@ -24,5 +24,8 @@
|
||||||
#define libc_hidden_builtin_def(name)
|
#define libc_hidden_builtin_def(name)
|
||||||
|
|
||||||
#define MEMSET __memset_power7
|
#define MEMSET __memset_power7
|
||||||
|
#ifdef SHARED
|
||||||
|
#define MEMSET_is_local
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sysdeps/powerpc/powerpc64/power7/strncpy.S>
|
#include <sysdeps/powerpc/powerpc64/power7/strncpy.S>
|
||||||
|
|
|
@ -25,5 +25,8 @@
|
||||||
|
|
||||||
/* memset is used to pad the end of the string. */
|
/* memset is used to pad the end of the string. */
|
||||||
#define MEMSET __memset_power8
|
#define MEMSET __memset_power8
|
||||||
|
#ifdef SHARED
|
||||||
|
#define MEMSET_is_local
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sysdeps/powerpc/powerpc64/power8/strncpy.S>
|
#include <sysdeps/powerpc/powerpc64/power8/strncpy.S>
|
||||||
|
|
|
@ -26,5 +26,10 @@
|
||||||
#define STRLEN __strlen_power7
|
#define STRLEN __strlen_power7
|
||||||
#define STRNLEN __strnlen_power7
|
#define STRNLEN __strnlen_power7
|
||||||
#define STRCHR __strchr_power7
|
#define STRCHR __strchr_power7
|
||||||
|
#ifdef SHARED
|
||||||
|
#define STRLEN_is_local
|
||||||
|
#define STRNLEN_is_local
|
||||||
|
#define STRCHR_is_local
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sysdeps/powerpc/powerpc64/power7/strstr.S>
|
#include <sysdeps/powerpc/powerpc64/power7/strstr.S>
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
/* For builds with no IFUNC support, local calls should be made to internal
|
/* For builds with no IFUNC support, local calls should be made to internal
|
||||||
GLIBC symbol (created by libc_hidden_builtin_def). */
|
GLIBC symbol (created by libc_hidden_builtin_def). */
|
||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
|
# define MEMSET_is_local
|
||||||
# define MEMSET __GI_memset
|
# define MEMSET __GI_memset
|
||||||
# else
|
# else
|
||||||
# define MEMSET memset
|
# define MEMSET memset
|
||||||
|
@ -223,7 +224,9 @@ L(zeroFill):
|
||||||
li r4, 0 /* zero fill buffer */
|
li r4, 0 /* zero fill buffer */
|
||||||
mr r5, r8 /* how many bytes to fill buffer with */
|
mr r5, r8 /* how many bytes to fill buffer with */
|
||||||
bl MEMSET /* call optimized memset */
|
bl MEMSET /* call optimized memset */
|
||||||
|
#ifndef MEMSET_is_local
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
|
|
||||||
L(update3return):
|
L(update3return):
|
||||||
#ifdef USE_AS_STPNCPY
|
#ifdef USE_AS_STPNCPY
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
GLIBC symbol (created by libc_hidden_builtin_def). */
|
GLIBC symbol (created by libc_hidden_builtin_def). */
|
||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
# define STRLEN __GI_strlen
|
# define STRLEN __GI_strlen
|
||||||
|
# define STRLEN_is_local
|
||||||
# else
|
# else
|
||||||
# define STRLEN strlen
|
# define STRLEN strlen
|
||||||
# endif
|
# endif
|
||||||
|
@ -44,6 +45,7 @@
|
||||||
GLIBC symbol (created by libc_hidden_builtin_def). */
|
GLIBC symbol (created by libc_hidden_builtin_def). */
|
||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
# define STRNLEN __GI_strnlen
|
# define STRNLEN __GI_strnlen
|
||||||
|
# define STRNLEN_is_local
|
||||||
# else
|
# else
|
||||||
# define STRNLEN __strnlen
|
# define STRNLEN __strnlen
|
||||||
# endif
|
# endif
|
||||||
|
@ -52,6 +54,7 @@
|
||||||
#ifndef STRCHR
|
#ifndef STRCHR
|
||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
# define STRCHR __GI_strchr
|
# define STRCHR __GI_strchr
|
||||||
|
# define STRCHR_is_local
|
||||||
# else
|
# else
|
||||||
# define STRCHR strchr
|
# define STRCHR strchr
|
||||||
# endif
|
# endif
|
||||||
|
@ -86,7 +89,9 @@ EALIGN (STRSTR, 4, 0)
|
||||||
mr r30, r4
|
mr r30, r4
|
||||||
mr r3, r4
|
mr r3, r4
|
||||||
bl STRLEN
|
bl STRLEN
|
||||||
|
#ifndef STRLEN_is_local
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
|
|
||||||
cmpdi cr7, r3, 0 /* If search str is null. */
|
cmpdi cr7, r3, 0 /* If search str is null. */
|
||||||
beq cr7, L(ret_r3)
|
beq cr7, L(ret_r3)
|
||||||
|
@ -95,14 +100,18 @@ EALIGN (STRSTR, 4, 0)
|
||||||
mr r4, r3
|
mr r4, r3
|
||||||
mr r3, r29
|
mr r3, r29
|
||||||
bl STRNLEN
|
bl STRNLEN
|
||||||
|
#ifndef STRNLEN_is_local
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
|
|
||||||
cmpd cr7, r3, r31 /* If len(r3) < len(r4). */
|
cmpd cr7, r3, r31 /* If len(r3) < len(r4). */
|
||||||
blt cr7, L(retnull)
|
blt cr7, L(retnull)
|
||||||
mr r3, r29
|
mr r3, r29
|
||||||
lbz r4, 0(r30)
|
lbz r4, 0(r30)
|
||||||
bl STRCHR
|
bl STRCHR
|
||||||
|
#ifndef STRCHR_is_local
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
|
|
||||||
mr r11, r3
|
mr r11, r3
|
||||||
/* If first char of search str is not present. */
|
/* If first char of search str is not present. */
|
||||||
|
@ -334,7 +343,9 @@ L(begin):
|
||||||
beq cr7, L(default)
|
beq cr7, L(default)
|
||||||
lbz r4, 0(r30)
|
lbz r4, 0(r30)
|
||||||
bl STRCHR
|
bl STRCHR
|
||||||
|
#ifndef STRCHR_is_local
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
/* If first char of search str is not present. */
|
/* If first char of search str is not present. */
|
||||||
cmpdi cr7, r3, 0
|
cmpdi cr7, r3, 0
|
||||||
ble cr7, L(end)
|
ble cr7, L(end)
|
||||||
|
@ -437,7 +448,9 @@ L(nextbyte):
|
||||||
beq cr7, L(default)
|
beq cr7, L(default)
|
||||||
lbz r4, 0(r30)
|
lbz r4, 0(r30)
|
||||||
bl STRCHR
|
bl STRCHR
|
||||||
|
#ifndef STRCHR_is_local
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
/* If first char of search str is not present. */
|
/* If first char of search str is not present. */
|
||||||
cmpdi cr7, r3, 0
|
cmpdi cr7, r3, 0
|
||||||
ble cr7, L(end)
|
ble cr7, L(end)
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
/* For builds without IFUNC support, local calls should be made to internal
|
/* For builds without IFUNC support, local calls should be made to internal
|
||||||
GLIBC symbol (created by libc_hidden_builtin_def). */
|
GLIBC symbol (created by libc_hidden_builtin_def). */
|
||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
|
# define MEMSET_is_local
|
||||||
# define MEMSET __GI_memset
|
# define MEMSET __GI_memset
|
||||||
# else
|
# else
|
||||||
# define MEMSET memset
|
# define MEMSET memset
|
||||||
|
@ -61,6 +62,7 @@
|
||||||
|
|
||||||
.machine power7
|
.machine power7
|
||||||
EALIGN (FUNC_NAME, 4, 0)
|
EALIGN (FUNC_NAME, 4, 0)
|
||||||
|
CALL_MCOUNT 3
|
||||||
|
|
||||||
/* Check if the [src]+15 will cross a 4K page by checking if the bit
|
/* Check if the [src]+15 will cross a 4K page by checking if the bit
|
||||||
indicating the page size changes. Basically:
|
indicating the page size changes. Basically:
|
||||||
|
@ -242,7 +244,9 @@ L(zero_pad_start_1):
|
||||||
cfi_adjust_cfa_offset(FRAMESIZE)
|
cfi_adjust_cfa_offset(FRAMESIZE)
|
||||||
|
|
||||||
bl MEMSET
|
bl MEMSET
|
||||||
|
#ifndef MEMSET_is_local
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Restore the stack frame. */
|
/* Restore the stack frame. */
|
||||||
addi r1,r1,FRAMESIZE
|
addi r1,r1,FRAMESIZE
|
||||||
|
|
Loading…
Reference in New Issue