string: Use asm alias instead of symbol redirections for stpcpy and mempcpy

Commit 939da41143 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 all affected ABIs.
This commit is contained in:
Adhemerval Zanella 2022-03-15 08:41:43 -03:00
parent 706b3d7a47
commit 5e40fc5900
3 changed files with 8 additions and 2 deletions

View File

@ -179,8 +179,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,

View File

@ -17,4 +17,7 @@ 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

View File

@ -17,4 +17,7 @@ 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