mirror of
https://github.com/mirror/tinycc.git
synced 2026-09-05 12:14:52 +08:00
Allow tcc to run with bounds checking enabled
tcc failed to run with bounds checking enabled because the functions rt_wait_sem, rt_post_sem and _rt_error where defined twice. This is solved by making them weak in tccrun.c Also a nested lock was present when setting TCC_BOUNDS_PRINT_CALLS=1 This is solved in lib/bt-exe.c by moving lock/unlock code. Also added a testcase in tests/Makefile to test tcc with bounds checking enabled.
This commit is contained in:
12
tccrun.c
12
tccrun.c
@@ -66,9 +66,15 @@ TCC_SEM(static rt_sem);
|
||||
static int signal_set;
|
||||
static void set_exception_handler(void);
|
||||
|
||||
int _rt_error(rt_frame *f, const char *msg, const char *fmt, va_list ap);
|
||||
void rt_wait_sem(void) { WAIT_SEM(&rt_sem); }
|
||||
void rt_post_sem(void) { POST_SEM(&rt_sem); }
|
||||
#ifdef _WIN32
|
||||
#define ATTR_WEAK
|
||||
#else
|
||||
#define ATTR_WEAK __attribute__((weak))
|
||||
#endif
|
||||
int ATTR_WEAK _rt_error(rt_frame *f, const char *msg, const char *fmt, va_list ap);
|
||||
void ATTR_WEAK rt_wait_sem(void) { WAIT_SEM(&rt_sem); }
|
||||
void ATTR_WEAK rt_post_sem(void) { POST_SEM(&rt_sem); }
|
||||
#undef ATTR_WEAK
|
||||
#endif /* def CONFIG_TCC_BACKTRACE */
|
||||
|
||||
/* handle exit/atexit for tcc_run() -- thread-unsafe */
|
||||
|
||||
Reference in New Issue
Block a user