public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-06-09 13:12 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 13:12 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=98a337f53325035f3e051cf91b81927091d01f17

commit 98a337f53325035f3e051cf91b81927091d01f17
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index ec57e3a965..06dbeec4b1 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-06-09 21:15 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-06-09 21:15 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=98a337f53325035f3e051cf91b81927091d01f17

commit 98a337f53325035f3e051cf91b81927091d01f17
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index ec57e3a965..06dbeec4b1 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-06-03 14:01 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-06-03 14:01 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2cd26fa111a3aeb1e5924c031ccce801ad536b47

commit 2cd26fa111a3aeb1e5924c031ccce801ad536b47
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index ec57e3a965..06dbeec4b1 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-05-13 14:15 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-05-13 14:15 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=c27fc9241708f3c34c5fac5556862e9e8f9fb05f

commit c27fc9241708f3c34c5fac5556862e9e8f9fb05f
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index ec57e3a965..06dbeec4b1 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-05-12 19:29 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-05-12 19:29 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=f3ebe55a2f2e00821a3b75fccce8322d3f6568e5

commit f3ebe55a2f2e00821a3b75fccce8322d3f6568e5
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index ec57e3a965..06dbeec4b1 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-05-10 18:19 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-05-10 18:19 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=fab9639153f51150300cfbfcbf6976549ad845b3

commit fab9639153f51150300cfbfcbf6976549ad845b3
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index ec57e3a965..06dbeec4b1 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-04-29 13:59 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-04-29 13:59 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=0844a956ccb538258ec4d357c778952dbf598e2d

commit 0844a956ccb538258ec4d357c778952dbf598e2d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index ec57e3a965..06dbeec4b1 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-04-04 12:49 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-04-04 12:49 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=ad740e672498f1ac1e6421afdb5b85871149409a

commit ad740e672498f1ac1e6421afdb5b85871149409a
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9359be7c33..75c3467861 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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)
 	    {
-	      uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
+	      uint_fast32_t newarc = atomic_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-03-31 19:02 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-31 19:02 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2343007d7366f5fd6d14a9d67c3c744869362207

commit 2343007d7366f5fd6d14a9d67c3c744869362207
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9359be7c33..75c3467861 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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)
 	    {
-	      uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
+	      uint_fast32_t newarc = atomic_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-03-29 20:25 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-29 20:25 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d8b1bd3f05760056b086dd8514ba03d047a17a00

commit d8b1bd3f05760056b086dd8514ba03d047a17a00
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9359be7c33..75c3467861 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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)
 	    {
-	      uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
+	      uint_fast32_t newarc = atomic_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-03-16 18:01 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-16 18:01 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=aab229263c907c54b1f24ac62f101ca569081a6b

commit aab229263c907c54b1f24ac62f101ca569081a6b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9359be7c33..75c3467861 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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)
 	    {
-	      uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
+	      uint_fast32_t newarc = atomic_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-03-15 18:39 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-15 18:39 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=aab229263c907c54b1f24ac62f101ca569081a6b

commit aab229263c907c54b1f24ac62f101ca569081a6b
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9359be7c33..75c3467861 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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)
 	    {
-	      uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
+	      uint_fast32_t newarc = atomic_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount
@ 2022-03-11 17:23 Adhemerval Zanella
  0 siblings, 0 replies; 13+ messages in thread
From: Adhemerval Zanella @ 2022-03-11 17:23 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=331f797ad7b55844c8e46a739fb3efc7929d5f08

commit 331f797ad7b55844c8e46a739fb3efc7929d5f08
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Thu Mar 10 09:32:38 2022 -0300

    elf: Use C11 atomics on _dl_mcount
    
    Checked on x86_64-linux-gnu.

Diff:
---
 elf/dl-profile.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/elf/dl-profile.c b/elf/dl-profile.c
index 9359be7c33..75c3467861 100644
--- a/elf/dl-profile.c
+++ b/elf/dl-profile.c
@@ -548,7 +548,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      size_t newfromidx;
 	      to_index = (data[narcs].self_pc
 			  / (HASHFRACTION * sizeof (*tos)));
-	      newfromidx = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      newfromidx = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      froms[newfromidx].here = &data[narcs];
 	      froms[newfromidx].link = tos[to_index];
 	      tos[to_index] = newfromidx;
@@ -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)
 	    {
-	      uint_fast32_t newarc = catomic_exchange_and_add (narcsp, 1);
+	      uint_fast32_t newarc = atomic_exchange_and_add (narcsp, 1) + 1;
 
 	      /* In rare cases it could happen that all entries in FROMS are
 		 occupied.  So we cannot count this anymore.  */
 	      if (newarc >= fromlimit)
 		goto done;
 
-	      *topcindex = catomic_exchange_and_add (&fromidx, 1) + 1;
+	      *topcindex = atomic_fetch_and_acquire (&fromidx, 1) + 1;
 	      fromp = &froms[*topcindex];
 
 	      fromp->here = &data[newarc];
@@ -573,7 +573,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
 	      data[newarc].self_pc = selfpc;
 	      data[newarc].count = 0;
 	      fromp->link = 0;
-	      catomic_increment (&narcs);
+	      atomic_fetch_and_acquire (&narcs, 1);
 
 	      break;
 	    }
@@ -586,7 +586,7 @@ _dl_mcount (ElfW(Addr) frompc, ElfW(Addr) selfpc)
     }
 
   /* Increment the counter.  */
-  catomic_increment (&fromp->here->count);
+  atomic_fetch_and_acquire (&fromp->here->count, 1);
 
  done:
   ;


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2022-06-09 21:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-09 13:12 [glibc/azanella/clang] elf: Use C11 atomics on _dl_mcount Adhemerval Zanella
  -- strict thread matches above, loose matches on Subject: below --
2022-06-09 21:15 Adhemerval Zanella
2022-06-03 14:01 Adhemerval Zanella
2022-05-13 14:15 Adhemerval Zanella
2022-05-12 19:29 Adhemerval Zanella
2022-05-10 18:19 Adhemerval Zanella
2022-04-29 13:59 Adhemerval Zanella
2022-04-04 12:49 Adhemerval Zanella
2022-03-31 19:02 Adhemerval Zanella
2022-03-29 20:25 Adhemerval Zanella
2022-03-16 18:01 Adhemerval Zanella
2022-03-15 18:39 Adhemerval Zanella
2022-03-11 17:23 Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).