[PATCH v3] elf: Use C11 atomics on _dl_mcount

Wilco Dijkstra Wilco.Dijkstra@arm.com
Tue Sep 20 22:59:40 GMT 2022


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.

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

Cheers,
Wilco 


More information about the Libc-alpha mailing list