summaryrefslogtreecommitdiff
path: root/libmudflap/mf-hooks1.c
diff options
context:
space:
mode:
Diffstat (limited to 'libmudflap/mf-hooks1.c')
-rw-r--r--libmudflap/mf-hooks1.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/libmudflap/mf-hooks1.c b/libmudflap/mf-hooks1.c
index 7199472ebe1..d2f8312314f 100644
--- a/libmudflap/mf-hooks1.c
+++ b/libmudflap/mf-hooks1.c
@@ -1,5 +1,5 @@
/* Mudflap: narrow-pointer bounds-checking by tree rewriting.
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Frank Ch. Eigler <fche@redhat.com>
and Graydon Hoare <graydon@redhat.com>
@@ -74,8 +74,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
use plain macros in mf-runtime.h. */
-#ifdef WRAP_malloc
-
#if PIC
/* A special bootstrap variant. */
void *
@@ -86,6 +84,7 @@ __mf_0fn_malloc (size_t c)
}
#endif
+
#undef malloc
WRAPPER(void *, malloc, size_t c)
{
@@ -108,11 +107,8 @@ WRAPPER(void *, malloc, size_t c)
return result;
}
-#endif
-#ifdef WRAP_calloc
-
#ifdef PIC
/* A special bootstrap variant. */
void *
@@ -136,6 +132,7 @@ __mf_0fn_calloc (size_t c, size_t n)
}
#endif
+
#undef calloc
WRAPPER(void *, calloc, size_t c, size_t n)
{
@@ -164,9 +161,7 @@ WRAPPER(void *, calloc, size_t c, size_t n)
return result;
}
-#endif
-#ifdef WRAP_realloc
#if PIC
/* A special bootstrap variant. */
@@ -177,6 +172,7 @@ __mf_0fn_realloc (void *buf, size_t c)
}
#endif
+
#undef realloc
WRAPPER(void *, realloc, void *buf, size_t c)
{
@@ -220,11 +216,8 @@ WRAPPER(void *, realloc, void *buf, size_t c)
return result;
}
-#endif
-#ifdef WRAP_free
-
#if PIC
/* A special bootstrap variant. */
void
@@ -297,11 +290,8 @@ WRAPPER(void, free, void *buf)
CALL_REAL (free, base);
}
}
-#endif
-#ifdef WRAP_mmap
-
#if PIC
/* A special bootstrap variant. */
void *
@@ -353,10 +343,7 @@ WRAPPER(void *, mmap,
return result;
}
-#endif
-
-#ifdef WRAP_munmap
#if PIC
/* A special bootstrap variant. */
@@ -395,10 +382,7 @@ WRAPPER(int , munmap, void *start, size_t length)
}
return result;
}
-#endif
-
-#ifdef WRAP_alloca
/* This wrapper is a little different, as it's called indirectly from
__mf_fini also to clean up pending allocations. */
@@ -428,7 +412,9 @@ __mf_wrap_alloca_indirect (size_t c)
/* Free any previously alloca'd blocks that belong to deeper-nested functions,
which must therefore have exited by now. */
-#define DEEPER_THAN < /* for x86 */
+
+#define DEEPER_THAN < /* XXX: for x86; steal find_stack_direction() from libiberty/alloca.c */
+
while (alloca_history &&
((uintptr_t) alloca_history->stack DEEPER_THAN (uintptr_t) stack))
{
@@ -474,5 +460,3 @@ WRAPPER(void *, alloca, size_t c)
return __mf_wrap_alloca_indirect (c);
}
-#endif
-