From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 54B5A3856DCD; Fri, 29 Apr 2022 14:04:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54B5A3856DCD 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: Use asm alias instead of symbol redirections for stpcpy and mempcpy X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/azanella/clang X-Git-Oldrev: 5fe04a795d9c8d6722585ceb237df7ffbf177e8c X-Git-Newrev: 48391c8199797f86b1e90c2969f3e4d5346f1b8d Message-Id: <20220429140441.54B5A3856DCD@sourceware.org> Date: Fri, 29 Apr 2022 14:04:41 +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: Fri, 29 Apr 2022 14:04:41 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=48391c8199797f86b1e90c2969f3e4d5346f1b8d commit 48391c8199797f86b1e90c2969f3e4d5346f1b8d Author: Adhemerval Zanella Date: Tue Mar 15 08:41:43 2022 -0300 string: Use asm alias instead of symbol redirections for stpcpy and mempcpy Commit 939da411433 added symbols redirections to handle ISO C namespace, however some compiler does not support to redeclare the function prototype. 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 aliases, as done to handle libcall generation done by compiler on some loop optimizations. The only issue is sparc binutils generates an extra __mempcpy plt not called anywhere in the code, which indicates a binutils issue (this is added in the localplt.data for now). Checked on most of affected ABIs. Diff: --- include/string.h | 4 ++-- sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/string.h b/include/string.h index 21f641a413..44c4049053 100644 --- a/include/string.h +++ b/include/string.h @@ -176,8 +176,8 @@ extern __typeof (strsep) strsep attribute_hidden; && !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"); +__asm__ ("mempcpy = __mempcpy"); +__asm__ ("stpcpy = __stpcpy"); #endif extern void *__memcpy_chk (void *__restrict __dest, diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data b/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data index 6a216f3a5a..21a5fe65ba 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/localplt.data @@ -16,6 +16,9 @@ libc.so: calloc libc.so: free libc.so: malloc libc.so: realloc +# Unreferenced PLT created by the symbols aliases used to redirect +# the compiler generated mempcpy/stpcyp calls done by builtin usage. +libc.so: __mempcpy libm.so: matherr # The TLS-enabled version of these functions is interposed from libc.so. ld.so: _dl_signal_error