[glibc/azanella/clang] string: mempcy and stpcpy builtins internally

Adhemerval Zanella azanella@sourceware.org
Tue Apr 2 15:58:34 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=91814e0435e3c9491fa71e9a3b823761a85f90d5

commit 91814e0435e3c9491fa71e9a3b823761a85f90d5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 31 15:18:02 2022 -0300

    string: mempcy and stpcpy builtins internally

Diff:
---
 include/string.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/string.h b/include/string.h
index 082865caad..2a4788e8c2 100644
--- a/include/string.h
+++ b/include/string.h
@@ -175,13 +175,17 @@ extern __typeof (strnlen) strnlen attribute_hidden;
 extern __typeof (strsep) strsep attribute_hidden;
 #endif
 
-#if (!IS_IN (libc) || !defined SHARED) \
-  && !defined NO_MEMPCPY_STPCPY_REDIRECT
+#if IS_IN (libc) && !defined NO_MEMPCPY_STPCPY_REDIRECT
 /* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
    __mempcpy and __stpcpy if not inlined.  */
+# ifdef SHARED
+__asm__ ("mempcpy = __GI_mempcpy");
+__asm__ ("stpcpy = __GI_stpcpy");
+# else
 __asm__ ("mempcpy = __mempcpy");
 __asm__ ("stpcpy = __stpcpy");
 #endif
+#endif
 
 extern void *__memcpy_chk (void *__restrict __dest,
 			   const void *__restrict __src, size_t __len,


More information about the Glibc-cvs mailing list