[PATCH 7/8] stdlib: Avoid strlen plt with clang

H.J. Lu hjl.tools@gmail.com
Thu Dec 18 23:40:56 GMT 2025


On Thu, Dec 18, 2025 at 1:56 AM Adhemerval Zanella
<adhemerval.zanella@linaro.org> wrote:
>
> The clang-21 LoopIdiomRecognizePass replaces some loops in
> __xpg_basename with a strlen call.
> ---
>  sysdeps/generic/symbol-hacks.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/sysdeps/generic/symbol-hacks.h b/sysdeps/generic/symbol-hacks.h
> index 58398d33a5..0d728cce91 100644
> --- a/sysdeps/generic/symbol-hacks.h
> +++ b/sysdeps/generic/symbol-hacks.h
> @@ -20,6 +20,7 @@ asm ("__strcpy_chk = __GI___strcpy_chk");
>  asm ("strcpy = __GI_strcpy");
>  asm ("strncpy = __GI_strncpy");
>  asm ("strcat = __GI_strcat");
> +asm ("strlen = __GI_strlen");
>
>  /* Some targets do not use __stack_chk_fail_local.  In libc.so,
>     redirect __stack_chk_fail to a hidden reference
> --
> 2.43.0
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

-- 
H.J.


More information about the Libc-alpha mailing list