glibc/glibc-2.16-mcheck.patch

26 lines
675 B
Diff

diff --git a/malloc/mcheck.c b/malloc/mcheck.c
index 9213740..7491c49 100644
--- a/malloc/mcheck.c
+++ b/malloc/mcheck.c
@@ -370,6 +370,12 @@ mabort (enum mcheck_status status)
#endif
}
+#ifndef malloc_opt_barrier
+#define malloc_opt_barrier(x) \
+({ __typeof (x) __x = x; __asm ("" : "+m" (__x)); __x; })
+#define malloc_force_eval(x) __asm __volatile ("" : : "m" (x))
+#endif
+
int
mcheck (func)
void (*func) (enum mcheck_status);
@@ -381,6 +387,7 @@ mcheck (func)
{
/* We call malloc() once here to ensure it is initialized. */
void *p = malloc (0);
+ p = malloc_opt_barrier (p);
free (p);
old_free_hook = __free_hook;