Unified · Split
| @@ -95,10 +95,14 @@ static void *saved_realloc_hook; · 94 unmodified lines | ||
| 95 | 95 | static void *saved_memalign_hook; |
| 96 | 96 | #endif |
| 97 | 97 | |
| 98 | +/* linker definitions */ | |
| 98 | 99 | extern char _end; |
| 99 | 100 | |
| 100 | −/* TCC defines: */ | |
| 101 | +/* TCC definitions */ | |
| 101 | 102 | extern char __bounds_start; /* start of static bounds table */ |
| 103 | +/* error function. if NULL, simply do abort() */ | |
| 104 | +void (*__bound_error_func)(unsigned long caller, const char *msg); | |
| 105 | + | |
| 102 | 106 | /* runtime error output */ |
| 103 | 107 | extern void rt_error(unsigned long pc, const char *fmt, ...); |
| 104 | 108 | |
| @@ -141,7 +145,9 @@ static BoundEntry *__bound_find_region(BoundEntry *e1, void *p) · 36 unmodified lines | ||
| 141 | 145 | /* print a bound error message */ |
| 142 | 146 | static void bound_error(const void *caller, const char *fmt, ...) |
| 143 | 147 | { |
| 144 | − rt_error((unsigned long)caller, "%s", fmt); | |
| 148 | + if (!__bound_error_func) | |
| 149 | + abort(); | |
| 150 | + __bound_error_func((unsigned long)caller, fmt); | |
| 145 | 151 | } |
| 146 | 152 | |
| 147 | 153 | static void bound_alloc_error(void) |