public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] string: Move stpcpy and mempcpy symbol redirection to symbol-hacks.h
@ 2022-03-15 18:42 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2022-03-15 18:42 UTC (permalink / raw)
  To: glibc-cvs

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

commit b713ef3aa9e4b4da369741d0c7e59c05c357e810
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Tue Mar 15 08:41:43 2022 -0300

    string: Move stpcpy and mempcpy symbol redirection to symbol-hacks.h
    
    Commit 939da411433 added symbols redirections to handle ISO C
    namespace, however some compiler does not support redeclare the
    function prototype and moving these defintions to exported header
    it not a good practice (it exposes a internal implementation and
    it would require to add macros to define it only internally).
    
    Instead this patch replaces the symbol redirections by direct asm
    alias, as done to handle libcall generation done by compiler on
    some loop optimizations.
    
    Checked on most of affected ABIs.

Diff:
---
 include/string.h               | 8 --------
 sysdeps/generic/symbol-hacks.h | 8 ++++++++
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/string.h b/include/string.h
index 21f641a413..52cb84eca5 100644
--- a/include/string.h
+++ b/include/string.h
@@ -172,14 +172,6 @@ extern __typeof (strnlen) strnlen attribute_hidden;
 extern __typeof (strsep) strsep attribute_hidden;
 #endif
 
-#if (!IS_IN (libc) || !defined SHARED) \
-  && !defined NO_MEMPCPY_STPCPY_REDIRECT
-/* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
-   __mempcpy and __stpcpy if not inlined.  */
-extern __typeof (mempcpy) mempcpy __asm__ ("__mempcpy");
-extern __typeof (stpcpy) stpcpy __asm__ ("__stpcpy");
-#endif
-
 extern void *__memcpy_chk (void *__restrict __dest,
 			   const void *__restrict __src, size_t __len,
 			   size_t __destlen) __THROW;
diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
index 1115e4c0a7..8df5c7f8df 100644
--- a/sysdeps/generic/symbol-hacks.h
+++ b/sysdeps/generic/symbol-hacks.h
@@ -18,3 +18,11 @@ asm (".hidden __stack_chk_fail_local\n"
      "__stack_chk_fail = __stack_chk_fail_local");
 # endif
 #endif
+
+#if !defined __ASSEMBLER__ && ((!IS_IN (libc) || !defined SHARED) \
+			       && !defined NO_MEMPCPY_STPCPY_REDIRECT)
+/* Redirect calls to __builtin_mempcpy and __builtin_stpcpy to call
+   __mempcpy and __stpcpy if not inlined.  */
+__asm__ ("mempcpy = __mempcpy");
+__asm__ ("stpcpy = __stpcpy");
+#endif


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-15 18:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 18:42 [glibc/azanella/clang] string: Move stpcpy and mempcpy symbol redirection to symbol-hacks.h Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).