[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] mach-defpager: Declare `__malloc_initialize_hook' as volatile

From: Ludovic Courtès
Subject: [PATCH] mach-defpager: Declare `__malloc_initialize_hook' as volatile
Date: Sat, 05 Nov 2011 19:21:35 +0100
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)


Mach-defpager uses libc’s malloc hooks and fails to build with libc 2.14
where they are declared as volatile [0]:

--8<---------------cut here---------------start------------->8---
i586-pc-gnu-gcc -std=gnu99 -fgnu89-inline -g -O3 -g -O2 -I.  -I..  -I../include 
-DHAVE_LIBDL=1  -c -o kalloc.o kalloc.c
kalloc.c:43:8: error: conflicting type qualifiers for '__malloc_initialize_hook'
 note: previous declaration of '__malloc_initialize_hook' was here
--8<---------------cut here---------------end--------------->8---

OK to apply?

(This is a temporary measure anyway since those variables are


diff --git a/mach-defpager/kalloc.c b/mach-defpager/kalloc.c
index 28c0b55..5d91ace 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.  */
+void (*__MALLOC_HOOK_VOLATILE __malloc_initialize_hook) (void) = init_hook;
 #define        DEBUG
[0] The offending libc change is:

    commit cf6bbbd701380accba8f709cf88b7bb160131e32
    Author: Ulrich Drepper <drepper@gmail.com>
    Date:   Sun May 29 20:40:08 2011 -0400

        Declare malloc hook variables as volatile.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]