| 1 | /* Compatibility code for malloc debugging and state management. |
| 2 | Copyright (C) 2001-2024 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 5 | The GNU C Library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public License as |
| 7 | published by the Free Software Foundation; either version 2.1 of the |
| 8 | License, or (at your option) any later version. |
| 9 | |
| 10 | The GNU C Library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with the GNU C Library; see the file COPYING.LIB. If |
| 17 | not, see <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | #ifndef weak_variable |
| 20 | # define weak_variable weak_function |
| 21 | #endif |
| 22 | |
| 23 | #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_24) |
| 24 | void (*__malloc_initialize_hook) (void); |
| 25 | compat_symbol (libc, __malloc_initialize_hook, |
| 26 | __malloc_initialize_hook, GLIBC_2_0); |
| 27 | #endif |
| 28 | |
| 29 | #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_34) |
| 30 | void weak_variable (*__after_morecore_hook) (void) = NULL; |
| 31 | compat_symbol (libc, __after_morecore_hook, __after_morecore_hook, GLIBC_2_0); |
| 32 | void *(*__morecore)(ptrdiff_t); |
| 33 | compat_symbol (libc, __morecore, __morecore, GLIBC_2_0); |
| 34 | |
| 35 | void weak_variable (*__free_hook) (void *, const void *) = NULL; |
| 36 | void *weak_variable (*__malloc_hook) (size_t, const void *) = NULL; |
| 37 | void *weak_variable (*__realloc_hook) (void *, size_t, const void *) = NULL; |
| 38 | void *weak_variable (*__memalign_hook) (size_t, size_t, const void *) = NULL; |
| 39 | compat_symbol (libc, __free_hook, __free_hook, GLIBC_2_0); |
| 40 | compat_symbol (libc, __malloc_hook, __malloc_hook, GLIBC_2_0); |
| 41 | compat_symbol (libc, __realloc_hook, __realloc_hook, GLIBC_2_0); |
| 42 | compat_symbol (libc, __memalign_hook, __memalign_hook, GLIBC_2_0); |
| 43 | #endif |
| 44 | |
| 45 | /* |
| 46 | * Local variables: |
| 47 | * c-basic-offset: 2 |
| 48 | * End: |
| 49 | */ |
| 50 | |