about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--sysdeps/i386/i586/multiarch/rtld-strlen.S19
-rw-r--r--sysdeps/i386/i586/multiarch/static-strlen.S (renamed from sysdeps/i386/i686/multiarch/strnlen.S)24
-rw-r--r--sysdeps/i386/i586/multiarch/strlen-i386.S4
-rw-r--r--sysdeps/i386/i586/multiarch/strlen-i586.S7
-rw-r--r--sysdeps/i386/i586/multiarch/strlen.c1
-rw-r--r--sysdeps/i386/i686/multiarch/Makefile2
-rw-r--r--sysdeps/i386/i686/multiarch/strlen.S60
-rw-r--r--sysdeps/i386/i686/multiarch/strnlen-c.c10
-rw-r--r--sysdeps/i386/multiarch/Makefile2
-rw-r--r--sysdeps/i386/multiarch/ifunc-impl-list.c9
-rw-r--r--sysdeps/i386/multiarch/rtld-strlen.S19
-rw-r--r--sysdeps/i386/multiarch/rtld-strnlen.c (renamed from sysdeps/i386/i686/multiarch/rtld-strnlen.c)0
-rw-r--r--sysdeps/i386/multiarch/static-strlen.S21
-rw-r--r--sysdeps/i386/multiarch/strlen-i386.S7
-rw-r--r--sysdeps/i386/multiarch/strlen-i586.S6
-rw-r--r--sysdeps/i386/multiarch/strlen-sse2-bsf.S (renamed from sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S)0
-rw-r--r--sysdeps/i386/multiarch/strlen.c58
-rw-r--r--sysdeps/i386/multiarch/strnlen-i386.c10
-rw-r--r--sysdeps/i386/multiarch/strnlen-sse2.S (renamed from sysdeps/i386/i686/multiarch/strnlen-sse2.S)0
-rw-r--r--sysdeps/i386/multiarch/strnlen.c50
20 files changed, 211 insertions, 98 deletions
diff --git a/sysdeps/i386/i586/multiarch/rtld-strlen.S b/sysdeps/i386/i586/multiarch/rtld-strlen.S
new file mode 100644
index 0000000000..70fc5f3b01
--- /dev/null
+++ b/sysdeps/i386/i586/multiarch/rtld-strlen.S
@@ -0,0 +1,19 @@
+/* strlen for ld.so
+   Copyright (C) 2015 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 <sysdeps/i386/i586/strlen.S>
diff --git a/sysdeps/i386/i686/multiarch/strnlen.S b/sysdeps/i386/i586/multiarch/static-strlen.S
index baf21fc205..96befd4a3a 100644
--- a/sysdeps/i386/i686/multiarch/strnlen.S
+++ b/sysdeps/i386/i586/multiarch/static-strlen.S
@@ -1,7 +1,5 @@
-/* Multiple versions of strnlen
-   All versions must be listed in ifunc-impl-list.c.
-   Copyright (C) 2011-2015 Free Software Foundation, Inc.
-   Contributed by Intel Corporation.
+/* strlen for libc.a
+   Copyright (C) 2015 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
@@ -18,20 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <sysdep.h>
-#include <init-arch.h>
-
-#if IS_IN (libc)
-	.text
-ENTRY(__strnlen)
-	.type	__strnlen, @gnu_indirect_function
-	LOAD_GOT_AND_RTLD_GLOBAL_RO
-	LOAD_FUNC_GOT_EAX (__strnlen_ia32)
-	HAS_CPU_FEATURE (SSE2)
-	jz	2f
-	LOAD_FUNC_GOT_EAX (__strnlen_sse2)
-2:	ret
-END(__strnlen)
-
-weak_alias(__strnlen, strnlen)
+#if !defined SHARED && IS_IN (libc)
+# include <sysdeps/i386/i586/strlen.S>
 #endif
diff --git a/sysdeps/i386/i586/multiarch/strlen-i386.S b/sysdeps/i386/i586/multiarch/strlen-i386.S
new file mode 100644
index 0000000000..216bbf5e82
--- /dev/null
+++ b/sysdeps/i386/i586/multiarch/strlen-i386.S
@@ -0,0 +1,4 @@
+#define strlen __strlen_i386
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name)
+#include <sysdeps/i386/strlen.S>
diff --git a/sysdeps/i386/i586/multiarch/strlen-i586.S b/sysdeps/i386/i586/multiarch/strlen-i586.S
new file mode 100644
index 0000000000..69c3170292
--- /dev/null
+++ b/sysdeps/i386/i586/multiarch/strlen-i586.S
@@ -0,0 +1,7 @@
+#include <sysdeps/i386/multiarch/strlen-i586.S>
+
+#ifdef SHARED
+	.globl __GI_strlen
+	.hidden __GI_strlen
+	__GI_strlen = __strlen_i586
+#endif
diff --git a/sysdeps/i386/i586/multiarch/strlen.c b/sysdeps/i386/i586/multiarch/strlen.c
new file mode 100644
index 0000000000..fb40868acb
--- /dev/null
+++ b/sysdeps/i386/i586/multiarch/strlen.c
@@ -0,0 +1 @@
+#include <sysdeps/i386/multiarch/strlen.c>
diff --git a/sysdeps/i386/i686/multiarch/Makefile b/sysdeps/i386/i686/multiarch/Makefile
index 2733c2a880..77f01df193 100644
--- a/sysdeps/i386/i686/multiarch/Makefile
+++ b/sysdeps/i386/i686/multiarch/Makefile
@@ -1,6 +1,4 @@
 ifeq ($(subdir),string)
-sysdep_routines += strlen-sse2 strlen-sse2-bsf \
-		   strnlen-sse2 strnlen-c
 ifeq (yes,$(config-cflags-sse4))
 sysdep_routines += strspn-c
 CFLAGS-strspn-c.c += -msse4
diff --git a/sysdeps/i386/i686/multiarch/strlen.S b/sysdeps/i386/i686/multiarch/strlen.S
deleted file mode 100644
index 613559ca01..0000000000
--- a/sysdeps/i386/i686/multiarch/strlen.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Multiple versions of strlen
-   All versions must be listed in ifunc-impl-list.c.
-   Copyright (C) 2009-2015 Free Software Foundation, Inc.
-   Contributed by Intel Corporation.
-   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 <init-arch.h>
-
-/* Define multiple versions only for the definition in libc and for the
-   DSO.  In static binaries, we need strlen before the initialization
-   happened.  */
-#if defined SHARED && IS_IN (libc)
-	.text
-ENTRY(strlen)
-	.type	strlen, @gnu_indirect_function
-	LOAD_GOT_AND_RTLD_GLOBAL_RO
-	LOAD_FUNC_GOT_EAX (__strlen_ia32)
-	HAS_CPU_FEATURE (SSE2)
-	jz	2f
-	LOAD_FUNC_GOT_EAX (__strlen_sse2_bsf)
-	HAS_ARCH_FEATURE (Slow_BSF)
-	jz	2f
-	LOAD_FUNC_GOT_EAX (__strlen_sse2)
-2:	ret
-END(strlen)
-
-# undef ENTRY
-# define ENTRY(name) \
-	.type __strlen_ia32, @function; \
-	.globl __strlen_ia32; \
-	.p2align 4; \
-	__strlen_ia32: cfi_startproc; \
-	CALL_MCOUNT
-# undef END
-# define END(name) \
-	cfi_endproc; .size __strlen_ia32, .-__strlen_ia32
-# undef libc_hidden_builtin_def
-/* IFUNC doesn't work with the hidden functions in shared library since
-   they will be called without setting up EBX needed for PLT which is
-   used by IFUNC.  */
-# define libc_hidden_builtin_def(name) \
-	.globl __GI_strlen; __GI_strlen = __strlen_ia32
-#endif
-
-#include "../../i586/strlen.S"
diff --git a/sysdeps/i386/i686/multiarch/strnlen-c.c b/sysdeps/i386/i686/multiarch/strnlen-c.c
deleted file mode 100644
index 351e939a93..0000000000
--- a/sysdeps/i386/i686/multiarch/strnlen-c.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#define STRNLEN  __strnlen_ia32
-#ifdef SHARED
-# undef libc_hidden_def
-# define libc_hidden_def(name)  \
-    __hidden_ver1 (__strnlen_ia32, __GI_strnlen, __strnlen_ia32); \
-    strong_alias (__strnlen_ia32, __strnlen_ia32_1); \
-    __hidden_ver1 (__strnlen_ia32_1, __GI___strnlen, __strnlen_ia32_1);
-#endif
-
-#include "string/strnlen.c"
diff --git a/sysdeps/i386/multiarch/Makefile b/sysdeps/i386/multiarch/Makefile
index a4161b0f33..5e636edfa5 100644
--- a/sysdeps/i386/multiarch/Makefile
+++ b/sysdeps/i386/multiarch/Makefile
@@ -36,6 +36,8 @@ sysdep_routines += bcopy-i386 bcopy-i686 bcopy-sse2-unaligned \
 		   strncat-i386 strncat-sse2 strncat-ssse3 \
 		   strchr-i386 strchr-i586 strchr-sse2-bsf strchr-sse2 \
 		   strcspn-i386 strpbrk-i386 \
