public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/siddhesh/malloc-hooks] Remove __after_morecore_hook
@ 2021-07-12  4:56 Siddhesh Poyarekar
  0 siblings, 0 replies; 6+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-12  4:56 UTC (permalink / raw)
  To: glibc-cvs

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

commit f4b8d7c5b7b703ce205391a841f6a91bf369a40e
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Mon Jul 5 20:03:19 2021 +0530

    Remove __after_morecore_hook
    
    Remove __after_morecore_hook from the API and finalize the symbol so
    that it can no longer be used in new applications.  Old applications
    using __after_morecore_hook will find that their hook is no longer
    called.

Diff:
---
 malloc/hooks.c  |  5 +++++
 malloc/malloc.c | 22 +---------------------
 malloc/malloc.h |  3 ---
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/malloc/hooks.c b/malloc/hooks.c
index daa5c7cfae..45c91d6502 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <https://www.gnu.org/licenses/>.  */
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
+void weak_variable (*__after_morecore_hook) (void) = NULL;
+compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0);
+#endif
+
 /* Hooks for debugging versions.  The initial hooks just call the
    initialization routine, then do the normal work. */
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 154f6b460c..24e7854a0e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook)
 void *weak_variable (*__memalign_hook)
   (size_t __alignment, size_t __size, const void *)
   = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) (void) = NULL;
-
 /* This function is called from the arena shutdown hook, to free the
    thread cache (if it exists).  */
 static void tcache_thread_shutdown (void);
@@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
           LIBC_PROBE (memory_sbrk_more, 2, brk, size);
         }
 
-      if (brk != (char *) (MORECORE_FAILURE))
-        {
-          /* Call the `morecore' hook if necessary.  */
-          void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-          if (__builtin_expect (hook != NULL, 0))
-            (*hook)();
-        }
-      else
+      if (brk == (char *) (MORECORE_FAILURE))
         {
           /*
              If have mmap, try using it as a backup when MORECORE fails or
@@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
                       correction = 0;
                       snd_brk = (char *) (MORECORE (0));
                     }
-                  else
-                    {
-                      /* Call the `morecore' hook if necessary.  */
-                      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-                      if (__builtin_expect (hook != NULL, 0))
-                        (*hook)();
-                    }
                 }
 
               /* handle non-contiguous cases */
@@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av)
        */
 
       MORECORE (-extra);
-      /* Call the `morecore' hook if necessary.  */
-      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-      if (__builtin_expect (hook != NULL, 0))
-        (*hook)();
       new_brk = (char *) (MORECORE (0));
 
       LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
diff --git a/malloc/malloc.h b/malloc/malloc.h
index c1c0896d29..634b7db868 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                        size_t __size,
                                                        const void *)
 __MALLOC_DEPRECATED;
-extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
-  __MALLOC_DEPRECATED;
-
 
 __END_DECLS
 #endif /* malloc.h */


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

* [glibc/siddhesh/malloc-hooks] Remove __after_morecore_hook
@ 2021-07-19 17:47 Siddhesh Poyarekar
  0 siblings, 0 replies; 6+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-19 17:47 UTC (permalink / raw)
  To: glibc-cvs

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

commit 5efcb84c6bbc7b9b7635ef4da614dae40c12a887
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Mon Jul 5 20:03:19 2021 +0530

    Remove __after_morecore_hook
    
    Remove __after_morecore_hook from the API and finalize the symbol so
    that it can no longer be used in new applications.  Old applications
    using __after_morecore_hook will find that their hook is no longer
    called.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 malloc/hooks.c  |  5 +++++
 malloc/malloc.c | 22 +---------------------
 malloc/malloc.h |  3 ---
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/malloc/hooks.c b/malloc/hooks.c
index daa5c7cfae..45c91d6502 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <https://www.gnu.org/licenses/>.  */
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
+void weak_variable (*__after_morecore_hook) (void) = NULL;
+compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0);
+#endif
+
 /* Hooks for debugging versions.  The initial hooks just call the
    initialization routine, then do the normal work. */
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 154f6b460c..24e7854a0e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook)
 void *weak_variable (*__memalign_hook)
   (size_t __alignment, size_t __size, const void *)
   = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) (void) = NULL;
-
 /* This function is called from the arena shutdown hook, to free the
    thread cache (if it exists).  */
 static void tcache_thread_shutdown (void);
@@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
           LIBC_PROBE (memory_sbrk_more, 2, brk, size);
         }
 
