public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/azanella/clang] string: Move stpcpy and mempcpy symbol redirection to symbol-hacks.h
Date: Tue, 15 Mar 2022 18:42:13 +0000 (GMT)	[thread overview]
Message-ID: <20220315184213.6DD6B3858D28@sourceware.org> (raw)

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


                 reply	other threads:[~2022-03-15 18:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220315184213.6DD6B3858D28@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).