--- tcc-0.9.20.orig/bcheck.c +++ tcc-0.9.20/bcheck.c @@ -76,7 +76,9 @@ /* currently, tcc cannot compile that because we use unsupported GNU C extensions */ -#if !defined(__TINYC__) +#if defined(__TINYC__) +#define __attribute__(ignore) +#endif void *__bound_ptr_add(void *p, int offset) __attribute__((regparm(2))); void *__bound_ptr_indir1(void *p, int offset) __attribute__((regparm(2))); void *__bound_ptr_indir2(void *p, int offset) __attribute__((regparm(2))); @@ -86,7 +88,6 @@ void *__bound_ptr_indir16(void *p, int offset) __attribute__((regparm(2))); void __bound_local_new(void *p) __attribute__((regparm(1))); void __bound_local_delete(void *p) __attribute__((regparm(1))); -#endif void *__bound_malloc(size_t size, const void *caller); void *__bound_memalign(size_t size, size_t align, const void *caller); @@ -168,7 +169,7 @@ /* return '(p + offset)' for pointer arithmetic (a pointer can reach the end of a region in this case */ -void *__bound_ptr_add(void *p, int offset) +void * __attribute__((regparm(2))) __bound_ptr_add(void *p, int offset) { unsigned long addr = (unsigned long)p; BoundEntry *e; @@ -194,7 +195,8 @@ /* return '(p + offset)' for pointer indirection (the resulting must be strictly inside the region */ #define BOUND_PTR_INDIR(dsize) \ -void *__bound_ptr_indir ## dsize (void *p, int offset) \ +void * __attribute__((regparm(2))) __bound_ptr_indir ## dsize \ + (void *p, int offset) \ { \ unsigned long addr = (unsigned long)p; \ BoundEntry *e; \ @@ -227,7 +229,7 @@ #endif /* called when entering a function to add all the local regions */ -void __bound_local_new(void *p1) +void __attribute__((regparm(1))) __bound_local_new(void *p1) { unsigned long addr, size, fp, *p = p1; GET_CALLER_FP(fp); @@ -243,7 +245,7 @@ } /* called when leaving a function to delete all the local regions */ -void __bound_local_delete(void *p1) +void __attribute__((regparm(1))) __bound_local_delete(void *p1) { unsigned long addr, fp, *p = p1; GET_CALLER_FP(fp); @@ -266,13 +268,14 @@ { } -void *__bound_ptr_add(void *p, int offset) +void * __attribute__((regparm(2))) __bound_ptr_add(void *p, int offset) { return p + offset; } #define BOUND_PTR_INDIR(dsize) \ -void *__bound_ptr_indir ## dsize (void *p, int offset) \ +void * __attribute__((regparm(2))) __bound_ptr_indir ## dsize\ + (void *p, int offset)\ { \ return p + offset; \ }