8ae002
From c86e89a09d187da3aca1ee7ff9bfee4957fe70ff Mon Sep 17 00:00:00 2001
8ae002
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
8ae002
Date: Tue, 28 Jul 2015 15:34:25 -0300
8ae002
Subject: [PATCH] powerpc: Fix strstr/power7 build
8ae002
8ae002
This patch fixes the strstr build with --disable-multi-arch option.
8ae002
The optimization calls the __strstr_ppc symbol, which always build
8ae002
for multiarch config but not if it is disable.  This patch fixes it
8ae002
by adding the default C implementation object with the expected
8ae002
symbol name.
8ae002
8ae002
	* sysdeps/powerpc/powerpc64/power7/Makefile [$(subdir) = string]
8ae002
	(sysdep_routines): Add strstr-ppc64.
8ae002
	* sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c: New file.
8ae002
8ae002
(cherry picked from commit 357bb400f1b25e48e265fd55b5996328d2a8c142)
8ae002
---
8ae002
 ChangeLog                                       |  6 ++++++
8ae002
 sysdeps/powerpc/powerpc64/power7/Makefile       |  1 +
8ae002
 sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c | 27 +++++++++++++++++++++++++
8ae002
 3 files changed, 34 insertions(+)
8ae002
 create mode 100644 sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c
8ae002
8ae002
diff --git a/ChangeLog b/ChangeLog
8ae002
index 8e98192..d70df5c 100644
8ae002
diff --git a/sysdeps/powerpc/powerpc64/power7/Makefile b/sysdeps/powerpc/powerpc64/power7/Makefile
8ae002
index 40aacfa..89a2296 100644
8ae002
--- a/sysdeps/powerpc/powerpc64/power7/Makefile
8ae002
+++ b/sysdeps/powerpc/powerpc64/power7/Makefile
8ae002
@@ -5,6 +5,7 @@ CFLAGS-rtld.c += -mno-vsx
8ae002
 endif
8ae002
 
8ae002
 ifeq ($(subdir),string)
8ae002
+sysdep_routines += strstr-ppc64
8ae002
 CFLAGS-strncase.c += -funroll-loops
8ae002
 CFLAGS-strncase_l.c += -funroll-loops
8ae002
 endif
8ae002
diff --git a/sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c b/sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c
8ae002
new file mode 100644
8ae002
index 0000000..bbab92d
8ae002
--- /dev/null
8ae002
+++ b/sysdeps/powerpc/powerpc64/power7/strstr-ppc64.c
8ae002
@@ -0,0 +1,27 @@
8ae002
+/* Optimized strstr implementation for PowerPC64/POWER7.
8ae002
+   Copyright (C) 2015 Free Software Foundation, Inc.
8ae002
+   This file is part of the GNU C Library.
8ae002
+
8ae002
+   The GNU C Library is free software; you can redistribute it and/or
8ae002
+   modify it under the terms of the GNU Lesser General Public
8ae002
+   License as published by the Free Software Foundation; either
8ae002
+   version 2.1 of the License, or (at your option) any later version.
8ae002
+
8ae002
+   The GNU C Library is distributed in the hope that it will be useful,
8ae002
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
8ae002
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
8ae002
+   Lesser General Public License for more details.
8ae002
+
8ae002
+   You should have received a copy of the GNU Lesser General Public
8ae002
+   License along with the GNU C Library; if not, see
8ae002
+   <http://www.gnu.org/licenses/>.  */
8ae002
+
8ae002
+#include <string.h>
8ae002
+
8ae002
+#define STRSTR __strstr_ppc
8ae002
+#undef libc_hidden_builtin_def
8ae002
+#define libc_hidden_builtin_def(__name)
8ae002
+
8ae002
+extern __typeof (strstr) __strstr_ppc attribute_hidden;
8ae002
+
8ae002
+#include <string/strstr.c>
8ae002
-- 
8ae002
2.1.0
8ae002