From 66b99a27c644f2bbfbc2feda679415ce80c77a62 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 5 Nov 2011 21:46:15 +0100 Subject: mach-defpager: Declare `__malloc_initialize_hook' as volatile. * mach-defpager/kalloc.c (__MALLOC_HOOK_VOLATILE): New macro. --- mach-defpager/kalloc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c index 28c0b55e..5d91aceb 100644 --- a/mach-defpager/kalloc.c +++ b/mach-defpager/kalloc.c @@ -40,7 +40,13 @@ static void init_hook (void); static void *malloc_hook (size_t size, const void *caller); static void free_hook (void *ptr, const void *caller); -void (*__malloc_initialize_hook) (void) = init_hook; +/* GNU libc 2.14 defines this macro to declare hook variables as volatile. + Define it as empty for older libc versions. */ +#ifndef __MALLOC_HOOK_VOLATILE +# define __MALLOC_HOOK_VOLATILE +#endif + +void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void) = init_hook; #define DEBUG -- cgit v1.2.3