+		   strlen-i386 strlen-i586 strlen-sse2 strlen-sse2-bsf \
+		   strnlen-sse2 strnlen-i386 static-strlen \
 		   strrchr-i386 strrchr-sse2-bsf strrchr-sse2
 ifeq (yes,$(config-cflags-sse4))
 sysdep_routines += varshift strcspn-sse4 strpbrk-sse4
diff --git a/sysdeps/i386/multiarch/ifunc-impl-list.c b/sysdeps/i386/multiarch/ifunc-impl-list.c
index f3bea9c9a5..a53c49f280 100644
--- a/sysdeps/i386/multiarch/ifunc-impl-list.c
+++ b/sysdeps/i386/multiarch/ifunc-impl-list.c
@@ -290,13 +290,11 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 			      __strncpy_sse2)
 	      IFUNC_IMPL_ADD (array, i, strncpy, 1, __strncpy_i386))
 
-#if 0
   /* Support sysdeps/i386/i686/multiarch/strnlen.S.  */
   IFUNC_IMPL (i, name, strnlen,
 	      IFUNC_IMPL_ADD (array, i, strnlen, HAS_CPU_FEATURE (SSE2),
 			      __strnlen_sse2)
-	      IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_ia32))
-#endif
+	      IFUNC_IMPL_ADD (array, i, strnlen, 1, __strnlen_i386))
 
   /* Support sysdeps/i386/i686/multiarch/strpbrk.S.  */
   IFUNC_IMPL (i, name, strpbrk,
@@ -431,15 +429,14 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
 # endif
 	      )
 
