bug-hurd
[Top][All Lists]
Advanced

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

Hello,

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 
-I../include -D_GNU_SOURCE -D_IO_MTSAFE_IO -D_FILE_OFFSET_BITS=64  
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" 
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" 
-DHAVE_MIG_RETCODE=1 -DHAVE_GETGROUPLIST=1 -DHAVE_USELOCALE=1 -DSTDC_HEADERS=1 
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 
-DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 
-DHAVE_UNISTD_H=1 -DHAVE_PARTED_PARTED_H=1 -DHAVE_LIBPARTED=1 -DHAVE_LIBUUID=1 
-DHAVE_LIBDL=1  -c -o kalloc.o kalloc.c
kalloc.c:43:8: error: conflicting type qualifiers for '__malloc_initialize_hook'
/nix/store/j4klk4cmm3ih0lpf749pkab7b82w7lgb-glibc-20111025-i586-pc-gnu/include/malloc.h:170:38:
 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
deprecated.)

Thanks,
Ludo’.

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.  */
+#ifndef __MALLOC_HOOK_VOLATILE
+# define __MALLOC_HOOK_VOLATILE
+#endif
+
+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]