-      if (brk != (char *) (MORECORE_FAILURE))
-        {
-          /* Call the `morecore' hook if necessary.  */
-          void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-          if (__builtin_expect (hook != NULL, 0))
-            (*hook)();
-        }
-      else
+      if (brk == (char *) (MORECORE_FAILURE))
         {
           /*
              If have mmap, try using it as a backup when MORECORE fails or
@@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
                       correction = 0;
                       snd_brk = (char *) (MORECORE (0));
                     }
-                  else
-                    {
-                      /* Call the `morecore' hook if necessary.  */
-                      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-                      if (__builtin_expect (hook != NULL, 0))
-                        (*hook)();
-                    }
                 }
 
               /* handle non-contiguous cases */
@@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av)
        */
 
       MORECORE (-extra);
-      /* Call the `morecore' hook if necessary.  */
-      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-      if (__builtin_expect (hook != NULL, 0))
-        (*hook)();
       new_brk = (char *) (MORECORE (0));
 
       LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
diff --git a/malloc/malloc.h b/malloc/malloc.h
index c1c0896d29..634b7db868 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                        size_t __size,
                                                        const void *)
 __MALLOC_DEPRECATED;
-extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
-  __MALLOC_DEPRECATED;
-
 
 __END_DECLS
 #endif /* malloc.h */


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

* [glibc/siddhesh/malloc-hooks] Remove __after_morecore_hook
@ 2021-07-19 13:29 Siddhesh Poyarekar
  0 siblings, 0 replies; 6+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-19 13:29 UTC (permalink / raw)
  To: glibc-cvs

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

commit 5efcb84c6bbc7b9b7635ef4da614dae40c12a887
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Mon Jul 5 20:03:19 2021 +0530

    Remove __after_morecore_hook
    
    Remove __after_morecore_hook from the API and finalize the symbol so
    that it can no longer be used in new applications.  Old applications
    using __after_morecore_hook will find that their hook is no longer
    called.
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
    Tested-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 malloc/hooks.c  |  5 +++++
 malloc/malloc.c | 22 +---------------------
 malloc/malloc.h |  3 ---
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/malloc/hooks.c b/malloc/hooks.c
index daa5c7cfae..45c91d6502 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <https://www.gnu.org/licenses/>.  */
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
+void weak_variable (*__after_morecore_hook) (void) = NULL;
+compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0);
+#endif
+
 /* Hooks for debugging versions.  The initial hooks just call the
    initialization routine, then do the normal work. */
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 154f6b460c..24e7854a0e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook)
 void *weak_variable (*__memalign_hook)
   (size_t __alignment, size_t __size, const void *)
   = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) (void) = NULL;
-
 /* This function is called from the arena shutdown hook, to free the
    thread cache (if it exists).  */
 static void tcache_thread_shutdown (void);
@@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
           LIBC_PROBE (memory_sbrk_more, 2, brk, size);
         }
 
-      if (brk != (char *) (MORECORE_FAILURE))
-        {
-          /* Call the `morecore' hook if necessary.  */
-          void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-          if (__builtin_expect (hook != NULL, 0))
-            (*hook)();
-        }
-      else
+      if (brk == (char *) (MORECORE_FAILURE))
         {
           /*
              If have mmap, try using it as a backup when MORECORE fails or
@@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
                       correction = 0;
                       snd_brk = (char *) (MORECORE (0));
                     }
-                  else
-                    {
-                      /* Call the `morecore' hook if necessary.  */
-                      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-                      if (__builtin_expect (hook != NULL, 0))
-                        (*hook)();
-                    }
                 }
 
               /* handle non-contiguous cases */
@@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av)
        */
 
       MORECORE (-extra);
-      /* Call the `morecore' hook if necessary.  */
-      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-      if (__builtin_expect (hook != NULL, 0))
-        (*hook)();
       new_brk = (char *) (MORECORE (0));
 
       LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
diff --git a/malloc/malloc.h b/malloc/malloc.h
index c1c0896d29..634b7db868 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                        size_t __size,
                                                        const void *)
 __MALLOC_DEPRECATED;
-extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
-  __MALLOC_DEPRECATED;
-
 
 __END_DECLS
 #endif /* malloc.h */


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

* [glibc/siddhesh/malloc-hooks] Remove __after_morecore_hook
@ 2021-07-13  3:39 Siddhesh Poyarekar
  0 siblings, 0 replies; 6+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-13  3:39 UTC (permalink / raw)
  To: glibc-cvs

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

commit 5393ca46337c19fd464c6ea7b59510edcc6151d7
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Mon Jul 5 20:03:19 2021 +0530

    Remove __after_morecore_hook
    
    Remove __after_morecore_hook from the API and finalize the symbol so
    that it can no longer be used in new applications.  Old applications
    using __after_morecore_hook will find that their hook is no longer
    called.

