arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone

Blame SOURCES/glibc-rh1385004-17.patch

147e83
From e883cafe35f52b3e511dbaf85052f8dddd395a2e Mon Sep 17 00:00:00 2001
147e83
From: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
147e83
Date: Mon, 30 May 2016 18:00:57 -0300
147e83
Subject: [PATCH] powerpc: Fix --disable-multi-arch build on POWER8
147e83
147e83
Add missing symbols of stpncpy and strcasestr when multi-arch is
147e83
disabled.
147e83
Fix memset call from strncpy/stpncpy when multi-arch is disabled.
147e83
147e83
(cherry picked from commit c24480ce3b5fed848243fc9642932ef2fa670109)
147e83
---
147e83
 ChangeLog                                            | 15 +++++++++++++++
147e83
 sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S |  3 +++
147e83
 sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S |  3 +++
147e83
 sysdeps/powerpc/powerpc64/power8/stpncpy.S           |  4 ++++
147e83
 sysdeps/powerpc/powerpc64/power8/strcasestr.S        |  7 +++++--
147e83
 sysdeps/powerpc/powerpc64/power8/strncpy.S           | 16 ++++++++++++----
147e83
 6 files changed, 42 insertions(+), 6 deletions(-)
147e83
147e83
diff --git a/ChangeLog b/ChangeLog
147e83
index 8d0e296..c01d1a0 100644
147e83
diff --git a/sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S b/sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S
147e83
index d5d835d..d9babb5 100644
147e83
--- a/sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S
147e83
+++ b/sysdeps/powerpc/powerpc64/multiarch/stpncpy-power8.S
147e83
@@ -36,4 +36,7 @@
147e83
   TRACEBACK(__stpncpy_power8)					\
147e83
   END_2(__stpncpy_power8)
147e83
 
147e83
+#undef libc_hidden_builtin_def
147e83
+#define libc_hidden_builtin_def(name)
147e83
+
147e83
 #include <sysdeps/powerpc/powerpc64/power8/stpncpy.S>
147e83
diff --git a/sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S b/sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S
147e83
index ed906a4..f86a0f0 100644
147e83
--- a/sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S
147e83
+++ b/sysdeps/powerpc/powerpc64/multiarch/strncpy-power8.S
147e83
@@ -37,4 +37,7 @@
147e83
 #undef libc_hidden_builtin_def
147e83
 #define libc_hidden_builtin_def(name)
147e83
 
147e83
+/* memset is used to pad the end of the string.  */
147e83
+#define MEMSET __memset_power8
147e83
+
147e83
 #include <sysdeps/powerpc/powerpc64/power8/strncpy.S>
147e83
diff --git a/sysdeps/powerpc/powerpc64/power8/stpncpy.S b/sysdeps/powerpc/powerpc64/power8/stpncpy.S
147e83
index 76a1466..e66bd0a 100644
147e83
--- a/sysdeps/powerpc/powerpc64/power8/stpncpy.S
147e83
+++ b/sysdeps/powerpc/powerpc64/power8/stpncpy.S
147e83
@@ -18,3 +18,7 @@
147e83
 
147e83
 #define USE_AS_STPNCPY
147e83
 #include <sysdeps/powerpc/powerpc64/power8/strncpy.S>
147e83
+
147e83
+weak_alias (__stpncpy, stpncpy)
147e83
+libc_hidden_def (__stpncpy)
147e83
+libc_hidden_builtin_def (stpncpy)
147e83
diff --git a/sysdeps/powerpc/powerpc64/power8/strcasestr.S b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
147e83
index 24b2b76..60015ae 100644
147e83
--- a/sysdeps/powerpc/powerpc64/power8/strcasestr.S
147e83
+++ b/sysdeps/powerpc/powerpc64/power8/strcasestr.S
147e83
@@ -81,7 +81,7 @@
147e83
 /* TODO: change this to .machine power8 when the minimum required binutils
147e83
    allows it.  */
147e83
 	.machine  power7
147e83
-EALIGN (strcasestr, 4, 0)
147e83
+EALIGN (__strcasestr, 4, 0)
147e83
 	CALL_MCOUNT 2
147e83
 	mflr	r0			/* Load link register LR to r0.  */
147e83
 	std	r31, -8(r1)		/* Save callers register r31.  */
147e83
@@ -527,5 +527,8 @@ L(end):
147e83
 	cfi_restore(r31)
147e83
 	mtlr	r0		/* Branch to link register.  */
147e83
 	blr
147e83
-END (strcasestr)
147e83
+END (__strcasestr)
147e83
+
147e83
+weak_alias (__strcasestr, strcasestr)
147e83
+libc_hidden_def (__strcasestr)
147e83
 libc_hidden_builtin_def (strcasestr)
147e83
diff --git a/sysdeps/powerpc/powerpc64/power8/strncpy.S b/sysdeps/powerpc/powerpc64/power8/strncpy.S
147e83
index 80136cc..05c7d8a 100644
147e83
--- a/sysdeps/powerpc/powerpc64/power8/strncpy.S
147e83
+++ b/sysdeps/powerpc/powerpc64/power8/strncpy.S
147e83
@@ -24,6 +24,16 @@
147e83
 # define FUNC_NAME strncpy
147e83
 #endif
147e83
 
147e83
+#ifndef MEMSET
147e83
+/* For builds without IFUNC support, local calls should be made to internal
147e83
+   GLIBC symbol (created by libc_hidden_builtin_def).  */
147e83
+# ifdef SHARED
147e83
+#  define MEMSET   __GI_memset
147e83
+# else
147e83
+#  define MEMSET   memset
147e83
+# endif
147e83
+#endif
147e83
+
147e83
 #define FRAMESIZE (FRAME_MIN_SIZE+48)
147e83
 
147e83
 /* Implements the function
147e83
@@ -187,7 +197,7 @@ L(zero_pad_start_1):
147e83
 	stdu	r1,-FRAMESIZE(r1)
147e83
 	cfi_adjust_cfa_offset(FRAMESIZE)
147e83
 
147e83
-	bl	__memset_power8
147e83
+	bl	MEMSET
147e83
 	nop
147e83
 
147e83
 	/* Restore the stack frame.  */
147e83
@@ -406,8 +416,6 @@ L(zero_pad_start_prepare_1):
147e83
 	b	L(zero_pad_start_1)
147e83
 END (FUNC_NAME)
147e83
 
147e83
-#ifdef USE_AS_STPNCPY
147e83
-libc_hidden_def (__stpncpy)
147e83
-#else
147e83
+#ifndef USE_AS_STPNCPY
147e83
 libc_hidden_builtin_def (strncpy)
147e83
 #endif
147e83
-- 
147e83
2.1.0
147e83