[PATCH v2 14/28] string: Use asm alias instead of symbol redirections for stpcpy and mempcpy
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Tue Oct 28 20:01:19 GMT 2025
On 28/10/25 16:17, H.J. Lu wrote:
> On Wed, Oct 29, 2025 at 1:12 AM Adhemerval Zanella
> <adhemerval.zanella@linaro.org> wrote:
>>
>> Commit 939da411433 added symbols redirections to handle ISO C
>> namespace, however clang do not support to redeclare the function
>> prototype.
>>
>> This patch replaces the symbol redirections by direct asm aliases, as
>> done to handle libcall generation done by compiler on some loop
>> optimizations.
>>
>> Checked on all affected ABIs.
>> ---
>> include/string.h | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/string.h b/include/string.h
>> index c26ca0927c..2ea212a401 100644
>> --- a/include/string.h
>> +++ b/include/string.h
>> @@ -188,8 +188,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,
>> --
>> 2.43.0
>>
>
> Can it be moved to symbol-hacks.h?
>
This would require to add a reference of NO_MEMPCPY_STPCPY_REDIRECT,
not sure if this is a better approach.
More information about the Libc-alpha
mailing list