aboutsummaryrefslogtreecommitdiff
path: root/lib/bcheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bcheck.c')
-rw-r--r--lib/bcheck.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/bcheck.c b/lib/bcheck.c
index 064fb5d..8ac7d4e 100644
--- a/lib/bcheck.c
+++ b/lib/bcheck.c
@@ -22,7 +22,7 @@
#include <stdarg.h>
#include <string.h>
#if !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) \
- && !defined(__DragonFly__) && !defined(__OpenBSD__)
+ && !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
#include <malloc.h>
#endif
#if !defined(_WIN32)
@@ -41,7 +41,7 @@
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
|| defined(__DragonFly__) || defined(__dietlibc__) \
- || defined(__UCLIBC__) || defined(__OpenBSD__) \
+ || defined(__UCLIBC__) || defined(__OpenBSD__) || defined(__NetBSD__) \
|| defined(_WIN32) || defined(TCC_UCLIBC)
#warning Bound checking does not support malloc (etc.) in this environment.
#undef CONFIG_TCC_MALLOC_HOOKS
@@ -418,6 +418,13 @@ void __bound_init(void)
}
}
+void __bound_main_arg(void **p)
+{
+ void *start = p;
+ while (*p++);
+ __bound_new_region(start, (void *) p - start);
+}
+
void __bound_exit(void)
{
restore_malloc_hooks();
@@ -628,7 +635,7 @@ int __bound_delete_region(void *p)
}
/* return the size of the region starting at p, or EMPTY_SIZE if non
- existant region. */
+ existent region. */
static unsigned long get_region_size(void *p)
{
unsigned long addr = (unsigned long)p;