[PATCH v3] elf: Use C11 atomics on _dl_mcount

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Wed Sep 21 14:01:58 GMT 2022



On 20/09/22 19:59, Wilco Dijkstra wrote:
> Hi Adhemerval,
> 
> 
> @@ -558,14 +558,14 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
>            /* If we still have no entry stop searching and insert.  */
>            if (*topcindex == 0)
>              {
> -             unsigned int newarc = catomic_exchange_and_add (narcsp, 1);
> +             unsigned int newarc = atomic_fetch_add_relaxed (narcsp, 1) + 1;
>  
> This adds a spurious + 1. Other than that it looks good to me.

Thanks, I have removed it.

> 
> Reviewed-by: Wilco Dijkstra <Wilco.Dijkstra@arm.com>
> 
> Cheers,
> Wilco 


More information about the Libc-alpha mailing list