Unified · Split
| @@ -95,10 +95,14 @@ static void *saved_realloc_hook; · 94 unmodified lines | |||
| 95 | static void *saved_memalign_hook; | 95 | static void *saved_memalign_hook; |
| 96 | #endif | 96 | #endif |
| 97 | 97 | ||
| 98 | /* linker definitions */ | ||
| 98 | extern char _end; | 99 | extern char _end; |
| 99 | 100 | ||
| 100 | /* TCC defines: */ | 101 | /* TCC definitions */ |
| 101 | extern char __bounds_start; /* start of static bounds table */ | 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 | /* runtime error output */ | 106 | /* runtime error output */ |
| 103 | extern void rt_error(unsigned long pc, const char *fmt, ...); | 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 | /* print a bound error message */ | 145 | /* print a bound error message */ |
| 142 | static void bound_error(const void *caller, const char *fmt, ...) | 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 | static void bound_alloc_error(void) | 153 | static void bound_alloc_error(void) |