This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch tuliom-multilib created. glibc-2.17-376-ge93007f
- From: azanella at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 29 Mar 2013 19:09:32 -0000
- Subject: GNU C Library master sources branch tuliom-multilib created. glibc-2.17-376-ge93007f
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, tuliom-multilib has been created
at e93007f5c45a474bcd32213a61f2627d1be0499e (commit)
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e93007f5c45a474bcd32213a61f2627d1be0499e
commit e93007f5c45a474bcd32213a61f2627d1be0499e
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Fri Mar 29 13:46:30 2013 -0500
PowerPC: memchr ifunc for PPC32
diff --git a/string/memchr.c b/string/memchr.c
index 2427c4b..2d53f6b 100644
--- a/string/memchr.c
+++ b/string/memchr.c
@@ -50,6 +50,9 @@
#undef memchr
#undef __memchr
+#ifdef MEMCHR
+# define __memchr MEMCHR
+#endif
/* Search no more than N bytes of S for C. */
__ptr_t
@@ -198,6 +201,8 @@ __memchr (s, c_in, n)
return 0;
}
#ifdef weak_alias
+# ifndef MEMCHR
weak_alias (__memchr, memchr)
+# endif
#endif
libc_hidden_builtin_def (memchr)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile
index c7c0d8c..63ef4a6 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile
@@ -5,5 +5,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
strncmp-power7 strncmp-power4 strlen-power7 \
strcasecmp-power7 strcasecmp_l-power7 \
strnlen-power7 strnlen-c \
- mempcpy-power7 mempcpy-c
+ mempcpy-power7 mempcpy-c \
+ memchr-power7 memchr-c
endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
index c295caf..49bdb50 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -89,6 +89,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
IFUNC_IMPL_ADD (array, i, mempcpy, 1,
__mempcpy_ppc32))
+ IFUNC_IMPL (i, name, memchr,
+ IFUNC_IMPL_ADD (array, i, memchr,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __memchr_power7)
+ IFUNC_IMPL_ADD (array, i, memchr, 1,
+ __memchr_ppc32))
+
IFUNC_IMPL (i, name, strlen,
IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX,
__strlen_power7)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/memchr-c.c b/sysdeps/powerpc/powerpc32/multiarch/memchr-c.c
new file mode 100644
index 0000000..1468f18
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/memchr-c.c
@@ -0,0 +1,8 @@
+#define MEMCHR __memchr_ppc32
+#ifdef SHARED
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__memchr_ppc32, __GI_memchr, __memchr_ppc32);
+#endif
+
+#include "string/memchr.c"
diff --git a/sysdeps/powerpc/powerpc32/power7/memchr.S b/sysdeps/powerpc/powerpc32/multiarch/memchr-power7.S
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power7/memchr.S
rename to sysdeps/powerpc/powerpc32/multiarch/memchr-power7.S
index 369e5e0..b7aa903 100644
--- a/sysdeps/powerpc/powerpc32/power7/memchr.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memchr-power7.S
@@ -21,7 +21,7 @@
/* int [r3] memchr (char *s [r3], int byte [r4], int size [r5]) */
.machine power7
-ENTRY (__memchr)
+ENTRY (__memchr_power7)
CALL_MCOUNT
dcbt 0,r3
clrrwi r8,r3,2
@@ -200,6 +200,4 @@ L(loop_small): /* loop_small has been unrolled. */
li r3,0
blr
-END (__memchr)
-weak_alias (__memchr, memchr)
-libc_hidden_builtin_def (memchr)
+END (__memchr_power7)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/memchr.c b/sysdeps/powerpc/powerpc32/multiarch/memchr.c
new file mode 100644
index 0000000..49c8d05
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/memchr.c
@@ -0,0 +1,38 @@
+/* Multiple versions of memchr.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef NOT_IN_libc
+# include <string.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+extern __typeof (__memchr) __memchr_ppc32 attribute_hidden;
+extern __typeof (__memchr) __memchr_power7 attribute_hidden;
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+libc_ifunc (__memchr,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __memchr_power7
+ : __memchr_ppc32);
+
+weak_alias (__memchr, memchr)
+libc_hidden_builtin_def (memchr)
+#else
+#include "string/memchr.c"
+#endif
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=2af9437fca10fe0e5bd17929b85bd9d0824c0619
commit 2af9437fca10fe0e5bd17929b85bd9d0824c0619
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Fri Mar 29 13:45:34 2013 -0500
Add #undef mempcpy
diff --git a/string/mempcpy.c b/string/mempcpy.c
index 92a1137..0e756b2 100644
--- a/string/mempcpy.c
+++ b/string/mempcpy.c
@@ -22,6 +22,7 @@
#include <string.h>
#undef __mempcpy
+#undef mempcpy
#ifdef MEMPCPY
# define __mempcpy MEMPCPY
#endif
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=6c46b8fb4683ffdb45b121d4e2ea641dd8a97158
commit 6c46b8fb4683ffdb45b121d4e2ea641dd8a97158
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Fri Mar 29 09:41:33 2013 -0500
PowerPC: mempcpy ifunc for PPC32
diff --git a/string/mempcpy.c b/string/mempcpy.c
index c0d2448..92a1137 100644
--- a/string/mempcpy.c
+++ b/string/mempcpy.c
@@ -21,14 +21,18 @@
#include <string.h>
-#undef mempcpy
#undef __mempcpy
+#ifdef MEMPCPY
+# define __mempcpy MEMPCPY
+#endif
void *
__mempcpy (void *dest, const void *src, size_t len)
{
return memcpy (dest, src, len) + len;
}
-libc_hidden_def (__mempcpy)
+#ifndef MEMPCPY
weak_alias (__mempcpy, mempcpy)
+libc_hidden_def (__mempcpy)
+#endif
libc_hidden_builtin_def (mempcpy)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile
index e5981f4..c7c0d8c 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile
@@ -4,5 +4,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
bzero-power4 bzero-power6 bzero-power7 \
strncmp-power7 strncmp-power4 strlen-power7 \
strcasecmp-power7 strcasecmp_l-power7 \
- strnlen-power7 strnlen-c
+ strnlen-power7 strnlen-c \
+ mempcpy-power7 mempcpy-c
endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
index 7975c00..c295caf 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -82,6 +82,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
__memcpy_cell)
IFUNC_IMPL_ADD (array, i, memcpy, 1, __memcpy_ppc32))
+ IFUNC_IMPL (i, name, mempcpy,
+ IFUNC_IMPL_ADD (array, i, mempcpy,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __mempcpy_power7)
+ IFUNC_IMPL_ADD (array, i, mempcpy, 1,
+ __mempcpy_ppc32))
+
IFUNC_IMPL (i, name, strlen,
IFUNC_IMPL_ADD (array, i, strlen, hwcap & PPC_FEATURE_HAS_VSX,
__strlen_power7)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/mempcpy-c.c b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-c.c
new file mode 100644
index 0000000..0ca7a0e
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-c.c
@@ -0,0 +1,8 @@
+#define MEMPCPY __mempcpy_ppc32
+#ifdef SHARED
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__mempcpy_ppc32, __GI_mempcpy, __mempcpy_ppc32);
+#endif
+
+#include "string/mempcpy.c"
diff --git a/sysdeps/powerpc/powerpc32/power7/mempcpy.S b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-power7.S
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power7/mempcpy.S
rename to sysdeps/powerpc/powerpc32/multiarch/mempcpy-power7.S
index 5ad4edb..0cc37ae 100644
--- a/sysdeps/powerpc/powerpc32/power7/mempcpy.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/mempcpy-power7.S
@@ -23,7 +23,7 @@
Returns 'dst' + 'len'. */
.machine power7
-EALIGN (__mempcpy, 5, 0)
+EALIGN (__mempcpy_power7, 5, 0)
CALL_MCOUNT
stwu 1,-32(1)
@@ -462,7 +462,4 @@ L(end_unaligned_loop):
addi 1,1,32
blr
-END (__mempcpy)
-libc_hidden_def (__mempcpy)
-weak_alias (__mempcpy, mempcpy)
-libc_hidden_builtin_def (mempcpy)
+END (__mempcpy_power7)
diff --git a/string/mempcpy.c b/sysdeps/powerpc/powerpc32/multiarch/mempcpy.c
similarity index 57%
copy from string/mempcpy.c
copy to sysdeps/powerpc/powerpc32/multiarch/mempcpy.c
index c0d2448..d2a3a8b 100644
--- a/string/mempcpy.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/mempcpy.c
@@ -1,9 +1,6 @@
-/* Copy memory to memory until the specified number of bytes
- has been copied, return pointer to following byte.
- Overlap is NOT handled correctly.
- Copyright (C) 1991-2013 Free Software Foundation, Inc.
+/* Multiple versions of mempcpy.
+ Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Torbjorn Granlund (tege@sics.se).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,16 +16,21 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#include <string.h>
+#ifndef NOT_IN_libc
+# include <string.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
-#undef mempcpy
-#undef __mempcpy
+extern __typeof (__mempcpy) __mempcpy_ppc32 attribute_hidden;
+extern __typeof (__mempcpy) __mempcpy_power7 attribute_hidden;
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+libc_ifunc (__mempcpy,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __mempcpy_power7
+ : __mempcpy_ppc32);
-void *
-__mempcpy (void *dest, const void *src, size_t len)
-{
- return memcpy (dest, src, len) + len;
-}
-libc_hidden_def (__mempcpy)
weak_alias (__mempcpy, mempcpy)
-libc_hidden_builtin_def (mempcpy)
+libc_hidden_def (mempcpy)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/rtld-memcpy.c b/sysdeps/powerpc/powerpc32/multiarch/rtld-memcpy.c
new file mode 100644
index 0000000..b1b0647
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/rtld-memcpy.c
@@ -0,0 +1,2 @@
+#include <string/memcpy.c>
+#include <string/mempcpy.c>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=4a39ed05f9036246a32a2faddbb42b28c303bc91
commit 4a39ed05f9036246a32a2faddbb42b28c303bc91
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Fri Mar 29 09:30:47 2013 -0500
PowerPC32: Check _rtld_global_ro access value
diff --git a/sysdeps/powerpc/powerpc32/multiarch/memcpy.S b/sysdeps/powerpc/powerpc32/multiarch/memcpy.S
index 7547520..794d2fb 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/memcpy.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/memcpy.S
@@ -34,6 +34,8 @@ ENTRY(memcpy)
lwz r6,_rtld_global_ro@got(r5)
mtlr r11
cfi_same_value (lr)
+ cmpdi r6,0
+ beq L(ppc32)
lwz r6,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r6)
# else
lis r6,(_dl_hwcap+4)@ha
@@ -48,6 +50,7 @@ ENTRY(memcpy)
bne- L(power6)
andis. r7,r6,(PPC_FEATURE_CELL_BE >> 16)
bne- L(powerCELL)
+L(ppc32):
# ifdef PIC
lwz r3,__memcpy_ppc32@got(r5)
# else
@@ -103,10 +106,6 @@ END(memcpy)
cfi_endproc; \
ASM_SIZE_DIRECTIVE(__memcpy_ppc32)
-# undef libc_hidden_builtin_def
-# define libc_hidden_builtin_def(name) \
- .globl __GI_memcpy; __GI_memcpy = __memcpy_ppc32
-
#endif
#include "../memcpy.S"
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=254d12ecfcaff6f3240447269c5c4da7a7798a0a
commit 254d12ecfcaff6f3240447269c5c4da7a7798a0a
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Mar 28 16:28:56 2013 -0500
PowerPC: strnlen ifunc using C
diff --git a/sysdeps/powerpc/powerpc32/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h
index 17f8708..a1b20eb 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/init-arch.h
+++ b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h
@@ -17,5 +17,20 @@
#include <ldsodefs.h>
+/* The code checks if _rtld_global_ro was realocated before trying to access
+ the dl_hwcap field. The assembly is to make the compiler not optimize the
+ test (&_rtld_global_ro != NULL), which is always true in ISO C (but not
+ in that case since _rtld_global_ro might not been realocated yet.). */
+#if defined(SHARED) && !defined(IS_IN_rtld)
+# define __GLRO(value) \
+ ({ volatile void **__p = (volatile void**)(&_rtld_global_ro); \
+ unsigned long int __ret; \
+ asm ("# x in %0" : "+r" (__p)); \
+ __ret = (__p) ? GLRO(value) : 0; \
+ __ret; })
+#else
+# define __GLRO(value) GLRO(value)
+#endif
+
# define INIT_ARCH() \
- unsigned long int hwcap = GLRO(dl_hwcap);
+ unsigned long int hwcap = __GLRO(dl_hwcap);
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strnlen.S b/sysdeps/powerpc/powerpc32/multiarch/strnlen.S
deleted file mode 100644
index 1b3f46e..0000000
--- a/sysdeps/powerpc/powerpc32/multiarch/strnlen.S
+++ /dev/null
@@ -1,70 +0,0 @@
-/* Copyright (C) 2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <rtld-global-offsets.h>
-
-/* Define multiple versions only for the definition in libc. */
-#ifndef NOT_IN_libc
- .text
-ENTRY(__strnlen)
- .type __strnlen, @gnu_indirect_function
-# ifdef PIC
- mflr r6
- cfi_register (lr,r6)
- SETUP_GOT_ACCESS (r5,got_label)
- addis r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@ha
- addi r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@l
- mtlr r6
- cfi_same_value (lr)
-# ifdef SHARED
- lwz r6,_rtld_global_ro@got(r5)
- /* If _rtld_global_ro is not initialized use the default ppc32
- implementation. */
- cmplwi r6,0
- beq L(ppc32)
- lwz r6,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r6)
-# else
- lwz r6,_dl_hwcap@got(r5)
- lwz r6,4(r6)
-# endif
-# else /* PIC */
- lis r6,(_dl_hwcap+4)@ha
- lwz r6,(_dl_hwcap+4)@l(r6)
-# endif
- andi. r7,r6,PPC_FEATURE_HAS_VSX
- bne L(power7)
-L(ppc32):
-# ifdef PIC
- lwz r3,__strnlen_ppc32@got(r5)
-# else
- lis r3,__strnlen_ppc32@ha
- lwz r3,__strnlen_ppc32@l(r3)
-# endif
- blr
-L(power7):
-# ifdef PIC
- lwz r3,__strnlen_power7@got(r5)
-# else
- lis r3,__strnlen_power7@ha
- lwz r3,__strnlen_power7@l(r3)
-# endif
- blr
-END(__strnlen)
-
-weak_alias (__strnlen, strnlen)
-#endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strnlen.c b/sysdeps/powerpc/powerpc32/multiarch/strnlen.c
new file mode 100644
index 0000000..0fb9460
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strnlen.c
@@ -0,0 +1,36 @@
+/* Multiple versions of strnlen.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef NOT_IN_libc
+# include <string.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+extern __typeof (__strnlen) __strnlen_ppc32 attribute_hidden;
+extern __typeof (__strnlen) __strnlen_power7 attribute_hidden;
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+libc_ifunc (__strnlen,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strnlen_power7
+ : __strnlen_ppc32);
+
+weak_alias (__strnlen, strnlen);
+libc_hidden_def (strnlen)
+#endif
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=1ef83476d0aacae4ee0d2fd07aca2868cb1cdbcb
commit 1ef83476d0aacae4ee0d2fd07aca2868cb1cdbcb
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Mar 28 14:09:03 2013 -0500
PowerPC: strnlen ifunc for PPC32
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile
index 22deb17..e5981f4 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile
@@ -3,5 +3,6 @@ sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
memcmp-power7 memset-power4 memset-power6 memset-power7 \
bzero-power4 bzero-power6 bzero-power7 \
strncmp-power7 strncmp-power4 strlen-power7 \
- strcasecmp-power7 strcasecmp_l-power7
+ strcasecmp-power7 strcasecmp_l-power7 \
+ strnlen-power7 strnlen-c
endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
index 7ca97ac..7975c00 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -106,6 +106,13 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
__strcasecmp_l_power7)
IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
__strcasecmp_l_ppc32))
+
+ IFUNC_IMPL (i, name, strnlen,
+ IFUNC_IMPL_ADD (array, i, strnlen,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __strnlen_power7)
+ IFUNC_IMPL_ADD (array, i, strnlen, 1,
+ __strnlen_ppc32))
#endif
return i;
diff --git a/sysdeps/powerpc/powerpc32/multiarch/rtld-strnlen.c b/sysdeps/powerpc/powerpc32/multiarch/rtld-strnlen.c
new file mode 100644
index 0000000..1aa5440
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/rtld-strnlen.c
@@ -0,0 +1 @@
+#include <string/strnlen.c>
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strnlen-c.c b/sysdeps/powerpc/powerpc32/multiarch/strnlen-c.c
new file mode 100644
index 0000000..cc27cc1
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strnlen-c.c
@@ -0,0 +1,8 @@
+#define STRNLEN __strnlen_ppc32
+#ifdef SHARED
+# undef libc_hidden_def
+# define libc_hidden_def(name) \
+ __hidden_ver1 (__strnlen_ppc32, __GI_strnlen, __strnlen_ppc32);
+#endif
+
+#include "string/strnlen.c"
diff --git a/sysdeps/powerpc/powerpc32/power7/strnlen.S b/sysdeps/powerpc/powerpc32/multiarch/strnlen-power7.S
similarity index 97%
rename from sysdeps/powerpc/powerpc32/power7/strnlen.S
rename to sysdeps/powerpc/powerpc32/multiarch/strnlen-power7.S
index ed08836..63ac821 100644
--- a/sysdeps/powerpc/powerpc32/power7/strnlen.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/strnlen-power7.S
@@ -21,7 +21,7 @@
/* int [r3] strnlen (char *s [r3], int size [r4]) */
.machine power7
-ENTRY (__strnlen)
+ENTRY (__strnlen_power7)
CALL_MCOUNT
dcbt 0,r3
clrrwi r8,r3,2 /* Align the address to word boundary. */
@@ -164,6 +164,4 @@ L(loop_small):
cmplw r9,r7
bge L(end_max)
b L(loop_small)
-END (__strnlen)
-weak_alias (__strnlen, strnlen)
-libc_hidden_builtin_def (strnlen)
+END (__strnlen_power7)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strnlen.S b/sysdeps/powerpc/powerpc32/multiarch/strnlen.S
new file mode 100644
index 0000000..1b3f46e
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strnlen.S
@@ -0,0 +1,70 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <rtld-global-offsets.h>
+
+/* Define multiple versions only for the definition in libc. */
+#ifndef NOT_IN_libc
+ .text
+ENTRY(__strnlen)
+ .type __strnlen, @gnu_indirect_function
+# ifdef PIC
+ mflr r6
+ cfi_register (lr,r6)
+ SETUP_GOT_ACCESS (r5,got_label)
+ addis r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@ha
+ addi r5,r5,_GLOBAL_OFFSET_TABLE_-got_label@l
+ mtlr r6
+ cfi_same_value (lr)
+# ifdef SHARED
+ lwz r6,_rtld_global_ro@got(r5)
+ /* If _rtld_global_ro is not initialized use the default ppc32
+ implementation. */
+ cmplwi r6,0
+ beq L(ppc32)
+ lwz r6,RTLD_GLOBAL_RO_DL_HWCAP_OFFSET+4(r6)
+# else
+ lwz r6,_dl_hwcap@got(r5)
+ lwz r6,4(r6)
+# endif
+# else /* PIC */
+ lis r6,(_dl_hwcap+4)@ha
+ lwz r6,(_dl_hwcap+4)@l(r6)
+# endif
+ andi. r7,r6,PPC_FEATURE_HAS_VSX
+ bne L(power7)
+L(ppc32):
+# ifdef PIC
+ lwz r3,__strnlen_ppc32@got(r5)
+# else
+ lis r3,__strnlen_ppc32@ha
+ lwz r3,__strnlen_ppc32@l(r3)
+# endif
+ blr
+L(power7):
+# ifdef PIC
+ lwz r3,__strnlen_power7@got(r5)
+# else
+ lis r3,__strnlen_power7@ha
+ lwz r3,__strnlen_power7@l(r3)
+# endif
+ blr
+END(__strnlen)
+
+weak_alias (__strnlen, strnlen)
+#endif
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=e0c97f55c67248270dcb3ff404800ff526cf56de
commit e0c97f55c67248270dcb3ff404800ff526cf56de
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Thu Mar 28 08:08:42 2013 -0500
Fix comments for strcasecmp.c
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c
index 1885ce9..b932f51 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c
@@ -23,8 +23,6 @@
__hidden_ver1 (__strcasecmp_ppc32, __GI_strcasecmp, __strcasecmp_ppc32);
# endif
-/* Redefine memmove so that the compiler won't complain about the type
- mismatch with the IFUNC selector in strong_alias, below. */
# undef strcasecmp
# define strcasecmp __redirect_strcasecmp
# include <string.h>
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9b5b34a1d57b68f93d26b3f5f2ce84d9b77131fd
commit 9b5b34a1d57b68f93d26b3f5f2ce84d9b77131fd
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Tue Mar 26 12:31:15 2013 -0500
PowerPC: strcasecmp ifunc implementation for PPC32
diff --git a/sysdeps/powerpc/powerpc32/multiarch/Makefile b/sysdeps/powerpc/powerpc32/multiarch/Makefile
index 4d935fe..22deb17 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/Makefile
+++ b/sysdeps/powerpc/powerpc32/multiarch/Makefile
@@ -2,5 +2,6 @@ ifeq ($(subdir),string)
sysdep_routines += memcpy-power7 memcpy-a2 memcpy-power6 memcpy-cell \
memcmp-power7 memset-power4 memset-power6 memset-power7 \
bzero-power4 bzero-power6 bzero-power7 \
- strncmp-power7 strncmp-power4 strlen-power7
+ strncmp-power7 strncmp-power4 strlen-power7 \
+ strcasecmp-power7 strcasecmp_l-power7
endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
index 3714676..7ca97ac 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -93,6 +93,19 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_POWER4,
__strncmp_power4)
IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ppc32))
+
+ IFUNC_IMPL (i, name, strcasecmp,
+ IFUNC_IMPL_ADD (array, i, strcasecmp,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __strcasecmp_power7)
+ IFUNC_IMPL_ADD (array, i, strcasecmp, 1, __strcasecmp_ppc32))
+
+ IFUNC_IMPL (i, name, strcasecmp_l,
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __strcasecmp_l_power7)
+ IFUNC_IMPL_ADD (array, i, strcasecmp_l, 1,
+ __strcasecmp_l_ppc32))
#endif
return i;
diff --git a/sysdeps/powerpc/powerpc32/multiarch/init-arch.h b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h
new file mode 100644
index 0000000..17f8708
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/init-arch.h
@@ -0,0 +1,21 @@
+/* This file is part of the GNU C Library.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <ldsodefs.h>
+
+# define INIT_ARCH() \
+ unsigned long int hwcap = GLRO(dl_hwcap);
diff --git a/sysdeps/powerpc/powerpc32/power7/strcasecmp.S b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S
similarity index 98%
rename from sysdeps/powerpc/powerpc32/power7/strcasecmp.S
rename to sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S
index 7f0046c..5f48271 100644
--- a/sysdeps/powerpc/powerpc32/power7/strcasecmp.S
+++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp-power7.S
@@ -27,8 +27,8 @@
__locale_t loc [r5]) */
#ifndef STRCMP
-# define __STRCMP __strcasecmp
-# define STRCMP strcasecmp
+# define __STRCMP __strcasecmp_power7
+# define STRCMP strcasecmp_power7
#endif
ENTRY (__STRCMP)
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c
new file mode 100644
index 0000000..1885ce9
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp.c
@@ -0,0 +1,54 @@
+/* Multiple versions of strcasecmp.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef NOT_IN_libc
+# ifdef SHARED
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__strcasecmp_ppc32, __GI_strcasecmp, __strcasecmp_ppc32);
+# endif
+
+/* Redefine memmove so that the compiler won't complain about the type
+ mismatch with the IFUNC selector in strong_alias, below. */
+# undef strcasecmp
+# define strcasecmp __redirect_strcasecmp
+# include <string.h>
+# undef strcasecmp
+# define strcasecmp __strcasecmp_ppc32
+
+extern __typeof (__redirect_strcasecmp) __strcasecmp_ppc32 attribute_hidden;
+extern __typeof (__redirect_strcasecmp) __strcasecmp_power7 attribute_hidden;
+#endif
+
+#include "string/strcasecmp.c"
+#undef strcasecmp
+
+#ifndef NOT_IN_libc
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+extern __typeof (__redirect_strcasecmp) __libc_strcasecmp;
+libc_ifunc (__libc_strcasecmp,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcasecmp_power7
+ : __strcasecmp_ppc32);
+
+weak_alias (__libc_strcasecmp, strcasecmp)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S
new file mode 100644
index 0000000..d07d4b8
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l-power7.S
@@ -0,0 +1,5 @@
+#define USE_IN_EXTENDED_LOCALE_MODEL
+#define STRCMP strcasecmp_l_power7
+#define __STRCMP __strcasecmp_l_power7
+
+#include "strcasecmp-power7.S"
diff --git a/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c
new file mode 100644
index 0000000..71e37cf
--- /dev/null
+++ b/sysdeps/powerpc/powerpc32/multiarch/strcasecmp_l.c
@@ -0,0 +1,54 @@
+/* Multiple versions of strcasecmp.
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef NOT_IN_libc
+# ifdef SHARED
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__strcasecmp_l_ppc32, __GI_strcasecmp_l, __strcasecmp_l_ppc32);
+# endif
+
+/* Redefine memmove so that the compiler won't complain about the type
+ mismatch with the IFUNC selector in strong_alias, below. */
+# undef strcasecmp_l
+# define strcasecmp_l __redirect_strcasecmp_l
+# include <string.h>
+# undef strcasecmp_l
+# define strcasecmp_l __strcasecmp_l_ppc32
+
+extern __typeof (__redirect_strcasecmp_l) __strcasecmp_l_ppc32 attribute_hidden;
+extern __typeof (__redirect_strcasecmp_l) __strcasecmp_l_power7 attribute_hidden;
+#endif
+
+#include "string/strcasecmp_l.c"
+#undef strcasecmp_l
+
+#ifndef NOT_IN_libc
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+ ifunc symbol properly. */
+extern __typeof (__redirect_strcasecmp_l) __libc_strcasecmp_l;
+libc_ifunc (__libc_strcasecmp_l,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcasecmp_l_power7
+ : __strcasecmp_l_ppc32);
+
+weak_alias (__libc_strcasecmp_l, strcasecmp_l)
+#endif
diff --git a/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S b/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S
deleted file mode 100644
index c13c4eb..0000000
--- a/sysdeps/powerpc/powerpc32/power7/strcasecmp_l.S
+++ /dev/null
@@ -1,5 +0,0 @@
-#define USE_IN_EXTENDED_LOCALE_MODEL
-#define STRCMP strcasecmp_l
-#define __STRCMP __strcasecmp_l
-
-#include "strcasecmp.S"
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8aa649dd3cfe67bf59c2aedf8df2e9b6ed484c42
commit 8aa649dd3cfe67bf59c2aedf8df2e9b6ed484c42
Author: Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Date: Tue Mar 26 09:26:15 2013 -0500
Fixes and refactor for powerpc32/ifunc-impl-list
diff --git a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
index aae8d99..3714676 100644
--- a/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
+++ b/sysdeps/powerpc/powerpc32/multiarch/ifunc-impl-list.c
@@ -25,11 +25,6 @@
/* Maximum number of IFUNC implementations. */
#define MAX_IFUNC 5
-/* Some of the . */
-#define PPC_POWER4 (PPC_FEATURE_POWER4|PPC_FEATURE_ARCH_2_05| \
- PPC_FEATURE_ARCH_2_06)
-#define PPC_POWER6 (PPC_FEATURE_ARCH_2_05|PPC_FEATURE_ARCH_2_06)
-
size_t
__libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
size_t max)
@@ -38,25 +33,34 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
size_t i = 0;
- uint32_t hwcap;
-
- hwcap = GLRO(dl_hwcap);
+ unsigned long int hwcap = GLRO(dl_hwcap);
+ /* hwcap contains only the latest supported ISA, the code checks which is
+ and fill the previous supported ones. */
+ if (hwcap & PPC_FEATURE_ARCH_2_06)
+ hwcap |= PPC_FEATURE_ARCH_2_05 | PPC_FEATURE_POWER5_PLUS |
+ PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
+ else if (hwcap & PPC_FEATURE_ARCH_2_05)
+ hwcap |= PPC_FEATURE_POWER5_PLUS | PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
+ else if (hwcap & PPC_FEATURE_POWER5_PLUS)
+ hwcap |= PPC_FEATURE_POWER5 | PPC_FEATURE_POWER4;
+ else if (hwcap & PPC_FEATURE_POWER5)
+ hwcap |= PPC_FEATURE_POWER4;
IFUNC_IMPL (i, name, bzero,
IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_HAS_VSX,
__bzero_power7)
- IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_POWER6,
+ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_ARCH_2_05,
__bzero_power6)
- IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_POWER4,
+ IFUNC_IMPL_ADD (array, i, bzero, hwcap & PPC_FEATURE_POWER4,
__bzero_power4)
IFUNC_IMPL_ADD (array, i, bzero, 1, __bzero_ppc32))
IFUNC_IMPL (i, name, memset,
IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_HAS_VSX,
__memset_power7)
- IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_POWER6,
+ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_ARCH_2_05,
__memset_power6)
- IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_POWER4,
+ IFUNC_IMPL_ADD (array, i, memset, hwcap & PPC_FEATURE_POWER4,
__memset_power4)
IFUNC_IMPL_ADD (array, i, memset, 1, __memset_ppc32))
@@ -71,7 +75,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
__memcpy_power7)
IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_06,
__memcpy_a2)
- IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_POWER6,
+ IFUNC_IMPL_ADD (array, i, memcpy, hwcap & PPC_FEATURE_ARCH_2_05,
__memcpy_power6)
IFUNC_IMPL_ADD (array, i, memcpy,
hwcap & (PPC_FEATURE_CELL_BE >> 16),
@@ -86,7 +90,7 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
IFUNC_IMPL (i, name, strncmp,
IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_HAS_VSX,
__strncmp_power7)
- IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_POWER4,
+ IFUNC_IMPL_ADD (array, i, strncmp, hwcap & PPC_FEATURE_POWER4,
__strncmp_power4)
IFUNC_IMPL_ADD (array, i, strncmp, 1, __strncmp_ppc32))
#endif
-----------------------------------------------------------------------
hooks/post-receive
--
GNU C Library master sources