@@ -1,6 +1,7 @@
/* Some compiler optimizations may transform loops into memset/memmove
calls and without proper declaration it may generate PLT calls. */
-#if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED
+#if !defined __ASSEMBLER__ && IS_IN (libc) && defined SHARED && \
+ !defined __x86_64__
asm ("memmove = __GI_memmove");
asm ("memset = __GI_memset");
asm ("memcpy = __GI_memcpy");
@@ -32,9 +32,6 @@
# define RETVAL (-8)
# if defined SHARED && !defined USE_MULTIARCH && IS_IN (libc)
# define memcpy __memcpy
-# undef libc_hidden_builtin_def
-# define libc_hidden_builtin_def(name) \
- .globl __GI_memcpy; __GI_memcpy = __memcpy
# endif
#endif
#define SAVE0 (RETVAL - 8)
@@ -57,14 +57,6 @@ END(memcmp)
# define END(name) \
cfi_endproc; .size __memcmp_sse2, .-__memcmp_sse2
-# ifdef SHARED
-# 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_memcmp; __GI_memcmp = __memcmp_sse2
-# endif
#endif
#include "../memcmp.S"
@@ -70,14 +70,14 @@ END(__new_memcpy)
# define END_CHK(name) \
cfi_endproc; .size __memcpy_chk_sse2, .-__memcpy_chk_sse2
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal memcpy calls through a PLT.
- The speedup we get from using SSSE3 instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_builtin_def(name) \
- .globl __GI_memcpy; __GI_memcpy = __memcpy_sse2
versioned_symbol (libc, __new_memcpy, memcpy, GLIBC_2_14);
+libc_hidden_builtin_def (memcpy);
+
#endif
#include "../memcpy.S"
+
+#if defined SHARED && IS_IN (libc)
+.globl __GI_memcpy; __GI_memcpy = __new_memcpy;
+#endif
@@ -66,15 +66,6 @@ END(__mempcpy)
# define END_CHK(name) \
cfi_endproc; .size __mempcpy_chk_sse2, .-__mempcpy_chk_sse2
-# undef libc_hidden_def
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal mempcpy calls through a PLT.
- The speedup we get from using SSSE3 instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_def(name) \
- .globl __GI_mempcpy; __GI_mempcpy = __mempcpy_sse2
-# define libc_hidden_builtin_def(name) \
- .globl __GI___mempcpy; __GI___mempcpy = __mempcpy_sse2
#endif
#include "../mempcpy.S"
@@ -35,6 +35,8 @@ ENTRY(memset)
leaq __memset_avx2(%rip), %rax
2: ret
END(memset)
+
+libc_hidden_builtin_def (memset)
# endif
# if IS_IN (libc)
@@ -44,14 +46,6 @@ END(memset)
# undef __memset_chk
# define __memset_chk __memset_chk_sse2
-# ifdef SHARED
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal memset calls through a PLT.
- The speedup we get from using GPR instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_builtin_def(name) \
- .globl __GI_memset; __GI_memset = __memset_sse2
-# endif
# undef strong_alias
# define strong_alias(original, alias)
@@ -1,8 +1,7 @@
#define STPNCPY __stpncpy_sse2
#ifdef SHARED
#undef libc_hidden_def
-#define libc_hidden_def(name) \
- __hidden_ver1 (__stpncpy_sse2, __GI___stpncpy, __stpncpy_sse2);
+#define libc_hidden_def(x)
#endif
#include "stpncpy.c"
@@ -5,4 +5,5 @@
#define USE_AS_STRNCPY
#include "strcpy.S"
+libc_hidden_builtin_def(__stpncpy)
weak_alias (__stpncpy, stpncpy)
@@ -23,7 +23,7 @@
#ifndef USE_AS_STRNCAT
# ifndef STRCAT
-# define STRCAT strcat
+# define STRCAT __strcat
# endif
#endif
@@ -31,14 +31,10 @@
# define STRCAT_SSSE3 __strncat_ssse3
# define STRCAT_SSE2 __strncat_sse2
# define STRCAT_SSE2_UNALIGNED __strncat_sse2_unaligned
-# define __GI_STRCAT __GI_strncat
-# define __GI___STRCAT __GI___strncat
#else
# define STRCAT_SSSE3 __strcat_ssse3
# define STRCAT_SSE2 __strcat_sse2
# define STRCAT_SSE2_UNALIGNED __strcat_sse2_unaligned
-# define __GI_STRCAT __GI_strcat
-# define __GI___STRCAT __GI___strcat
#endif
@@ -71,17 +67,21 @@ END(STRCAT)
# undef END
# define END(name) \
cfi_endproc; .size STRCAT_SSE2, .-STRCAT_SSE2
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal strcat calls through a PLT.
- The speedup we get from using SSSE3 instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_builtin_def(name) \
- .globl __GI_STRCAT; __GI_STRCAT = STRCAT_SSE2
-# undef libc_hidden_def
-# define libc_hidden_def(name) \
- .globl __GI___STRCAT; __GI___STRCAT = STRCAT_SSE2
+
#endif
#ifndef USE_AS_STRNCAT
# include "../strcat.S"
#endif
+
+#if IS_IN (libc)
+# ifdef USE_AS_STRNCAT
+weak_alias (__strncat, strncat)
+libc_hidden_builtin_def (strncat)
+libc_hidden_builtin_def (__strncat)
+# else
+weak_alias (__strcat, strcat)
+libc_hidden_builtin_def (strcat)
+libc_hidden_builtin_def (__strcat)
+# endif
+#endif
@@ -48,12 +48,6 @@ END(strchr)
# undef END
# define END(name) \
cfi_endproc; .size __strchr_sse2, .-__strchr_sse2
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal strchr calls through a PLT.
- The speedup we get from using SSE4.2 instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_builtin_def(name) \
- .globl __GI_strchr; __GI_strchr = __strchr_sse2
#endif
#include "../strchr.S"
@@ -216,12 +216,6 @@ weak_alias (__strncasecmp, strncasecmp)
cfi_endproc; .size __strncasecmp_sse2, .-__strncasecmp_sse2
# endif
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal strcmp calls through a PLT.
- The speedup we get from using SSE4.2 instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_builtin_def(name) \
- .globl __GI_STRCMP; __GI_STRCMP = STRCMP_SSE2
#endif
#include "../strcmp.S"
@@ -85,15 +85,6 @@ END(STRCPY)
# undef END
# define END(name) \
cfi_endproc; .size STRCPY_SSE2, .-STRCPY_SSE2
-# undef libc_hidden_builtin_def
-/* It doesn't make sense to send libc-internal strcpy calls through a PLT.
- The speedup we get from using SSSE3 instruction is likely eaten away
- by the indirect call in the PLT. */
-# define libc_hidden_builtin_def(name) \
- .globl __GI_STRCPY; __GI_STRCPY = STRCPY_SSE2
-# undef libc_hidden_def
-# define libc_hidden_def(name) \
- .globl __GI___STRCPY; __GI___STRCPY = STRCPY_SSE2
#endif
#ifndef USE_AS_STRNCPY
@@ -1,8 +1,6 @@
#define STRNCAT __strncat_sse2
#ifdef SHARED
#undef libc_hidden_def
-#define libc_hidden_def(name) \
- __hidden_ver1 (__strncat_sse2, __GI___strncat, __strncat_sse2);
#endif
#include "string/strncat.c"
@@ -1,5 +1,5 @@
/* Multiple versions of strncat
All versions must be listed in ifunc-impl-list.c. */
-#define STRCAT strncat
+#define STRCAT __strncat
#define USE_AS_STRNCAT
#include "strcat.S"
@@ -1,8 +1,7 @@
#define STRNCPY __strncpy_sse2
#ifdef SHARED
#undef libc_hidden_builtin_def
-#define libc_hidden_builtin_def(name) \
- __hidden_ver1 (__strncpy_sse2, __GI_strncpy, __strncpy_sse2);
+#define libc_hidden_builtin_def(x)
#endif
#include "strncpy.c"
@@ -3,3 +3,5 @@
#define STRCPY strncpy
#define USE_AS_STRNCPY
#include "strcpy.S"
+
+libc_hidden_builtin_def(strncpy)