[PATCH] elf: Use dl-symbol-redir-ifunc.h instead _dl_strlen
Florian Weimer
fw@deneb.enyo.de
Wed Feb 11 18:52:46 GMT 2026
* Adhemerval Zanella Netto:
> On 11/02/26 15:31, Florian Weimer wrote:
>> * Adhemerval Zanella Netto:
>>
>>> On 11/02/26 10:58, Florian Weimer wrote:
>>>> * Adhemerval Zanella:
>>>>
>>>>> static char **
>>>>> get_next_env (char **envp, char **name, char **val, char ***prev_envp)
>>>>> {
>>>>> @@ -334,8 +324,9 @@ __tunables_init (char **envp)
>>>>>
>>>>> if (tunable_is_name (name, envname))
>>>>> {
>>>>> + size_t envvallen = 0;
>>>>> /* The environment variable is always null-terminated. */
>>>>> - size_t envvallen = _dl_strlen (envval);
>>>>> + for (const char *p = envval; *p != '\0'; p++, envvallen++);
>>>>
>>>
>>> Because it would require potentially more dl-symbol-redir-ifunc.h change
>>> than the ones I am testing now (x86_64/aarch64). At least for clang-21,
>>> we only supports these architectures.
>>
>> Then this needs a comment why we can't use strlen.
>
> I think we can, it is just that it might require additional machinery on
> dl-symbol-redir-ifunc.h for different architectures than the one I checked
> for the _dl_strlen addition.
>
> So I went for simplicity, where I know that it should not change gcc code
> generation.
Still I think this should a comment that refers to the
-fno-tree-loop-distribute-patterns flag used to build elf/dl-tunables.c
(otherwise this strlen avoidance wouldn't work).
More information about the Libc-alpha
mailing list