From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 6DD6B3858D28; Tue, 15 Mar 2022 18:42:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6DD6B3858D28 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc/azanella/clang] string: Move stpcpy and mempcpy symbol redirection to symbol-hacks.h X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 98b531bc0e41179ed96613e362416d40676447c3 X-Git-Newrev: b713ef3aa9e4b4da369741d0c7e59c05c357e810 Message-Id: <20220315184213.6DD6B3858D28@sourceware.org> Date: Tue, 15 Mar 2022 18:42:13 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2022 18:42:13 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b713ef3aa9e4b4da369741d0c7e59c05c357e810 commit b713ef3aa9e4b4da369741d0c7e59c05c357e810 Author: Adhemerval Zanella 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