Diff:
---
 malloc/hooks.c  |  5 +++++
 malloc/malloc.c | 22 +---------------------
 malloc/malloc.h |  3 ---
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/malloc/hooks.c b/malloc/hooks.c
index daa5c7cfae..45c91d6502 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <https://www.gnu.org/licenses/>.  */
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
+void weak_variable (*__after_morecore_hook) (void) = NULL;
+compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0);
+#endif
+
 /* Hooks for debugging versions.  The initial hooks just call the
    initialization routine, then do the normal work. */
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 154f6b460c..24e7854a0e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook)
 void *weak_variable (*__memalign_hook)
   (size_t __alignment, size_t __size, const void *)
   = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) (void) = NULL;
-
 /* This function is called from the arena shutdown hook, to free the
    thread cache (if it exists).  */
 static void tcache_thread_shutdown (void);
@@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
           LIBC_PROBE (memory_sbrk_more, 2, brk, size);
         }
 
-      if (brk != (char *) (MORECORE_FAILURE))
-        {
-          /* Call the `morecore' hook if necessary.  */
-          void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-          if (__builtin_expect (hook != NULL, 0))
-            (*hook)();
-        }
-      else
+      if (brk == (char *) (MORECORE_FAILURE))
         {
           /*
              If have mmap, try using it as a backup when MORECORE fails or
@@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
                       correction = 0;
                       snd_brk = (char *) (MORECORE (0));
                     }
-                  else
-                    {
-                      /* Call the `morecore' hook if necessary.  */
-                      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-                      if (__builtin_expect (hook != NULL, 0))
-                        (*hook)();
-                    }
                 }
 
               /* handle non-contiguous cases */
@@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av)
        */
 
       MORECORE (-extra);
-      /* Call the `morecore' hook if necessary.  */
-      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-      if (__builtin_expect (hook != NULL, 0))
-        (*hook)();
       new_brk = (char *) (MORECORE (0));
 
       LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
diff --git a/malloc/malloc.h b/malloc/malloc.h
index c1c0896d29..634b7db868 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                        size_t __size,
                                                        const void *)
 __MALLOC_DEPRECATED;
-extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
-  __MALLOC_DEPRECATED;
-
 
 __END_DECLS
 #endif /* malloc.h */


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

* [glibc/siddhesh/malloc-hooks] Remove __after_morecore_hook
@ 2021-07-09  2:35 Siddhesh Poyarekar
  0 siblings, 0 replies; 6+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-09  2:35 UTC (permalink / raw)
  To: glibc-cvs

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

commit 31748705247a04d5bc075c56338c2d384e370523
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Mon Jul 5 20:03:19 2021 +0530

    Remove __after_morecore_hook
    
    Remove __after_morecore_hook from the API and finalize the symbol so
    that it can no longer be used in new applications.  Old applications
    using __after_morecore_hook will find that their hook is no longer
    called.

Diff:
---
 malloc/hooks.c  |  5 +++++
 malloc/malloc.c | 22 +---------------------
 malloc/malloc.h |  3 ---
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/malloc/hooks.c b/malloc/hooks.c
index daa5c7cfae..45c91d6502 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <https://www.gnu.org/licenses/>.  */
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
+void weak_variable (*__after_morecore_hook) (void) = NULL;
+compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0);
+#endif
+
 /* Hooks for debugging versions.  The initial hooks just call the
    initialization routine, then do the normal work. */
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0253453f27..6340eb133b 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook)
 void *weak_variable (*__memalign_hook)
   (size_t __alignment, size_t __size, const void *)
   = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) (void) = NULL;
-
 /* This function is called from the arena shutdown hook, to free the
    thread cache (if it exists).  */
 static void tcache_thread_shutdown (void);
@@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
           LIBC_PROBE (memory_sbrk_more, 2, brk, size);
         }
 
-      if (brk != (char *) (MORECORE_FAILURE))
-        {
-          /* Call the `morecore' hook if necessary.  */
-          void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-          if (__builtin_expect (hook != NULL, 0))
-            (*hook)();
-        }
-      else
+      if (brk == (char *) (MORECORE_FAILURE))
         {
           /*
              If have mmap, try using it as a backup when MORECORE fails or
@@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
                       correction = 0;
                       snd_brk = (char *) (MORECORE (0));
                     }
-                  else
-                    {
-                      /* Call the `morecore' hook if necessary.  */
-                      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-                      if (__builtin_expect (hook != NULL, 0))
-                        (*hook)();
-                    }
                 }
 
               /* handle non-contiguous cases */
