aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libio/fileops.c32
-rw-r--r--malloc/hooks.c37
2 files changed, 40 insertions, 29 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 24235e9134..b6655bed5e 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1541,6 +1541,22 @@ _IO_file_xsgetn_maybe_mmap (fp, data, n)
return _IO_XSGETN (fp, data, n);
}
+#ifdef _LIBC
+versioned_symbol (libc, _IO_new_do_write, _IO_do_write, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_attach, _IO_file_attach, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_close_it, _IO_file_close_it, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_finish, _IO_file_finish, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_fopen, _IO_file_fopen, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_init, _IO_file_init, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_setbuf, _IO_file_setbuf, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_sync, _IO_file_sync, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_overflow, _IO_file_overflow, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
+versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
+#endif
+
struct _IO_jump_t _IO_file_jumps =
{
JUMP_INIT_DUMMY,
@@ -1613,19 +1629,3 @@ struct _IO_jump_t _IO_file_jumps_maybe_mmap =
JUMP_INIT(showmanyc, _IO_default_showmanyc),
JUMP_INIT(imbue, _IO_default_imbue)
};
-
-#ifdef _LIBC
-versioned_symbol (libc, _IO_new_do_write, _IO_do_write, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_attach, _IO_file_attach, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_close_it, _IO_file_close_it, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_finish, _IO_file_finish, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_fopen, _IO_file_fopen, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_init, _IO_file_init, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_setbuf, _IO_file_setbuf, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_sync, _IO_file_sync, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_overflow, _IO_file_overflow, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_seekoff, _IO_file_seekoff, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_underflow, _IO_file_underflow, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_write, _IO_file_write, GLIBC_2_1);
-versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
-#endif
diff --git a/malloc/hooks.c b/malloc/hooks.c
index feb7b2da93..9fab05c307 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -30,6 +30,30 @@
#endif
#endif
+/* Forward declarations. */
+static Void_t* malloc_hook_ini __MALLOC_P ((size_t sz,
+ const __malloc_ptr_t caller));
+static Void_t* realloc_hook_ini __MALLOC_P ((Void_t* ptr, size_t sz,
+ const __malloc_ptr_t caller));
+static Void_t* memalign_hook_ini __MALLOC_P ((size_t alignment, size_t sz,
+ const __malloc_ptr_t caller));
+
+/* Define and initialize the hook variables. These weak definitions must
+ appear before any use of the variables in a function. */
+void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
+void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
+ const __malloc_ptr_t)) = NULL;
+__malloc_ptr_t weak_variable (*__malloc_hook)
+ __MALLOC_P ((size_t __size, const __malloc_ptr_t)) = malloc_hook_ini;
+__malloc_ptr_t weak_variable (*__realloc_hook)
+ __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t))
+ = realloc_hook_ini;
+__malloc_ptr_t weak_variable (*__memalign_hook)
+ __MALLOC_P ((size_t __alignment, size_t __size, const __malloc_ptr_t))
+ = memalign_hook_ini;
+void weak_variable (*__after_morecore_hook) __MALLOC_P ((void)) = NULL;
+
+
#ifndef DEFAULT_CHECK_ACTION
#define DEFAULT_CHECK_ACTION 1
#endif
@@ -81,19 +105,6 @@ memalign_hook_ini(alignment, sz, caller)
return public_mEMALIGn(alignment, sz);
}
-void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
-void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
- const __malloc_ptr_t)) = NULL;
-__malloc_ptr_t weak_variable (*__malloc_hook)
- __MALLOC_P ((size_t __size, const __malloc_ptr_t)) = malloc_hook_ini;
-__malloc_ptr_t weak_variable (*__realloc_hook)
- __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t))
- = realloc_hook_ini;
-__malloc_ptr_t weak_variable (*__memalign_hook)
- __MALLOC_P ((size_t __alignment, size_t __size, const __malloc_ptr_t))
- = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) __MALLOC_P ((void)) = NULL;
-
static int check_action = DEFAULT_CHECK_ACTION;