[5/9] powerpc: refactor strcasestr and strstr IFUNC.

Message ID 3630a4d5b3ec5ad199f5733ad60ac15788d3de4f.1491252969.git.wainersm@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wainer dos Santos Moschetta April 3, 2017, 9:19 p.m.
2017-04-03  Wainer dos Santos Moschetta  <wainersm@linux.vnet.ibm.com>

	* sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S: Define the
	strcasestr implementation name and remove unneeded macros definition.
	* sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S: Define
	strstr implementation name and remove unneeded macros definition.
	* sysdeps/powerpc/powerpc64/power7/strstr.S: Set a default function
	name if not defined and pass as parameter to macros accordingly.
	* sysdeps/powerpc/powerpc64/power8/strcasestr.S: Likewise.
---
 sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S | 16 +---------------
 sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S     | 16 +---------------
 sysdeps/powerpc/powerpc64/power7/strstr.S               |  8 ++++++--
 sysdeps/powerpc/powerpc64/power8/strcasestr.S           |  8 ++++++--
 4 files changed, 14 insertions(+), 34 deletions(-)

Patch

diff --git a/sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S b/sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S
index 5a0eb9c..2cfb5ae 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strcasestr-power8.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__strcasestr_power8)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__strcasestr_power8):				\
-  cfi_startproc;						\
-  LOCALENTRY(__strcasestr_power8)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strcasestr_power8)				\
-  END_2(__strcasestr_power8)
+#define STRCASESTR __strcasestr_power8
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S b/sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S
index 5ac7b85..3991df7 100644
--- a/sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S
+++ b/sysdeps/powerpc/powerpc64/multiarch/strstr-power7.S
@@ -18,21 +18,7 @@ 
 
 #include <sysdep.h>
 
-#undef EALIGN
-#define EALIGN(name, alignt, words)				\
-  .section ".text";						\
-  ENTRY_2(__strstr_power7)					\
-  .align ALIGNARG(alignt);					\
-  EALIGN_W_##words;						\
-  BODY_LABEL(__strstr_power7):					\
-  cfi_startproc;						\
-  LOCALENTRY(__strstr_power7)
-
-#undef END
-#define END(name)						\
-  cfi_endproc;							\
-  TRACEBACK(__strstr_power7)					\
-  END_2(__strstr_power7)
+#define STRSTR __strstr_power7
 
 #undef libc_hidden_builtin_def
 #define libc_hidden_builtin_def(name)
diff --git a/sysdeps/powerpc/powerpc64/power7/strstr.S b/sysdeps/powerpc/powerpc64/power7/strstr.S
index 2a79b8b..260db2e 100644
--- a/sysdeps/powerpc/powerpc64/power7/strstr.S
+++ b/sysdeps/powerpc/powerpc64/power7/strstr.S
@@ -25,6 +25,10 @@ 
 
 #define ITERATIONS	64
 
+#ifndef STRSTR
+# define STRSTR strstr
+#endif
+
 #ifndef STRLEN
 /* For builds with no IFUNC support, local calls should be made to internal
    GLIBC symbol (created by libc_hidden_builtin_def).  */
@@ -55,7 +59,7 @@ 
 
 #define	FRAMESIZE	(FRAME_MIN_SIZE+32)
 	.machine  power7
-EALIGN (strstr, 4, 0)
+EALIGN (STRSTR, 4, 0)
 	CALL_MCOUNT 2
 	mflr	r0			/* Load link register LR to r0.  */
 	std	r31, -8(r1)		/* Save callers register r31.  */
@@ -513,5 +517,5 @@  L(end):
 	ld	r31, -8(r1)	/* Restore callers save register r31.  */
 	mtlr	r0		/* Branch to link register.  */
 	blr
-END (strstr)
+END (STRSTR)
 libc_hidden_builtin_def (strstr)
diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
index 86f1672..6ac6572 100644
--- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S
+++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
@@ -27,6 +27,10 @@ 
    fallback to default.  */
 #define ITERATIONS	64
 
+#ifndef STRCASESTR
+# define STRCASESTR __strcasestr
+#endif
+
 #ifndef STRLEN
 /* For builds without IFUNC support, local calls should be made to internal
    GLIBC symbol (created by libc_hidden_builtin_def).  */
@@ -81,7 +85,7 @@ 
 /* TODO: change this to .machine power8 when the minimum required binutils
    allows it.  */
 	.machine  power7
-EALIGN (__strcasestr, 4, 0)
+EALIGN (STRCASESTR, 4, 0)
 	CALL_MCOUNT 2
 	mflr	r0			/* Load link register LR to r0.  */
 	std	r31, -8(r1)		/* Save callers register r31.  */
@@ -527,7 +531,7 @@  L(end):
 	cfi_restore(r31)
 	mtlr	r0		/* Branch to link register.  */
 	blr
-END (__strcasestr)
+END (STRCASESTR)
 
 weak_alias (__strcasestr, strcasestr)
 libc_hidden_def (__strcasestr)