aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbellard <bellard>2002-08-18 13:25:38 +0000
committerbellard <bellard>2002-08-18 13:25:38 +0000
commit4264267299f1e291e56545edc20c0734d146d7f2 (patch)
tree54ce265e83f2b7d704e57d29345279c52f0ebfeb
parent59b27e85d9ff59f61dee0eeb356660e3507c9a75 (diff)
downloadtinycc-4264267299f1e291e56545edc20c0734d146d7f2.tar.gz
tinycc-4264267299f1e291e56545edc20c0734d146d7f2.tar.bz2
added support for standalone operation
-rw-r--r--bcheck.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bcheck.c b/bcheck.c
index 01e98ff..1f08f20 100644
--- a/bcheck.c
+++ b/bcheck.c
@@ -95,10 +95,14 @@ static void *saved_realloc_hook;
static void *saved_memalign_hook;
#endif
+/* linker definitions */
extern char _end;
-/* TCC defines: */
+/* TCC definitions */
extern char __bounds_start; /* start of static bounds table */
+/* error function. if NULL, simply do abort() */
+void (*__bound_error_func)(unsigned long caller, const char *msg);
+
/* runtime error output */
extern void rt_error(unsigned long pc, const char *fmt, ...);
@@ -141,7 +145,9 @@ static BoundEntry *__bound_find_region(BoundEntry *e1, void *p)
/* print a bound error message */
static void bound_error(const void *caller, const char *fmt, ...)
{
- rt_error((unsigned long)caller, "%s", fmt);
+ if (!__bound_error_func)
+ abort();
+ __bound_error_func((unsigned long)caller, fmt);
}
static void bound_alloc_error(void)