[PATCH v3 3/6] Initialize l_mach field from rtld link_map
Adhemerval Zanella Netto
adhemerval.zanella@linaro.org
Wed Sep 17 21:08:10 GMT 2025
On 03/09/25 10:53, Jovan Dmitrovic wrote:
> From: Aleksandar Rakic <aleksandar.rakic@htecgroup.com>
>
> Based on patch submitted by Sandra Loosemore:
> https://sourceware.org/ml/libc-alpha/2015-03/msg00704.html
>
> For MIPS builds, l_mach field contains fpabi value.
> If l_mach isn't zero-initialized, we may get dynamic linking
> failures due to incompatible FP ABIs. Similar issue may arise
> or is already present on other platforms.
>
> Reported-by: Sandra Loosemore <sandra@codesourcery.com>
> ---
> elf/rtld.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/elf/rtld.c b/elf/rtld.c
> index 753ce6690b..10bf816e7f 100644
> --- a/elf/rtld.c
> +++ b/elf/rtld.c
> @@ -532,6 +532,7 @@ _dl_start (void *arg)
> do not have to use the temporary bootstrap_map. Global variables
> are initialized to zero by default. */
> #ifndef DONT_USE_BOOTSTRAP_MAP
> + bootstrap_map.l_mach = (struct link_map_machine) {};
> # ifdef HAVE_BUILTIN_MEMSET
> __builtin_memset (bootstrap_map.l_info, '\0', sizeof (bootstrap_map.l_info));
> # else
Even if compiler inlines the zero clearing, I think it would be better to
follow the same strategy done for l_info and either user __builtin_memset
or a open-coded memset.
More information about the Libc-alpha
mailing list