@@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av)
        */
 
       MORECORE (-extra);
-      /* Call the `morecore' hook if necessary.  */
-      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-      if (__builtin_expect (hook != NULL, 0))
-        (*hook)();
       new_brk = (char *) (MORECORE (0));
 
       LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
diff --git a/malloc/malloc.h b/malloc/malloc.h
index c1c0896d29..634b7db868 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                        size_t __size,
                                                        const void *)
 __MALLOC_DEPRECATED;
-extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
-  __MALLOC_DEPRECATED;
-
 
 __END_DECLS
 #endif /* malloc.h */


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

* [glibc/siddhesh/malloc-hooks] Remove __after_morecore_hook
@ 2021-07-08 13:20 Siddhesh Poyarekar
  0 siblings, 0 replies; 6+ messages in thread
From: Siddhesh Poyarekar @ 2021-07-08 13:20 UTC (permalink / raw)
  To: glibc-cvs

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

commit 31748705247a04d5bc075c56338c2d384e370523
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Mon Jul 5 20:03:19 2021 +0530

    Remove __after_morecore_hook
    
    Remove __after_morecore_hook from the API and finalize the symbol so
    that it can no longer be used in new applications.  Old applications
    using __after_morecore_hook will find that their hook is no longer
    called.

Diff:
---
 malloc/hooks.c  |  5 +++++
 malloc/malloc.c | 22 +---------------------
 malloc/malloc.h |  3 ---
 3 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/malloc/hooks.c b/malloc/hooks.c
index daa5c7cfae..45c91d6502 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; see the file COPYING.LIB.  If
    not, see <https://www.gnu.org/licenses/>.  */
 
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34)
+void weak_variable (*__after_morecore_hook) (void) = NULL;
+compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0);
+#endif
+
 /* Hooks for debugging versions.  The initial hooks just call the
    initialization routine, then do the normal work. */
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0253453f27..6340eb133b 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2041,8 +2041,6 @@ void *weak_variable (*__realloc_hook)
 void *weak_variable (*__memalign_hook)
   (size_t __alignment, size_t __size, const void *)
   = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) (void) = NULL;
-
 /* This function is called from the arena shutdown hook, to free the
    thread cache (if it exists).  */
 static void tcache_thread_shutdown (void);
@@ -2668,14 +2666,7 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
           LIBC_PROBE (memory_sbrk_more, 2, brk, size);
         }
 
-      if (brk != (char *) (MORECORE_FAILURE))
-        {
-          /* Call the `morecore' hook if necessary.  */
-          void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-          if (__builtin_expect (hook != NULL, 0))
-            (*hook)();
-        }
-      else
+      if (brk == (char *) (MORECORE_FAILURE))
         {
           /*
              If have mmap, try using it as a backup when MORECORE fails or
@@ -2814,13 +2805,6 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av)
                       correction = 0;
                       snd_brk = (char *) (MORECORE (0));
                     }
-                  else
-                    {
-                      /* Call the `morecore' hook if necessary.  */
-                      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-                      if (__builtin_expect (hook != NULL, 0))
-                        (*hook)();
-                    }
                 }
 
               /* handle non-contiguous cases */
@@ -2979,10 +2963,6 @@ systrim (size_t pad, mstate av)
        */
 
       MORECORE (-extra);
-      /* Call the `morecore' hook if necessary.  */
-      void (*hook) (void) = atomic_forced_read (__after_morecore_hook);
-      if (__builtin_expect (hook != NULL, 0))
-        (*hook)();
       new_brk = (char *) (MORECORE (0));
 
       LIBC_PROBE (memory_sbrk_less, 2, new_brk, extra);
diff --git a/malloc/malloc.h b/malloc/malloc.h
index c1c0896d29..634b7db868 100644
--- a/malloc/malloc.h
+++ b/malloc/malloc.h
@@ -179,9 +179,6 @@ extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                        size_t __size,
                                                        const void *)
 __MALLOC_DEPRECATED;
-extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
-  __MALLOC_DEPRECATED;
-
 
 __END_DECLS
 #endif /* malloc.h */


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

end of thread, other threads:[~2021-07-19 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12  4:56 [glibc/siddhesh/malloc-hooks] Remove __after_morecore_hook Siddhesh Poyarekar
  -- strict thread matches above, loose matches on Subject: below --
2021-07-19 17:47 Siddhesh Poyarekar
2021-07-19 13:29 Siddhesh Poyarekar
2021-07-13  3:39 Siddhesh Poyarekar
2021-07-09  2:35 Siddhesh Poyarekar
2021-07-08 13:20 Siddhesh Poyarekar

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).