-#if 0
   /* Support sysdeps/i386/i686/multiarch/strlen.S.  */
   IFUNC_IMPL (i, name, strlen,
 	      IFUNC_IMPL_ADD (array, i, strlen, HAS_CPU_FEATURE (SSE2),
 			      __strlen_sse2_bsf)
 	      IFUNC_IMPL_ADD (array, i, strlen, HAS_CPU_FEATURE (SSE2),
 			      __strlen_sse2)
-	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_ia32))
-#endif
+	      IFUNC_IMPL_ADD (array, i, strlen, HAS_I586, __strlen_i586)
+	      IFUNC_IMPL_ADD (array, i, strlen, 1, __strlen_i386))
 
   /* Support sysdeps/i386/i686/multiarch/strncmp.S.  */
   IFUNC_IMPL (i, name, strncmp,
diff --git a/sysdeps/i386/multiarch/rtld-strlen.S b/sysdeps/i386/multiarch/rtld-strlen.S
new file mode 100644
index 0000000000..9ee1dbc35a
--- /dev/null
+++ b/sysdeps/i386/multiarch/rtld-strlen.S
@@ -0,0 +1,19 @@
+/* strlen for ld.so
+   Copyright (C) 2015 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 <sysdeps/i386/strlen.S>
diff --git a/sysdeps/i386/i686/multiarch/rtld-strnlen.c b/sysdeps/i386/multiarch/rtld-strnlen.c
index 1aa5440644..1aa5440644 100644
--- a/sysdeps/i386/i686/multiarch/rtld-strnlen.c
+++ b/sysdeps/i386/multiarch/rtld-strnlen.c
diff --git a/sysdeps/i386/multiarch/static-strlen.S b/sysdeps/i386/multiarch/static-strlen.S
new file mode 100644
index 0000000000..f4318e1423
--- /dev/null
+++ b/sysdeps/i386/multiarch/static-strlen.S
@@ -0,0 +1,21 @@
+/* strlen for libc.a
+   Copyright (C) 2015 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/>.  */
+
+#if !defined SHARED && IS_IN (libc)
+# include <sysdeps/i386/strlen.S>
+#endif
diff --git a/sysdeps/i386/multiarch/strlen-i386.S b/sysdeps/i386/multiarch/strlen-i386.S
new file mode 100644
index 0000000000..15dbe7d354
--- /dev/null
+++ b/sysdeps/i386/multiarch/strlen-i386.S
@@ -0,0 +1,7 @@
+#include <sysdeps/i386/i586/multiarch/strlen-i386.S>
+
+#ifdef SHARED
+	.globl __GI_strlen
+	.hidden __GI_strlen
+	__GI_strlen = __strlen_i386
+#endif
diff --git a/sysdeps/i386/multiarch/strlen-i586.S b/sysdeps/i386/multiarch/strlen-i586.S
new file mode 100644
index 0000000000..2f5349074e
--- /dev/null
+++ b/sysdeps/i386/multiarch/strlen-i586.S
@@ -0,0 +1,6 @@
+#define strlen __strlen_i586
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name)
+#undef weak_alias
+#define weak_alias(name, aliasname)
+#include <sysdeps/i386/i586/strlen.S>
diff --git a/sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S b/sysdeps/i386/multiarch/strlen-sse2-bsf.S
index 668a2a65fc..668a2a65fc 100644
--- a/sysdeps/i386/i686/multiarch/strlen-sse2-bsf.S
+++ b/sysdeps/i386/multiarch/strlen-sse2-bsf.S
diff --git a/sysdeps/i386/multiarch/strlen.c b/sysdeps/i386/multiarch/strlen.c
new file mode 100644
index 0000000000..9e376a3cc3
--- /dev/null
+++ b/sysdeps/i386/multiarch/strlen.c
@@ -0,0 +1,58 @@
+/* Multiple versions of strlen.
+   All versions must be listed in ifunc-impl-list.c.
+   Copyright (C) 2015 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/>.  */
+
+/* Define multiple versions only for the definition in libc.  */
+#if defined SHARED && IS_IN (libc)
+/* Redefine strlen so that the compiler won't complain about the type
+   mismatch with the IFUNC selector in strong_alias, below.  */
+# undef strlen
+# define strlen __redirect_strlen
+# include <string.h>
+# undef strlen
+
+# include <init-arch.h>
+
+extern __typeof (__redirect_strlen) __strlen_i386 attribute_hidden;
+extern __typeof (__redirect_strlen) __strlen_i586 attribute_hidden;
+extern __typeof (__redirect_strlen) __strlen_sse2 attribute_hidden;
+extern __typeof (__redirect_strlen) __strlen_sse2_bsf attribute_hidden;
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+   ifunc symbol properly.  */
+extern __typeof (__redirect_strlen) strlen;
+extern void *strlen_ifunc (void) __asm__ ("strlen");
+
+void *
+strlen_ifunc (void)
+{
+  if (HAS_CPU_FEATURE (SSE2))
+    {
+      if (HAS_ARCH_FEATURE (Slow_BSF))
+	return __strlen_sse2;
+      else
+	return __strlen_sse2_bsf;
+    }
+
+  if (USE_I586)
+    return __strlen_i586;
+  else
+    return __strlen_i386;
+}
+__asm__ (".type strlen, %gnu_indirect_function");
+#endif
diff --git a/sysdeps/i386/multiarch/strnlen-i386.c b/sysdeps/i386/multiarch/strnlen-i386.c
new file mode 100644
index 0000000000..dd4dbda896
--- /dev/null
+++ b/sysdeps/i386/multiarch/strnlen-i386.c
@@ -0,0 +1,10 @@
+#define STRNLEN  __strnlen_i386
+#ifdef SHARED
+# undef libc_hidden_def
+# define libc_hidden_def(name)  \
+    __hidden_ver1 (__strnlen_i386, __GI_strnlen, __strnlen_i386); \
+    strong_alias (__strnlen_i386, __strnlen_i386_1); \
+    __hidden_ver1 (__strnlen_i386_1, __GI___strnlen, __strnlen_i386_1);
+#endif
+
+#include "string/strnlen.c"
diff --git a/sysdeps/i386/i686/multiarch/strnlen-sse2.S b/sysdeps/i386/multiarch/strnlen-sse2.S
index 56b6ae2a5c..56b6ae2a5c 100644
--- a/sysdeps/i386/i686/multiarch/strnlen-sse2.S
+++ b/sysdeps/i386/multiarch/strnlen-sse2.S
diff --git a/sysdeps/i386/multiarch/strnlen.c b/sysdeps/i386/multiarch/strnlen.c
new file mode 100644
index 0000000000..3e97c9e0e6
--- /dev/null
+++ b/sysdeps/i386/multiarch/strnlen.c
@@ -0,0 +1,50 @@
+/* Multiple versions of strnlen.
+   All versions must be listed in ifunc-impl-list.c.
+   Copyright (C) 2015 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/>.  */
+
+/* Define multiple versions only for the definition in libc.  */
+#if IS_IN (libc)
+/* Redefine strnlen so that the compiler won't complain about the type
+   mismatch with the IFUNC selector in strong_alias, below.  */
+# undef strnlen
+# define strnlen __redirect_strnlen
+# include <string.h>
+# undef strnlen
+
+# include <init-arch.h>
+
+extern __typeof (__redirect_strnlen) __strnlen_i386 attribute_hidden;
+extern __typeof (__redirect_strnlen) __strnlen_sse2 attribute_hidden;
+
+/* Avoid DWARF definition DIE on ifunc symbol so that GDB can handle
+   ifunc symbol properly.  */
+extern __typeof (__redirect_strnlen) __strnlen;
+extern void *strnlen_ifunc (void) __asm__ ("__strnlen");
+
+void *
+strnlen_ifunc (void)
+{
+  if (HAS_CPU_FEATURE (SSE2))
+    return __strnlen_sse2;
+
+  return __strnlen_i386;
+}
+__asm__ (".type __strnlen, %gnu_indirect_function");
+
+weak_alias (__strnlen, strnlen)
+#endif